lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <630eb889-743c-c455-786e-ce2e58174ea9@nvidia.com>
Date:   Wed, 16 Feb 2022 13:00:27 +0200
From:   Nikolay Aleksandrov <nikolay@...dia.com>
To:     Vladimir Oltean <vladimir.oltean@....com>, <netdev@...r.kernel.org>
CC:     Jakub Kicinski <kuba@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        Roopa Prabhu <roopa@...dia.com>, Jiri Pirko <jiri@...dia.com>,
        Ido Schimmel <idosch@...dia.com>,
        Rafael Richter <rafael.richter@....de>,
        Daniel Klauer <daniel.klauer@....de>,
        "Tobias Waldekranz" <tobias@...dekranz.com>
Subject: Re: [PATCH v3 net-next 02/11] net: bridge: vlan: don't notify to
 switchdev master VLANs without BRENTRY flag

On 15/02/2022 19:02, Vladimir Oltean wrote:
> When a VLAN is added to a bridge port and it doesn't exist on the bridge
> device yet, it gets created for the multicast context, but it is
> 'hidden', since it doesn't have the BRENTRY flag yet:
> 
> ip link add br0 type bridge && ip link set swp0 master br0
> bridge vlan add dev swp0 vid 100 # the master VLAN 100 gets created
> bridge vlan add dev br0 vid 100 self # that VLAN becomes brentry just now
> 
> All switchdev drivers ignore switchdev notifiers for VLAN entries which
> have the BRENTRY unset, and for good reason: these are merely private
> data structures used by the bridge driver. So we might just as well not
> notify those at all.
> 
> Cleanup in the switchdev drivers that check for the BRENTRY flag is now
> possible, and will be handled separately, since those checks just became
> dead code.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> ---
> v2->v3: patch is new
> 
>  net/bridge/br_vlan.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index efefeaf1a26e..498cc297b492 100644
> --- a/net/bridge/br_vlan.c
> +++ b/net/bridge/br_vlan.c
> @@ -284,9 +284,12 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags,
>  		}
>  		br_multicast_port_ctx_init(p, v, &v->port_mcast_ctx);
>  	} else {
> -		err = br_switchdev_port_vlan_add(dev, v->vid, flags, extack);
> -		if (err && err != -EOPNOTSUPP)
> -			goto out;
> +		if (br_vlan_should_use(v)) {
> +			err = br_switchdev_port_vlan_add(dev, v->vid, flags,
> +							 extack);
> +			if (err && err != -EOPNOTSUPP)
> +				goto out;
> +		}
>  		br_multicast_ctx_init(br, v, &v->br_mcast_ctx);
>  		v->priv_flags |= BR_VLFLAG_GLOBAL_MCAST_ENABLED;
>  	}

At some point we should just pass the vlan struct to the switchdev handlers
and push all the switchdev-specific checks in there. It would require some
care w.r.t kconfig options, but it should be cleaner.
The patch looks good.

Acked-by: Nikolay Aleksandrov <nikolay@...dia.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ