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: <20211204232755.bgxo3x2jk6bf3voh@skbuf>
Date:   Sat, 4 Dec 2021 23:27:56 +0000
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Tobias Waldekranz <tobias@...dekranz.com>,
        DENG Qingfang <dqfext@...il.com>,
        Alvin Šipraga <alsi@...g-olufsen.dk>,
        Kurt Kanzenbach <kurt@...utronix.de>,
        Hauke Mehrtens <hauke@...ke-m.de>,
        Woojung Huh <woojung.huh@...rochip.com>,
        "UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
        Sean Wang <sean.wang@...iatek.com>,
        Landen Chao <Landen.Chao@...iatek.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        George McCollister <george.mccollister@...il.com>
Subject: Re: [PATCH v2 net-next 3/7] net: dsa: hide dp->bridge_dev and
 dp->bridge_num behind helpers

On Sat, Dec 04, 2021 at 10:11:42PM +0200, Vladimir Oltean wrote:
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index a818df35b239..c583ece83b24 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -1647,8 +1645,10 @@ static int mv88e6xxx_atu_new(struct mv88e6xxx_chip *chip, u16 *fid)
>  static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
>  					u16 vid)
>  {
> +	struct dsa_port *dp = dsa_to_port(ds, port), *other_dp;
>  	struct mv88e6xxx_chip *chip = ds->priv;
>  	struct mv88e6xxx_vtu_entry vlan;
> +	struct net_device *other_br;
>  	int i, err;
>  
>  	/* DSA and CPU ports have to be members of multiple vlans */
> @@ -1662,27 +1662,30 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
>  	if (!vlan.valid)
>  		return 0;
>  
> -	for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) {
> -		if (dsa_is_dsa_port(ds, i) || dsa_is_cpu_port(ds, i))
> +	list_for_each_entry(other_dp, &ds->dst->ports, list) {
> +		if (other_dp->ds != ds)
>  			continue;
>  
> -		if (!dsa_to_port(ds, i)->slave)
> +		if (dsa_port_is_dsa(other_dp) || dsa_port_is_cpu(other_dp))
> +			continue;
> +
> +		if (!other_dp->slave)
>  			continue;
>  
>  		if (vlan.member[i] ==

Some badly rebased changes from some other patches snuck in and made a
mess out of this. I removed the port iteration using "int i" but did not
remove that variable, and it is also still used.. uninitialized. Will
split the mv88e6xxx conversion to iterate using dp to a separate patch.

>  		    MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER)
>  			continue;
>  
> -		if (dsa_to_port(ds, i)->bridge_dev ==
> -		    dsa_to_port(ds, port)->bridge_dev)
> +		other_br = dsa_port_bridge_dev_get(other_dp);
> +
> +		if (dsa_port_bridge_same(dp, other_dp))
>  			break; /* same bridge, check next VLAN */
>  
> -		if (!dsa_to_port(ds, i)->bridge_dev)
> +		if (!other_br)
>  			continue;
>  
>  		dev_err(ds->dev, "p%d: hw VLAN %d already used by port %d in %s\n",
> -			port, vlan.vid, i,
> -			netdev_name(dsa_to_port(ds, i)->bridge_dev));
> +			port, vlan.vid, i, netdev_name(other_br));
>  		return -EOPNOTSUPP;
>  	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ