can: j1939: make j1939_session_activate() fail if device is no longer registered
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 9d71dd0c70099914fcd063135da3c580865e924c · < 79dd3f1d9dd310c2af89b09c71f34d93973b200f| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
can: j1939: make j1939_session_activate() fail if device is no longer registered
syzbot is still reporting
unregister_netdevice: waiting for vcan0 to become free. Usage count = 2
even after commit 93a27b5891b8 ("can: j1939: add missing calls in NETDEV_UNREGISTER notification handler") was added. A debug printk() patch found that j1939_session_activate() can succeed even after j1939_cancel_active_session() from j1939_netdev_notify(NETDEV_UNREGISTER) has completed.
Since j1939_cancel_active_session() is processed with the session list lock held, checking ndev->reg_state in j1939_session_activate() with the session list lock held can reliably close the race window.
From the CVE record · Linux
A race in the Linux kernel's CAN J1939 code can let a session activate after device-unregistration cleanup has completed. This can leave the device's usage count nonzero and cause unregister_netdevice to wait for the device to become free. The input does not establish an attacker path or authentication and interaction requirements.
Engineers running Linux kernels with CAN J1939 support should check their versions; affected versions are not specified.