Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2023498imu; Fri, 14 Dec 2018 04:40:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/W5RKdju3rat3o8Du4djM5VlJFaeTbUc0zKpK2fB8LwXGpu6jPNy+9f7LNcdrUz3Fz3TWZR X-Received: by 2002:a17:902:a6:: with SMTP id a35mr2719860pla.201.1544791224546; Fri, 14 Dec 2018 04:40:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544791224; cv=none; d=google.com; s=arc-20160816; b=PjeEbI+fanxyiw3brJ2g8VWDDxpjt7jmP4B2Wt6HC2VtwreXy6VZOGjDc0hSa6NpUC GB4oJmaIlHPYE/8DHdlyeNgYPgfdUBX08S2/3BwiHHHKMxo0uKjKUcLJKMrwFytCl/Oe gNxZZQymtze6poShbTM944ZetXDvMaHYuBdMDgCXAAgyZ//KsBtlVLpIu6Y4tqcBCOKC fuCp6Jgz07oz/7r7tgBwDRTURh7JtuHidy6mfdJfUql0cj1qxQQEsia8bp0LLy+ki/jj jR1+9lP8Poks7h5NQ3Gvuq/lauFfPTRt+vD4Tq1Vqnk4n9yJs9k+CSzmNjIp0OZkgNUN B+8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=snlryqiDJPj2uBiIzSfyiBwjxN9nlHMzJE4lnC0tW4E=; b=H1P0WlcveAlt7tLkJCUTkq4RNiVRE8jPINn0bvHJEAStU54DFnNxJQgeX2uCJJIy0/ 9h1e9hetwW0B8s67VMyhawu5CmwoJT9+wGy5L9YE7tJu2e3YgJjeeVKW5TbOWWH7s6CT KjR7sZxLOVJbaOjppuKHbc0PJmHuGXrO3cqkHIFeaPgxI+UPFR2byEauQsxufpe6wdPJ HjxfU8JZBFR4BolANOxKdKZDszE3NtOOwzl+ok6mp2sblD8GihXQfpQpQWKaDpglI6zU vwtE58lBISVikyZhjx8gDKlsxlW9hqlxi2kP00nucM+MmnG7VzrHsEc9KY3wHL3y1IyH 1Ijw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sbKVqyww; 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 l17si4300016pfd.236.2018.12.14.04.40.09; Fri, 14 Dec 2018 04:40:24 -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; dkim=pass header.i=@kernel.org header.s=default header.b=sbKVqyww; 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 S1730617AbeLNMFE (ORCPT + 99 others); Fri, 14 Dec 2018 07:05:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:49796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729855AbeLNMFC (ORCPT ); Fri, 14 Dec 2018 07:05:02 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0B1252148E; Fri, 14 Dec 2018 12:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544789101; bh=UZ4W0Io4q0Btk0t5gSOp3ArpXWDMUdI8OcVvFYfUs2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sbKVqywwDWRqWOvVrFhU9zyJzoNpSPo5rqRuhAI9MTUITNGePGCcAHoA1CIIFLB/i 0xGmDz+UcJDG7a8LIItK8bs3JFk2IN89Tk/+/qobS/XY8Qjp5BHsVhWdYQAnHK5Asz Dhe0ysX0inMEFPvpOeTXRpsg3cOOOCDKoJ+M6lxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parav Pandit , Mark Bloch , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.19 072/142] RDMA/core: Add GIDs while changing MAC addr only for registered ndev Date: Fri, 14 Dec 2018 12:59:17 +0100 Message-Id: <20181214115749.943982347@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115747.053633987@linuxfoundation.org> References: <20181214115747.053633987@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit d52ef88a9f4be523425730da3239cf87bee936da ] Currently when MAC address is changed, regardless of the netdev reg_state, GID entries are removed and added to reflect the new MAC address and new default GID entries. When a bonding device is used and the underlying PCI device is removed several netdevice events are generated. Two events of the interest are CHANGEADDR and UNREGISTER event on lower(slave) netdevice of the bond netdevice. Sometimes CHANGEADDR event is generated when netdev state is UNREGISTERING (after UNREGISTER event is generated). In this scenario, GID entries for default GIDs are added and never deleted because GID entries are deleted only when netdev state is < UNREGISTERED. This leads to non zero reference count on the netdevice. Due to this, PCI device unbind operation is getting stuck. To avoid it, when changing mac address, add GID entries only if netdev is in REGISTERED state. Fixes: 03db3a2d81e6 ("IB/core: Add RoCE GID table management") Signed-off-by: Parav Pandit Reviewed-by: Mark Bloch Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/core/roce_gid_mgmt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c index ee366199b169..25d43c8f1c2a 100644 --- a/drivers/infiniband/core/roce_gid_mgmt.c +++ b/drivers/infiniband/core/roce_gid_mgmt.c @@ -767,8 +767,10 @@ static int netdevice_event(struct notifier_block *this, unsigned long event, case NETDEV_CHANGEADDR: cmds[0] = netdev_del_cmd; - cmds[1] = add_default_gid_cmd; - cmds[2] = add_cmd; + if (ndev->reg_state == NETREG_REGISTERED) { + cmds[1] = add_default_gid_cmd; + cmds[2] = add_cmd; + } break; case NETDEV_CHANGEUPPER: -- 2.19.1