]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
UBUNTU: SAUCE: can: j1939: delay release of j1939_priv after synchronize_rcu
authorThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 11 Jun 2021 19:14:08 +0000 (16:14 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Wed, 16 Jun 2021 22:48:44 +0000 (19:48 -0300)
commit0849e2d072d2c5d1f0d6c35ecb98faf092adde09
tree415c122049fa4ffa8dd186d175fb9f8ea029719c
parent5499bae10fe4f7f5c33ed14d7a6a6d8953ec15e6
UBUNTU: SAUCE: can: j1939: delay release of j1939_priv after synchronize_rcu

BugLink: https://bugs.launchpad.net/bugs/1932209
can_rx_register callbacks may be called concurrently to the call to
can_rx_unregister. The callbacks and callback data, though, are protected
by RCU.

As those can_rx_register callbacks are called under RCU protection, so
after calling can_rx_unregister, we may call synchronize_rcu in order to
wait for any RCU read-side critical sections to finish. That is, RX
handlers won't be called anymore for that data. So, we only free them,
after we do that synchronize_rcu.

In the case of j1939, we should not call synchronize_rcu while holding
j1939_netdev_lock, so we defer j1939_priv_put to after we have unlocked it.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Benjamin M Romer <benjamin.romer@canonical.com>
Acked-by: Ian May <ian.may@canonical.com>
net/can/j1939/main.c