Received: by 10.223.185.111 with SMTP id b44csp901315wrg; Fri, 9 Mar 2018 16:24:07 -0800 (PST) X-Google-Smtp-Source: AG47ELtc3stcQVEXnjWhtAiPm+QWarBybLjVkQhrT0BfW+3GKPCEPNPWkEhxAT/afyV6vKhEzERE X-Received: by 10.98.33.76 with SMTP id h73mr327375pfh.144.1520641447863; Fri, 09 Mar 2018 16:24:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520641447; cv=none; d=google.com; s=arc-20160816; b=VkqDWsrtGZk1SEqLEYfpMJR7S5V5fEzsC5ekAd4f9+3YF65bXkw6hABpFLLywoEVXe oiSmGf2DYPUSBoRUu5zttFdsbo2Yi+oCG7M7MoGa0FUmD/JbkIvDbFHhZpYV3M/zQd5m HUxuDN5AJD6cSMPudpGuRlFncAk8jQO2ZIiwVi3p0opaauHGUzpbA4VHX2A36BpyVQ5B Yu5mG56OP6X6ZJrqq/5qthNqI8sDENXWJJvAUKbB2+zm/tAmiOC1lyZlGDtBe5RWjFgp 4KaThCfoej5P/dlDMNAVLoLXsniKpjz3smSuy52hgsOVTdqNYdjCekYH66qmggBMoWwd z9dA== 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=+wuq2cVsHvefFZsmL9Z9UVB71+vYnoVilHBeE6O3URA=; b=NMCvXTIJNuTFS0FjDIvXEPOGUXqlnw3M63QbAMTg0XqiiVe91cLBLAaArdHhpQy1PL BXhDrbPzCQfBmJQtTAynzrWV3hAlJRhtIl+cnuGXVOc+mM8a147DiZTmCxIh/py3/fWC esyJ4+3cwS1cXuXCFJTY8KN1uPRfLXQBU6ajgR3B5vZUy/LJ4xFIQKPWvUxA3Fputjb3 LQjCiXYVuurz1v2/qMsB0UIc4WanrSfFuHeHVHbKz1OlXUs+tzZ8aUFwhTtVpVuvp0oz pQvJsSmOUwhu8DvozAwSpGq2v4ioMRmZWBq3RV/3uRCyrcSDGRO41LWN40ycqG6LqUTW KFqQ== 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 k3-v6si1724838pld.719.2018.03.09.16.23.53; Fri, 09 Mar 2018 16:24:07 -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 S933917AbeCJAWi (ORCPT + 99 others); Fri, 9 Mar 2018 19:22:38 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40040 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933578AbeCJAWc (ORCPT ); Fri, 9 Mar 2018 19:22:32 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A216F115E; Sat, 10 Mar 2018 00:22:31 +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 52/65] s390/qeth: fix IP removal on offline cards Date: Fri, 9 Mar 2018 16:18:52 -0800 Message-Id: <20180310001829.153472986@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 98d823ab1fbdcb13abc25b420f9bb71bade42056 ] If the HW is not reachable, then none of the IPs in qeth's internal table has been registered with the HW yet. So when deleting such an IP, there's no need to stage it for deregistration - just drop it from the table. This fixes the "add-delete-add" scenario on an offline card, where the the second "add" merely increments the IP's use count. But as the IP is still set to DISP_ADDR_DELETE from the previous "delete" step, l3_recover_ip() won't register it with the HW when the card goes online. Fixes: 5f78e29ceebf ("qeth: optimize IP handling in rx_mode callback") Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/s390/net/qeth_l3_main.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -259,12 +259,8 @@ int qeth_l3_delete_ip(struct qeth_card * if (addr->in_progress) return -EINPROGRESS; - if (!qeth_card_hw_is_reachable(card)) { - addr->disp_flag = QETH_DISP_ADDR_DELETE; - return 0; - } - - rc = qeth_l3_deregister_addr_entry(card, addr); + if (qeth_card_hw_is_reachable(card)) + rc = qeth_l3_deregister_addr_entry(card, addr); hash_del(&addr->hnode); kfree(addr); @@ -406,11 +402,7 @@ static void qeth_l3_recover_ip(struct qe spin_lock_bh(&card->ip_lock); hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { - if (addr->disp_flag == QETH_DISP_ADDR_DELETE) { - qeth_l3_deregister_addr_entry(card, addr); - hash_del(&addr->hnode); - kfree(addr); - } else if (addr->disp_flag == QETH_DISP_ADDR_ADD) { + if (addr->disp_flag == QETH_DISP_ADDR_ADD) { if (addr->proto == QETH_PROT_IPV4) { addr->in_progress = 1; spin_unlock_bh(&card->ip_lock);