mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-22 02:20:40 +00:00
net: dsa: avoid refcount warnings when ->port_{fdb,mdb}_del returns error
[ Upstream commit232deb3f95
] 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:161ca59d39
("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
69abfe39c7
commit
348273847a
1 changed files with 2 additions and 2 deletions
|
@ -264,7 +264,7 @@ static int dsa_switch_do_mdb_del(struct dsa_switch *ds, int port,
|
|||
|
||||
err = ds->ops->port_mdb_del(ds, port, mdb);
|
||||
if (err) {
|
||||
refcount_inc(&a->refcount);
|
||||
refcount_set(&a->refcount, 1);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ static int dsa_switch_do_fdb_del(struct dsa_switch *ds, int port,
|
|||
|
||||
err = ds->ops->port_fdb_del(ds, port, addr, vid);
|
||||
if (err) {
|
||||
refcount_inc(&a->refcount);
|
||||
refcount_set(&a->refcount, 1);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue