]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: avoid refcount warnings when ->port_{fdb,mdb}_del returns error
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sun, 24 Oct 2021 17:17:48 +0000 (20:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Oct 2021 11:59:41 +0000 (12:59 +0100)
commitdb22749cc5e6df92f6a08d414941b8e6e48af29e
treec0e92ee7f9edaa195d463d29201d0fbec5833275
parent149be156d13e00678faba6ddd250c26372dd48bf
net: dsa: avoid refcount warnings when ->port_{fdb,mdb}_del returns error

At present, when either of ds->ops->port_fdb_del() or ds->ops->port_mdb_del()
return a non-zero error code, we attempt to save the day and keep the
data structure associated with that switchdev object, as the deletion
procedure did not complete.

However, the way in which we do this is suspicious to the checker in
lib/refcount.c, who thinks it is buggy to increment a refcount that
became zero, and that this is indicative of a use-after-free.

Fixes: 3f80696f38ab ("net: dsa: reference count the MDB entries at the cross-chip notifier level")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/switch.c