Message ID | de06513da07820ca281fa153848b264f10aef70f.1528383246.git.petrm@mellanox.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show
Return-Path: <linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9E05260146 for <patchwork-linux-mlxsw@patchwork.kernel.org>; Thu, 7 Jun 2018 15:03:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FA6D2968B for <patchwork-linux-mlxsw@patchwork.kernel.org>; Thu, 7 Jun 2018 15:03:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 843CA2968D; Thu, 7 Jun 2018 15:03:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DBBFD2968B for <patchwork-linux-mlxsw@patchwork.kernel.org>; Thu, 7 Jun 2018 15:03:52 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 411phl0bh6zF34W for <patchwork-linux-mlxsw@patchwork.kernel.org>; Fri, 8 Jun 2018 01:03:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="LTyMWMqh"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=104.47.2.51; helo=eur01-db5-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=<UNKNOWN>) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="LTyMWMqh"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0051.outbound.protection.outlook.com [104.47.2.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 411pf74YdszF34v for <linux-mlxsw@lists.ozlabs.org>; Fri, 8 Jun 2018 01:01:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WwD1SWE/ehcvvISejCI4ej/mFDTORJLhhbcsH6bn7FY=; b=LTyMWMqhN5AD4/rE5PztYF13Tobt6brBWpsgFpHnpEduhTqKZ7DKxNu29mJZ3thez97RlIavel3YsEEU/rjH4aebwJ/hRIMMu7JtoElgKPy0lj/I+f86bgGx9FeCXH6Qi5UyigxsOKv2E4VWrJqwAVjw3RePU0xqT02cGy/ht1s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.14; Thu, 7 Jun 2018 15:01:29 +0000 From: Petr Machata <petrm@mellanox.com> To: <linux-internal@mellanox.com> Subject: [PATCH net mlxsw 2/2] mlxsw: spectrum_switchdev: Fix port_vlan refcounting In-Reply-To: <cover.1528383246.git.petrm@mellanox.com> References: <cover.1528383246.git.petrm@mellanox.com> Message-Id: <de06513da07820ca281fa153848b264f10aef70f.1528383246.git.petrm@mellanox.com> Date: Thu, 07 Jun 2018 17:01:23 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: LNXP265CA0033.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::21) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:OAxmPYmwGhg5UNNQoaO8LOLC4uL30kbodUu8Pw3O7FB58n3B1PaRs87/v68yxOV8dzYHf/Uofu/4hxYsTCsRUt+Atub73Ns//bAD6hSqaRTDkjeufCXJBh7oQbLCAe+OeZqZTbnGXHPfQzilTNAUOlj/CUj4FUUaRvH7mLa7/m1xSSWvx0vYDMAS/RzSdaXAFlVPLX/MdKYEMNysuAO49rf2wzB9CkFuFIUFJ8Wmui/PRDBRfJYvcpeF75Qub+7k; 25:EBHPTCqSN/6ZLKCysor6Eb3NKvpNgAuAyM5fpBe6Hd64PJVpWxrO5fpHAiu73/8+abWhn6ZVA/a2Fj25C2e3rGke2Bn7/4qs9cRiZ5y2Frn7URKnQ5uoi63ZNMDhvnPAAsEf1pBT6aHpMSSAsAef8o0daPKw3s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5hQBxCIgn++oiu/1sdGNtWBFAXsv3oXPW8SFCApIN+vTMoX9IkWYHMlUSYKFXfI4K0icoE0255NV8hM3BWkWDoqT5QIp4OohmlMz7RT1B1iFNWzgrhNsxRQ1qTth83bNenhWxtovuPDMv6PKlJy8/kT5FS8hta/KPlWplCgE+etPqnYg7ZLtzKG0p0dTwoBJ8blpBP5CikO1nLt9HWudyeKMO+sBBchgIx53wsbH5HMEU1fSxTQpL X-Microsoft-Antispam-PRVS: <VI1PR05MB4191FB90AC2558B16D77FB48DB640@VI1PR05MB4191.eurprd05.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 06968FD8C4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(366004)(376002)(346002)(396003)(199004)(189003)(186003)(25786009)(16586007)(3846002)(6116002)(68736007)(58126008)(37006003)(2351001)(5660300001)(2616005)(478600001)(446003)(11346002)(476003)(956004)(486006)(2906002)(105586002)(6486002)(7736002)(106356001)(316002)(36756003)(53936002)(305945005)(81156014)(81166006)(8936002)(8676002)(66066001)(47776003)(59450400001)(386003)(48376002)(6666003)(6496006)(6636002)(118296001)(86362001)(51416003)(50466002)(6862004)(97736004)(26005)(76176011)(52116002)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB4191; 23:Bmhm2SgsjvjwCUeC083XWJ0UGFLwTcRx8y7HNMpIS?= =?us-ascii?Q?+0XMVRySwYnEUVi8WSs01EGwr7wEa+gc1PsZIzTyij1GpNjLS8D0rHwJOatz?= =?us-ascii?Q?c0sgd6NQGKtbmRv2VyM+kzM89ZktfQ80XEeD5g/8ZxRcOSNqDLsbUFfUWNba?= =?us-ascii?Q?HroKcqbw/kLsbYpUP511qRz4eqe6MkG+ZT6sJss9faLtLqczVOT6+6UUo3uu?= =?us-ascii?Q?/9cND46KbPSWV3X8PAWceMnWBvsaSTA2ceTlmXYXY58FPq1IBoqYhi7vuklL?= =?us-ascii?Q?ieY+ufoT0dCw7FSqDlhGbp9CTGhGDGl4HOBUUt4KDh6jOWmK5cHy7lMCihNU?= =?us-ascii?Q?aJMLjbYCF8R1uyX2IAPmPqUUVQUhJ0+H0lIgkTy0/Dm0GnZjfRAQFwlcxlYW?= =?us-ascii?Q?J8IR5bQ5xQuBT++hP1o8s3d3le1A4CF87DSwC7axk6fYM8wCBdsvaya4LOlx?= =?us-ascii?Q?32nT7WBwMrco42gVRMaRGXMG/AknkjsmU/WUkrrpl3kSjlOWMo88SkZuCbE2?= =?us-ascii?Q?0/ue0GD3HBWG4w79SM2ddLqnF0CIlhgANlMh2SVQGGAMK9W60CW/IF7pwI1Q?= =?us-ascii?Q?bMmzuExQ476t3ibd+iUvZpjlP73R6BcQZvVVdlv6DbERyJKWjRK6pll8baQW?= =?us-ascii?Q?QGDPBZo6dpHwrP1VS/91hHELAtLvnr8hMtu9cjEELw35ZfpKtjZMATTAU5D4?= =?us-ascii?Q?t0900KCk5BOs4vmfJWc3YXVRNFTEc421p257HXt6KFxwZT1y0qv4i1Ahxwe9?= =?us-ascii?Q?gbZfP5yDnfEYazKOyGpE7tN60Gm5yoH+XQmdf8k40Wq+Aa8sRL/D8dYLwf7/?= =?us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IkGxQc7cidJtxQN34S2229mgzJXdgkB0K1PbiWSb5pTtHt49RUIPV/GjsnKVmohDD20LUNPAmSanp7ZdZ/iXnpfiNuKd12XoIF1pObuyr1jY9X6a77OeZZN6fXCxQinBZu0iX41mPiORI2VKbHzIgkYxFEriHdrbsHv7xzsjheG9VxjmTYToelNdRoai7zW+g9g==; 5:EJWqNRS7pCpj0+21Nxu5V61B9eeA2jwCt6+SbO94KA0nZPpdazfSDQP8JCGHVC8zt57Mrdb/LDTnZwC8fXYBbV0SozzclOLYyrygsdgm7QNu4lziAIlqC1jj2dFTr5TLJ20gXGSsxgMXUnCeATSg3W1WagmDvNxWpeycbI6HaDw=; 24:D+MQtIJA8Cw5mMMXKuzHDOJyfU/c8T3zuFbDlrqd2SdQdTDW3Na7oeznKYDUyEsju6vd6SJaDo5gSoTfl/1OuHPsY5vlr5xTgXdccBSkLYw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:FJcb78FbmJFMghxf4+kYf7Zf/k4fAUtfU1D55PNMLSB2wN//5EU+eKGkihCDaxVeY55NqrG7xwKIH2SYn80IpzP9VRQxomnMdiYQUK1W05CgIRtznjyB4AXWaGTDOKQw2mFD9N5i7GjJsURb2MNXmKfoU1yIQKKMq/YU9CN6CuW3TwxOfMyTbZ6cxrpbXzLXFtGqCxM6ls5Vriy+VaJyAulRazfwlyQtzV7hCB6PsnYq/TGtMifoAi+r8WUPxt9w X-MS-Office365-Filtering-Correlation-Id: 2892e7eb-7434-439e-ce30-08d5cc878cb6 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2018 15:01:29.3433 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2892e7eb-7434-439e-ce30-08d5cc878cb6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4191 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development <linux-mlxsw.lists.ozlabs.org> List-Unsubscribe: <https://lists.ozlabs.org/options/linux-mlxsw>, <mailto:linux-mlxsw-request@lists.ozlabs.org?subject=unsubscribe> List-Archive: <http://lists.ozlabs.org/pipermail/linux-mlxsw/> List-Post: <mailto:linux-mlxsw@lists.ozlabs.org> List-Help: <mailto:linux-mlxsw-request@lists.ozlabs.org?subject=help> List-Subscribe: <https://lists.ozlabs.org/listinfo/linux-mlxsw>, <mailto:linux-mlxsw-request@lists.ozlabs.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index e97652c..e9204a1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1105,7 +1105,10 @@ mlxsw_sp_bridge_port_vlan_add(struct mlxsw_sp_port *mlxsw_sp_port, u16 old_pvid = mlxsw_sp_port->pvid; int err; - mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_get(mlxsw_sp_port, vid); + mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid); + if (!mlxsw_sp_port_vlan) + mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_create(mlxsw_sp_port, + vid); if (IS_ERR(mlxsw_sp_port_vlan)) return PTR_ERR(mlxsw_sp_port_vlan);
Switchdev notifications for addition of SWITCHDEV_OBJ_ID_PORT_VLAN are distributed not only on clean addition, but also when flags on an existing VLAN are changed. Thus it is wrong to look up the corresponding port_vlan object by calling mlxsw_sp_port_vlan_get(), which bumps reference of a preexisting port_vlan. This leads to reference counting discrepancy, which triggers a warning in mlxsw_sp_port_remove on mlxsw unload. Fix by replacing the problematic call with a combination of calls to mlxsw_sp_port_vlan_find_by_vid() and mlxsw_sp_port_vlan_create(). Fixes: c57529e1d5d8 ("mlxsw: spectrum: Replace vPorts with Port-VLAN") Signed-off-by: Petr Machata <petrm@mellanox.com> --- drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)