Received: by 10.223.185.116 with SMTP id b49csp5479256wrg; Wed, 7 Mar 2018 12:29:06 -0800 (PST) X-Google-Smtp-Source: AG47ELtYhJUpo9468zSRiFf4smrYTuIB9bJ/DsJeNZaspEotFJqHJEovmCgSeNln8gb50gIJZ/BY X-Received: by 2002:a17:902:3303:: with SMTP id a3-v6mr21452632plc.399.1520454546638; Wed, 07 Mar 2018 12:29:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520454546; cv=none; d=google.com; s=arc-20160816; b=H9SEp5I+m7MmN1baBGSYo8DrkTejHEqX3ijyyqv2pxAxpx5CFpDKHSyeq9FG6nUrhg vOCTHjanPkvlevflQNFKlMQkrrqBnyLF4stC/EEGD5oCvsYQYQ3lpi7yvutEpmsf/zcP 3SukO0BRP+uLnPPxUGj5ykuhF3BC3LSie9XdADfNytdB5hk7cEZ7RodF0t7Cx3hvUU+H 4xlg8NuBbX4WICZgFL8ztqQiGbrVvgyZ23K7s1JzvKR+82a0i7R+AjJOF4X9NYlNw03y DjoUn7xYPw6lrWE73j7Nd7CCO3MJQRttVEQQMTx1EkN4sRjEVv7/oGtn5N68t4g8ZWza N2Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=TTPskojyP0m/WGvZKyFkGp0G0NBPMcHJyCKnVDeRqIY=; b=URH23Hy4ifyyhWPYnH/jVaynDsI0V4lOBuRftHy91cZA5tiBxZz7W7yh7G8SVBgBAs gj0jSHg70NGDN5t9CR8X5PQXAtlRH458vmug1YsUMkfZv64SsbzFw7D3fn0jxbec8kmX AQ+G0jSoeaHAUbPpJcVhcRS2QmX6jOgIHcOLQLEReGcRaDyxQL7yspK2tRRpp8GSXf3L 6JS7cRnMFPEC0Mjl4huoiXh9k8pGd2ZvACY50rpec+rz16R66b+z6lJ+EwWFr7Mi6yPt 83ftiKxtR6S1lrMZo2wf0Dg3tzrMHvHVW4uu2pK2eDEWPIodVhUNo9C4zxr58QYPOYT2 xgmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y125si11811286pgb.120.2018.03.07.12.28.50; Wed, 07 Mar 2018 12:29:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934935AbeCGTmw (ORCPT + 99 others); Wed, 7 Mar 2018 14:42:52 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42544 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933537AbeCGTmt (ORCPT ); Wed, 7 Mar 2018 14:42:49 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6847A109B; Wed, 7 Mar 2018 19:42:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julian Wiedmann , "David S. Miller" Subject: [PATCH 4.15 089/122] s390/qeth: fix SETIP command handling Date: Wed, 7 Mar 2018 11:38:21 -0800 Message-Id: <20180307191742.296431192@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Julian Wiedmann [ Upstream commit 1c5b2216fbb973a9410e0b06389740b5c1289171 ] send_control_data() applies some special handling to SETIP v4 IPA commands. But current code parses *all* command types for the SETIP command code. Limit the command code check to IPA commands. Fixes: 5b54e16f1a54 ("qeth: do not spin for SETIP ip assist command") Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/s390/net/qeth_core.h | 5 +++++ drivers/s390/net/qeth_core_main.c | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h @@ -581,6 +581,11 @@ struct qeth_cmd_buffer { void (*callback) (struct qeth_channel *, struct qeth_cmd_buffer *); }; +static inline struct qeth_ipa_cmd *__ipa_cmd(struct qeth_cmd_buffer *iob) +{ + return (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE); +} + /** * definition of a qeth channel, used for read and write */ --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -2057,7 +2057,7 @@ int qeth_send_control_data(struct qeth_c unsigned long flags; struct qeth_reply *reply = NULL; unsigned long timeout, event_timeout; - struct qeth_ipa_cmd *cmd; + struct qeth_ipa_cmd *cmd = NULL; QETH_CARD_TEXT(card, 2, "sendctl"); @@ -2083,10 +2083,13 @@ int qeth_send_control_data(struct qeth_c while (atomic_cmpxchg(&card->write.irq_pending, 0, 1)) ; qeth_prepare_control_data(card, len, iob); - if (IS_IPA(iob->data)) + if (IS_IPA(iob->data)) { + cmd = __ipa_cmd(iob); event_timeout = QETH_IPA_TIMEOUT; - else + } else { event_timeout = QETH_TIMEOUT; + } + timeout = jiffies + event_timeout; QETH_CARD_TEXT(card, 6, "noirqpnd"); @@ -2111,9 +2114,8 @@ int qeth_send_control_data(struct qeth_c /* we have only one long running ipassist, since we can ensure process context of this command we can sleep */ - cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); - if ((cmd->hdr.command == IPA_CMD_SETIP) && - (cmd->hdr.prot_version == QETH_PROT_IPV4)) { + if (cmd && cmd->hdr.command == IPA_CMD_SETIP && + cmd->hdr.prot_version == QETH_PROT_IPV4) { if (!wait_event_timeout(reply->wait_q, atomic_read(&reply->received), event_timeout)) goto time_err;