Skip to content

Commit ac2a7b1

Browse files
committed
Merge tag 'linux-can-fixes-for-6.5-20230724' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== pull-request: can 2023-07-24 The first patch is by me and adds a missing set of CAN state to CAN_STATE_STOPPED on close in the gs_usb driver. The last patch is by Eric Dumazet and fixes a lockdep issue in the CAN raw protocol. * tag 'linux-can-fixes-for-6.5-20230724' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can: can: raw: fix lockdep issue in raw_release() can: gs_usb: gs_can_close(): add missing set of CAN state to CAN_STATE_STOPPED ==================== Link: https://lore.kernel.org/r/20230724150141.766047-1-mkl@pengutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents a333605 + 11c9027 commit ac2a7b1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

drivers/net/can/usb/gs_usb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,8 @@ static int gs_can_close(struct net_device *netdev)
10301030
usb_kill_anchored_urbs(&dev->tx_submitted);
10311031
atomic_set(&dev->active_tx_urbs, 0);
10321032

1033+
dev->can.state = CAN_STATE_STOPPED;
1034+
10331035
/* reset the device */
10341036
rc = gs_cmd_reset(dev);
10351037
if (rc < 0)

net/can/raw.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,9 @@ static int raw_release(struct socket *sock)
386386
list_del(&ro->notifier);
387387
spin_unlock(&raw_notifier_lock);
388388

389+
rtnl_lock();
389390
lock_sock(sk);
390391

391-
rtnl_lock();
392392
/* remove current filters & unregister */
393393
if (ro->bound) {
394394
if (ro->dev)
@@ -405,12 +405,13 @@ static int raw_release(struct socket *sock)
405405
ro->dev = NULL;
406406
ro->count = 0;
407407
free_percpu(ro->uniq);
408-
rtnl_unlock();
409408

410409
sock_orphan(sk);
411410
sock->sk = NULL;
412411

413412
release_sock(sk);
413+
rtnl_unlock();
414+
414415
sock_put(sk);
415416

416417
return 0;

0 commit comments

Comments
 (0)