Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UBUNTU: SAUCE: can: j1939: delay release of j1939_priv after synchron…
…ize_rcu BugLink: https://bugs.launchpad.net/bugs/1932209 (UAF on CAN J1939 j1939_can_recv (LP: #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>
- Loading branch information