mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-02 23:54:33 +01:00
can: gw: synchronize rcu operations before removing gw job entry
can_can_gw_rcv() is called under RCU protection, so after calling
can_rx_unregister(), we have to call synchronize_rcu in order to wait
for any RCU read-side critical sections to finish before removing the
kmem_cache entry with the referenced gw job entry.
Link: https://lore.kernel.org/r/[email protected]
Fixes: c1aabdf379 ("can-gw: add netlink based CAN routing")
Cc: linux-stable <[email protected]>
Signed-off-by: Oliver Hartkopp <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
This commit is contained in:
1 parent
d5f9023fa6
commit
fb8696ab14
1 file changed
+3
@@ -596,6 +596,7 @@ static int cgw_notifier(struct notifier_block *nb,
|
||||
if (gwj->src.dev == dev || gwj->dst.dev == dev) {
|
||||
hlist_del(&gwj->list);
|
||||
cgw_unregister_filter(net, gwj);
|
||||
synchronize_rcu();
|
||||
kmem_cache_free(cgw_cache, gwj);
|
||||
}
|
||||
}
|
||||
@@ -1154,6 +1155,7 @@ static void cgw_remove_all_jobs(struct net *net)
|
||||
hlist_for_each_entry_safe(gwj, nx, &net->can.cgw_list, list) {
|
||||
hlist_del(&gwj->list);
|
||||
cgw_unregister_filter(net, gwj);
|
||||
synchronize_rcu();
|
||||
kmem_cache_free(cgw_cache, gwj);
|
||||
}
|
||||
}
|
||||
@@ -1222,6 +1224,7 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
|
||||
hlist_del(&gwj->list);
|
||||
cgw_unregister_filter(net, gwj);
|
||||
synchronize_rcu();
|
||||
kmem_cache_free(cgw_cache, gwj);
|
||||
err = 0;
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user