Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1083740pxk; Fri, 25 Sep 2020 05:57:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4eDsnCvy+GJZNbaBkEZzqtJM6mRxRjjDBIIGNFmWp2gx+uQrcqCBfRRs9XsFkG5hWkqIM X-Received: by 2002:a05:6402:2c3:: with SMTP id b3mr1143822edx.213.1601038678571; Fri, 25 Sep 2020 05:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601038678; cv=none; d=google.com; s=arc-20160816; b=LiO0ISA725OXfYlnaFljpTyfkoqkYKlFG/920K31x8RKefTZYg5UzPHTw9JnQhriND qiHZzPOTQ8L1ndSER4QmqEn35yReFCPZm75Df53RbUvA7u7D66vCHLeq/ABdVQ2Q+xet wDRWAMCnJg1E2g2fBoUsCinqHCW6nK5+MIVdGeJTzflfPruKAERmkX+XZHuFS+sNz45U f5RgMATPBHJV5pWo/2+7WaDnbhkpOebOQNjT5WH52Tp/SmsI53hGSNezqoPKdqZZkxXP 0qVBzaNBrX9PjRLsB2rCsdUoD9vqH435h/E2DDjaJBLiPMrl/o1Z5GfcoE7tcYPc4kxE +MwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gdjort5jZxTEdD/v5OT9X2zWC8J/P5TaJ9umN+85/uY=; b=lrovW6d1k99jabWP3jjF5/ZZYFODZ6ZoXMcPEeQCx7K7SfyPJCdUI8Ab39wrTa/bzq bdWsqjUrNSLSU3zBxzwwa4l+6vgoswJUwIgGOA4w0A2nq1qW5Vi20g0cvydS4pbqB/+S P6/r/0zc/f739mSQuX5xGwrcVVIfNeBmDAjSeTKXRZmVmxJRYaCADmbonbw6pLeJyakY PA8EV3qwO5KDRKVzZ9Y7my+pD/HsLOHclVrMKuHC8F3xaFU55QnL5vY+L7cqyycsDhAm gOGKQdHC7OPqZvRyjJE5I6720+AYG9CMGRPtcU7/lHBZm7Aq5DIizi9VtfsFRAiBtdhT Te7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="WsFM/1J5"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si1720768eja.581.2020.09.25.05.57.34; Fri, 25 Sep 2020 05:57:58 -0700 (PDT) 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=@kernel.org header.s=default header.b="WsFM/1J5"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729660AbgIYMze (ORCPT + 99 others); Fri, 25 Sep 2020 08:55:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:34142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729616AbgIYMy6 (ORCPT ); Fri, 25 Sep 2020 08:54:58 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 91ACF206DB; Fri, 25 Sep 2020 12:54:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038498; bh=3CxEedJgFMUT9aAxvc8DjPu3Fk3FQFyN00bflofktYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WsFM/1J5A2HVt7UxNrN8aYofgVULSKjisF7c+oCNKaXloCsR1WXuXGC0TETREi+br lF9Iwu/87WM91p7uzEJw5ISXBEC+W4XILrYDoUBU3QFx4702/hiLjuUI+ZeJyrIjMp JvHR5NyR1N5+IdYTZNOWV1gcf5yKNJ6ZWZJjtxjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Linus Walleij , Jakub Kicinski Subject: [PATCH 4.19 11/37] net: dsa: rtl8366: Properly clear member config Date: Fri, 25 Sep 2020 14:48:39 +0200 Message-Id: <20200925124722.639625577@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200925124720.972208530@linuxfoundation.org> References: <20200925124720.972208530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij [ Upstream commit 4ddcaf1ebb5e4e99240f29d531ee69d4244fe416 ] When removing a port from a VLAN we are just erasing the member config for the VLAN, which is wrong: other ports can be using it. Just mask off the port and only zero out the rest of the member config once ports using of the VLAN are removed from it. Reported-by: Florian Fainelli Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Signed-off-by: Linus Walleij Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/rtl8366.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -452,13 +452,19 @@ int rtl8366_vlan_del(struct dsa_switch * return ret; if (vid == vlanmc.vid) { - /* clear VLAN member configurations */ - vlanmc.vid = 0; - vlanmc.priority = 0; - vlanmc.member = 0; - vlanmc.untag = 0; - vlanmc.fid = 0; - + /* Remove this port from the VLAN */ + vlanmc.member &= ~BIT(port); + vlanmc.untag &= ~BIT(port); + /* + * If no ports are members of this VLAN + * anymore then clear the whole member + * config so it can be reused. + */ + if (!vlanmc.member && vlanmc.untag) { + vlanmc.vid = 0; + vlanmc.priority = 0; + vlanmc.fid = 0; + } ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); if (ret) { dev_err(smi->dev,