All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Jonas Gorski <jonas.gorski@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH RFC/RFT net-next v2 1/5] net: dsa: deny bridge VLAN with existing 8021q upper on any port
Date: Mon, 1 Dec 2025 14:47:59 +0000	[thread overview]
Message-ID: <aS2qnzL2WC-sFlnJ@horms.kernel.org> (raw)
In-Reply-To: <20251201102817.301552-2-jonas.gorski@gmail.com>

On Mon, Dec 01, 2025 at 11:28:13AM +0100, Jonas Gorski wrote:

...

> diff --git a/net/dsa/user.c b/net/dsa/user.c
> index f59d66f0975d..fa1fe0f1493a 100644
> --- a/net/dsa/user.c
> +++ b/net/dsa/user.c
> @@ -653,21 +653,30 @@ static int dsa_user_port_attr_set(struct net_device *dev, const void *ctx,
>  
>  /* Must be called under rcu_read_lock() */
>  static int
> -dsa_user_vlan_check_for_8021q_uppers(struct net_device *user,
> +dsa_user_vlan_check_for_8021q_uppers(struct dsa_port *dp,
>  				     const struct switchdev_obj_port_vlan *vlan)
>  {
> -	struct net_device *upper_dev;
> -	struct list_head *iter;
> +	struct dsa_switch *ds = dp->ds;
> +	struct dsa_port *other_dp;
>  
> -	netdev_for_each_upper_dev_rcu(user, upper_dev, iter) {
> -		u16 vid;
> +	dsa_switch_for_each_user_port(other_dp, ds) {
> +		struct net_device *user = other_dp->user;

Hi Jonas,

The AI robot is concerned that user may be NULL here.
And I can't convince myself that cannot be the case.

Could you take a look?

https://netdev-ai.bots.linux.dev/ai-review.html?id=3d47057e-e740-4b66-9d60-9ec2a7ee92a1#patch-0

> +		struct net_device *upper_dev;
> +		struct list_head *iter;
>  
> -		if (!is_vlan_dev(upper_dev))
> +		if (!dsa_port_bridge_same(dp, other_dp))
>  			continue;
>  
> -		vid = vlan_dev_vlan_id(upper_dev);
> -		if (vid == vlan->vid)
> -			return -EBUSY;
> +		netdev_for_each_upper_dev_rcu(user, upper_dev, iter) {
> +			u16 vid;
> +
> +			if (!is_vlan_dev(upper_dev))
> +				continue;
> +
> +			vid = vlan_dev_vlan_id(upper_dev);
> +			if (vid == vlan->vid)
> +				return -EBUSY;
> +		}
>  	}
>  
>  	return 0;

...

  reply	other threads:[~2025-12-01 14:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 10:28 [PATCH RFC/RFT net-next v2 0/5] net: dsa: deny unsupported 8021q upper on bridge port configurations Jonas Gorski
2025-12-01 10:28 ` [PATCH RFC/RFT net-next v2 1/5] net: dsa: deny bridge VLAN with existing 8021q upper on any port Jonas Gorski
2025-12-01 14:47   ` Simon Horman [this message]
2025-12-01 19:52     ` Jonas Gorski
2025-12-01 22:48       ` Chris Mason
2025-12-02 16:16         ` Simon Horman
2025-12-03  0:36           ` Chris Mason
2025-12-01 10:28 ` [PATCH RFC/RFT net-next v2 2/5] net: dsa: deny multiple 8021q uppers on bridged ports for the same VLAN Jonas Gorski
2025-12-01 10:28 ` [PATCH RFC/RFT net-next v2 3/5] selftests: no_forwarding: test VLAN uppers on VLAN aware bridged ports Jonas Gorski
2025-12-01 14:19   ` Simon Horman
2025-12-01 19:46     ` Jonas Gorski
2025-12-01 10:28 ` [PATCH RFC/RFT net-next v2 4/5] net: dsa: deny 8021q uppers on vlan unaware " Jonas Gorski
2025-12-01 10:28 ` [PATCH RFC/RFT net-next v2 5/5] selftests: no_forwarding: test VLAN uppers on VLAN-unaware " Jonas Gorski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aS2qnzL2WC-sFlnJ@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.