Thread (11 messages) flat view 11 messages, 2 authors, 2021-10-22

Re: [PATCH v2 net-next 4/9] net: dsa: b53: serialize access to the ARL table

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2021-10-22 16:32:56

On 10/22/21 7:16 AM, Vladimir Oltean wrote:
The b53 driver performs non-atomic transactions to the ARL table when
adding, deleting and reading FDB and MDB entries.

Traditionally these were all serialized by the rtnl_lock(), but now it
is possible that DSA calls ->port_fdb_add and ->port_fdb_del without
holding that lock.

So the driver must have its own serialization logic. Add a mutex and
hold it from all entry points (->port_fdb_{add,del,dump},
->port_mdb_{add,del}).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Only if you need to spin a v2, small nit below:

[snip]
+		if (ret) {
+			mutex_unlock(&priv->arl_mutex);
 			return ret;
I would be tempted to create an out label and have all of those tests
goto that label in case of error, just so there is a single place where
we unlock the arl_mutex.

Thanks!
--
Florian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help