Received: by 10.223.185.111 with SMTP id b44csp914535wrg; Fri, 9 Mar 2018 16:44:43 -0800 (PST) X-Google-Smtp-Source: AG47ELvBtVAt8m/VHoCqu9/9Q8wrYTgnkQQJgwAKVAcgIR5oWwct+s6B6jsGtsc1mEnHlLXH5ESo X-Received: by 2002:a17:902:7598:: with SMTP id j24-v6mr362993pll.1.1520642683496; Fri, 09 Mar 2018 16:44:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520642683; cv=none; d=google.com; s=arc-20160816; b=mdz8GD72ZI8C2N+HeYKbe0rghTc49B90nIBwT4O6CcFhp+mYQ/8wwGvQKqXMgbIpTd fPz/ClwP9WkM32s8s6sdTbFMmXWkmdHMnrN4tZ+iffI4w6T7d5bS+p03D3MUZ3ex9gqr 9sm57OBQWaKzxBeJjY7VQEKxq1YLHCa3yZefDrqLevQ0X774wbeconV3PMdgeNPnlgvx N9TgDbCAs02hh0ZoLTVKrw1qf1hDyO408YVldzy8G4u1u/RniBjPqMi5w+vBBm0UW6qQ p2egPDeyB/843h4Sp5Gj3kYrr7qiCCVh7PuRNnNTQx2KPX2vWjOgB74fqXLXS7tFauOB HKUA== 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=XgTUyqdSLVPir9YBkYnqB3kXpeaQ2cTfaEOHnVHCdq4=; b=mWDTxLf71670joIlSWEMvTsFa47BWgu07K9gm57UFGvycMsKOUXYQZye6t7enGQJKA BPLM1sZQ5ubv+Ch/bD8rHsd3yPuG2VB9NZm8X/pS2opuYrEGrprLnIOfJtEgwij2TrCa lITwcwPGy9UebVQ4VDo2Y1jA39BP/33xGA4r5hmzgWgRY4BqagY5tnXfKeKMT/v9d9K0 zWhmH+Tnw9D9ste2AhD0v1zkCVJdMhBzuBIj4L81SfUbKMFu42VDikqTvXejYrMCmKVx OAFr3xSzX3bQy4opAVnU+rB4hWu38hAL2+hhP1qKpmc7KZkgPI0poj82DXfZXpZH3Zgs 9gsg== 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 i61-v6si1759316plb.140.2018.03.09.16.44.29; Fri, 09 Mar 2018 16:44:43 -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 S933571AbeCJAnd (ORCPT + 99 others); Fri, 9 Mar 2018 19:43:33 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39276 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933495AbeCJAUo (ORCPT ); Fri, 9 Mar 2018 19:20:44 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BFE4A105B; Sat, 10 Mar 2018 00:20:43 +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.4 29/36] s390/qeth: fix SETIP command handling Date: Fri, 9 Mar 2018 16:18:45 -0800 Message-Id: <20180310001808.973365521@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180310001807.213987241@linuxfoundation.org> References: <20180310001807.213987241@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.4-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 @@ -591,6 +591,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 @@ -2054,7 +2054,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"); @@ -2081,10 +2081,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"); @@ -2109,9 +2112,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;