can: gw: synchronize rcu operations before removing gw job entry
authorOliver Hartkopp <socketcan@hartkopp.net>
Fri, 18 Jun 2021 17:36:45 +0000 (19:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:55:41 +0000 (16:55 +0200)
commitaf94ef8f0b08e3584fcf4fe2af30551402312c66
tree6fe65c2c2de5a5ded6b324a4257f02e5428e6a45
parentb52e0cf0bfc1ede495de36aec86f6013efa18f60
can: gw: synchronize rcu operations before removing gw job entry

commit fb8696ab14adadb2e3f6c17c18ed26b3ecd96691 upstream.

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/20210618173645.2238-1-socketcan@hartkopp.net
Fixes: c1aabdf379bc ("can-gw: add netlink based CAN routing")
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/can/gw.c