Received: by 10.223.185.111 with SMTP id b44csp908317wrg; Fri, 9 Mar 2018 16:34:46 -0800 (PST) X-Google-Smtp-Source: AG47ELveRe7UdcFURxImMSnubmPHPmQUCFFGVciGO5AotGlY809JzN6bdMtvWbfMmWkkUk4GLzaB X-Received: by 10.98.194.87 with SMTP id l84mr365524pfg.6.1520642086695; Fri, 09 Mar 2018 16:34:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520642086; cv=none; d=google.com; s=arc-20160816; b=sZ2nGm+rxSw9EDR43UgrSmIBD5rz+VRCe4vxPW2vAIO4xa/H1KyN72MqzDFx2P3+sB cAk07O+jI42gxeke7cKGbxgFzYTjVM4uuUgfsF4R+7HGbt4elo7S5/Pw0AMaQ5h1jr0U m6MHTjOvLe2UvYKx1ZESaTYfke19/TT8ekYPiOdQahB5OtXGRGcUn2ocWOHZ7XGv/Lgg /S9+TtS0/anakGwYUM3jfZ0eB+AP703uspdNfBtH//qu7kZjPvqTS2jwWjj8JzDYHL7A zxvcibHbS1p4X4KzWV4KiQRdUtuA1Z4BrEi7sx7fjYKX/XZlirGVl8ILhZmvisyR9KRo ZYfA== 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=gCyHQuhHSSjsz43QCDvnNyxLgVmdXuInY7DQp1D6mv8=; b=H/8cgDVvfVSIQsTxLEPOp8mUl9nuAytIgnXTUVRWZUxyqtYsE4+QfjkNLtsEGNJubt I+j5em5iO0o4icud5gsiTrLAN8yRSZt7MYDPFXcEOSEwbjmZpDuKbeaJjkgkapjnDj5i JZ12a3ImgTdQ1z6hi2nWc60kj6waJeEihzVjOvlG8qj3QvyFXdRPcNjPTZQUeTEdXSJu H3rEaMQc0L+EkXZRmV1U67jTNdpWMgjt6nEwdQHIeY0XkqeYhu8r9qBTh/Wh7Kf5RI2y tIPJD+PeBpYNAcTxFAormgfxsK9uLm7YjYE+asbrpGwHn5k81Uo+xE03AzC9jTH7j9w3 dXtQ== 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 i127si1000997pfc.148.2018.03.09.16.34.32; Fri, 09 Mar 2018 16:34:46 -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 S933145AbeCJAce (ORCPT + 99 others); Fri, 9 Mar 2018 19:32:34 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40004 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933861AbeCJAW0 (ORCPT ); Fri, 9 Mar 2018 19:22:26 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8D1861176; Sat, 10 Mar 2018 00:22:25 +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.9 50/65] s390/qeth: fix SETIP command handling Date: Fri, 9 Mar 2018 16:18:50 -0800 Message-Id: <20180310001828.976045612@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180310001824.927996722@linuxfoundation.org> References: <20180310001824.927996722@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.9-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 @@ -592,6 +592,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 @@ -2050,7 +2050,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"); @@ -2077,10 +2077,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"); @@ -2105,9 +2108,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;