Skip to content

Commit 93a27b5

Browse files
Tetsuo Handamarckleinebudde
authored andcommitted
can: j1939: add missing calls in NETDEV_UNREGISTER notification handler
Currently NETDEV_UNREGISTER event handler is not calling j1939_cancel_active_session() and j1939_sk_queue_drop_all(). This will result in these calls being skipped when j1939_sk_release() is called. And I guess that the reason syzbot is still reporting unregister_netdevice: waiting for vcan0 to become free. Usage count = 2 is caused by lack of these calls. Calling j1939_cancel_active_session(priv, sk) from j1939_sk_release() can be covered by calling j1939_cancel_active_session(priv, NULL) from j1939_netdev_notify(). Calling j1939_sk_queue_drop_all() from j1939_sk_release() can be covered by calling j1939_sk_netdev_event_netdown() from j1939_netdev_notify(). Therefore, we can reuse j1939_cancel_active_session(priv, NULL) and j1939_sk_netdev_event_netdown(priv) for NETDEV_UNREGISTER event handler. Fixes: 7fcbe5b ("can: j1939: implement NETDEV_UNREGISTER notification handler") Signed-off-by: Tetsuo Handa <[email protected]> Tested-by: Oleksij Rempel <[email protected]> Acked-by: Oleksij Rempel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent a3c35f8 commit 93a27b5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/can/j1939/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ static int j1939_netdev_notify(struct notifier_block *nb,
378378
j1939_ecu_unmap_all(priv);
379379
break;
380380
case NETDEV_UNREGISTER:
381+
j1939_cancel_active_session(priv, NULL);
382+
j1939_sk_netdev_event_netdown(priv);
381383
j1939_sk_netdev_event_unregister(priv);
382384
break;
383385
}

0 commit comments

Comments
 (0)