Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3705502pxb; Mon, 24 Jan 2022 15:54:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+OxSgTLFY1OceUYjcSwHynRUSwoCahxLMHrkUW159VV+91n2W+AspV3Vlh57YIdVaMZVz X-Received: by 2002:a63:6806:: with SMTP id d6mr13494041pgc.353.1643068467261; Mon, 24 Jan 2022 15:54:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643068467; cv=none; d=google.com; s=arc-20160816; b=s/IukUv/HMsU53ifJg8r/cFvKnct8InVXC5wkrOVHWTZ5TxvH8thHMuEGfYr/gQUpU gUvQRvzp22DPFOrlNyJ5QHAoQQv2/4uH8gPfF4GKddBsDiis6ZhVJvMgPQj5RP35s0uK t3ItMllfL2WlNg9Uw57/iPufZJQnwZ19fTNqDMhGR0vIsPmpfGQ6wXb8JNAr978xeYLT OZdNdrGYO5Goy4LmwV9h1zXHtiTdI8qrn8nvJl9+lra8AAScCmSCygMfKQs+2sZYBO0T /pM6CLz2GFgwqCorWUiPQIylU7atzxVQcVcL6GkX0W1yqLMe5O6C+zQz2hnGO5JFUbrb BMbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1xnQF9bLGcpqpvgeBQWxaXO0sby0WkycSwLqzj4kn+w=; b=CyJcjLAtob4gMb08rcXm6QdrQ5cuF6eh6Y7DqNXYarfrTGXzWUiLF3Pqadc4PW3H/8 ek1HG6zUHFgkBn2zaf6F3K+pXB4/4CFW4FfMA9SZizA1TurtGEkAPD1lN2Rpp2qKpkIz hV+GyHjr0PUARZTf2TLi+wOHGyXfw6ac6q3Nc4+zo5s2D/kZYS8awiy22z0IDPvt+EYh Neub/yuVuaQOrnPyTukoHnwF6frcS3gnYmm2tbZRycGCLnDSwyDKFMXqDahTHyzFXpAY sgygQR01IqVTyKj5DYk15bjyVnJwjwzXaOkjJ4SAeDG4nUfhFZGciqZTFKQp1UJmTn57 NQhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=Ng7RNB8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nu4si661874pjb.112.2022.01.24.15.54.15; Mon, 24 Jan 2022 15:54:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=Ng7RNB8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2364328AbiAXXrV (ORCPT + 99 others); Mon, 24 Jan 2022 18:47:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356410AbiAXWz7 (ORCPT ); Mon, 24 Jan 2022 17:55:59 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28C87C0680BB for ; Mon, 24 Jan 2022 13:10:05 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id b9so3520446lfq.6 for ; Mon, 24 Jan 2022 13:10:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=1xnQF9bLGcpqpvgeBQWxaXO0sby0WkycSwLqzj4kn+w=; b=Ng7RNB8+owqz2sMnqb+D3YKugbGxUS2d4ZMSn0kKJiuCLTY/mLNqhonMbkCvT6pNgx S/YOAAiZ3S6M7RER960DQBd6IePRtB12JLMvyDgw9mdahFFJtw39naV20if2MpmNfdty ykJax6Ty3jejql0vgStXaZ0v7OQt9AsAXmwQTpjqm+DaWnlGLgzy678Jx4GVmUjIyraB +OOuO+azoZgnKz3dcfra6lXZqv1CYnQMe1vqnYyUVkx63qwr/XOWC+qA3Nh6OfNxQOd2 1yRH3w+IqhQRnN4I1WqY+9if/oFhxhoqzybaP25gLt0Z7iWoNybnkENrFj+BNumSkhOg l5Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=1xnQF9bLGcpqpvgeBQWxaXO0sby0WkycSwLqzj4kn+w=; b=2SHlgpnpdVWSygE/8yiTTNEPSLyy73YsuT8heostyMfW/DM9y1Dg1WV8KiNQQz1KZa +y99EA+lsK4JLkjmRN3zWOo9V0vTVI3MDgHGGb9Wmj6sYWvqmgl9T2VuxAfIFEqNIYwc 3scF5HOw52kMtPgPmNqQmtJza6qhihLuftRdF/ysflt2+IpuOElalESDSahkRFfBwCHs 1vNLT0LT5cc99KGGLeSabk0/6aFSPDB/F0J6dexfE+jHvwkIGACAbMJrg8WxpNM3LacR QeDWUpWK/vGxOwg7KxaqjQ8XvPTqNu/Xy0l5Zyj+jSQr7mLStHNPUwUWarUHVbVoZJWl qfAw== X-Gm-Message-State: AOAM532dGVniipW4f689XJqxKtY7eapccRhbrw6VnUjRPLHK15ptiDhF Y2ssyWJGX4E3QrZWcku7/k2FxQ== X-Received: by 2002:a19:ae05:: with SMTP id f5mr435716lfc.496.1643058603513; Mon, 24 Jan 2022 13:10:03 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id t12sm1009115ljj.118.2022.01.24.13.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 13:10:03 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , linux-kernel@vger.kernel.org Subject: [PATCH net 2/2] net: dsa: Avoid cross-chip syncing of VLAN filtering Date: Mon, 24 Jan 2022 22:09:44 +0100 Message-Id: <20220124210944.3749235-3-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220124210944.3749235-1-tobias@waldekranz.com> References: <20220124210944.3749235-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes to VLAN filtering are not applicable to cross-chip notifications. On a system like this: .-----. .-----. .-----. | sw1 +---+ sw2 +---+ sw3 | '-1-2-' '-1-2-' '-1-2-' Before this change, upon sw1p1 leaving a bridge, a call to dsa_port_vlan_filtering would also be made to sw2p1 and sw3p1. In this scenario: .---------. .-----. .-----. | sw1 +---+ sw2 +---+ sw3 | '-1-2-3-4-' '-1-2-' '-1-2-' When sw1p4 would leave a bridge, dsa_port_vlan_filtering would be called for sw2 and sw3 with a non-existing port - leading to array out-of-bounds accesses and crashes on mv88e6xxx. Fixes: d371b7c92d19 ("net: dsa: Unset vlan_filtering when ports leave the bridge") Signed-off-by: Tobias Waldekranz --- net/dsa/switch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/dsa/switch.c b/net/dsa/switch.c index 9f9b70d6070a..517cc83d13cc 100644 --- a/net/dsa/switch.c +++ b/net/dsa/switch.c @@ -180,9 +180,11 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds, info->sw_index, info->port, info->bridge); - err = dsa_switch_sync_vlan_filtering(ds, info); - if (err) - return err; + if (ds->dst->index == info->tree_index && ds->index == info->sw_index) { + err = dsa_switch_sync_vlan_filtering(ds, info); + if (err) + return err; + } return dsa_tag_8021q_bridge_leave(ds, info); } -- 2.25.1