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: <20220104111209.2ky2n5gdqaxzf5fh@skbuf>
Date:   Tue, 4 Jan 2022 11:12:10 +0000
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     Horatiu Vultur <horatiu.vultur@...rochip.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "f.fainelli@...il.com" <f.fainelli@...il.com>,
        "vivien.didelot@...il.com" <vivien.didelot@...il.com>,
        "andrew@...n.ch" <andrew@...n.ch>
Subject: Re: [PATCH net-next v2 3/3] net: lan966x: Extend switchdev with mdb
 support

On Tue, Jan 04, 2022 at 11:18:49AM +0100, Horatiu Vultur wrote:
> +static int lan966x_mdb_ip_del(struct lan966x_port *port,
> +			      const struct switchdev_obj_port_mdb *mdb,
> +			      enum macaccess_entry_type type)
> +{
> +	bool cpu_port = netif_is_bridge_master(mdb->obj.orig_dev);
> +	struct lan966x *lan966x = port->lan966x;
> +	struct lan966x_mdb_entry *mdb_entry;
> +	unsigned char mac[ETH_ALEN];
> +
> +	mdb_entry = lan966x_mdb_entry_get(lan966x, mdb->addr, mdb->vid);
> +	if (!mdb_entry)
> +		return -ENOENT;
> +
> +	lan966x_mdb_encode_mac(mac, mdb_entry, type);
> +	lan966x_mac_forget(lan966x, mac, mdb_entry->vid, type);
> +
> +	if (cpu_port)
> +		mdb_entry->cpu_copy--;

Can you code this in such a way that you don't forget and then re-learn
the entry if you only do a cpu_copy-- which doesn't reach zero?

> +	else
> +		mdb_entry->ports &= ~BIT(port->chip_port);
> +
> +	if (!mdb_entry->ports && !mdb_entry->cpu_copy) {
> +		list_del(&mdb_entry->list);
> +		kfree(mdb_entry);
> +		return 0;
> +	}
> +
> +	lan966x_mdb_encode_mac(mac, mdb_entry, type);
> +	return lan966x_mac_ip_learn(lan966x, mdb_entry->cpu_copy,
> +				    mac, mdb_entry->vid, type);
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ