linux/net/can
Tetsuo Handa c3a4316e3c can: j1939: make j1939_session_activate() fail if device is no longer registered
[ Upstream commit 5d5602236f ]

syzbot is still reporting

  unregister_netdevice: waiting for vcan0 to become free. Usage count = 2

even after commit 93a27b5891 ("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.

Reported-by: syzbot <syzbot+881d65229ca4f9ae8c84@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=881d65229ca4f9ae8c84
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/b9653191-d479-4c8b-8536-1326d028db5c@I-love.SAKURA.ne.jp
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-01-19 13:10:19 +01:00
..
j1939 can: j1939: make j1939_session_activate() fail if device is no longer registered 2026-01-19 13:10:19 +01:00
af_can.c can: statistics: use atomic access in hot path 2025-04-10 14:32:03 +02:00
af_can.h can: statistics: use atomic access in hot path 2025-04-10 14:32:03 +02:00
bcm.c can: bcm: add missing rcu read protection for procfs content 2025-06-04 14:38:06 +02:00
gw.c can: gw: fix RCU/BH usage in cgw_create_job() 2025-05-18 08:20:35 +02:00
isotp.c can: isotp: isotp_sendmsg(): fix TX state detection and wait behavior 2023-11-08 17:26:49 +01:00
Kconfig net: remove redundant 'depends on NET' 2021-01-27 17:04:12 -08:00
Makefile can: add ISO 15765-2:2016 transport protocol 2020-10-07 23:18:33 +02:00
proc.c can: statistics: use atomic access in hot path 2025-04-10 14:32:03 +02:00
raw.c can: raw: add support for SO_MARK 2024-01-15 18:51:14 +01:00