Skip to content

Commit 21a88f5

Browse files
author
Paolo Abeni
committed
Merge tag 'linux-can-fixes-for-6.19-20251218' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== pull-request: can 2025-12-18 this is a pull request of 3 patches for net/main. Tetsuo Handa contributes 2 patches to fix race windows in the j1939 protocol to properly handle disappearing network devices. The last patch is by me, it fixes a build dependency with the CAN drivers, that got introduced while fixing a dependency between the CAN protocol and CAN device code. linux-can-fixes-for-6.19-20251218 * tag 'linux-can-fixes-for-6.19-20251218' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can: can: fix build dependency can: j1939: make j1939_sk_bind() fail if device is no longer registered can: j1939: make j1939_session_activate() fail if device is no longer registered ==================== Link: https://patch.msgid.link/20251218123132.664533-1-mkl@pengutronix.de Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2 parents 373a34a + 5a5aff6 commit 21a88f5

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

drivers/net/can/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ menuconfig CAN_DEV
1717
virtual ones. If you own such devices or plan to use the virtual CAN
1818
interfaces to develop applications, say Y here.
1919

20-
if CAN_DEV
20+
if CAN_DEV && CAN
2121

2222
config CAN_VCAN
2323
tristate "Virtual Local CAN Interface (vcan)"

net/can/j1939/socket.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr_unsized *uaddr, in
482482
goto out_release_sock;
483483
}
484484

485+
if (ndev->reg_state != NETREG_REGISTERED) {
486+
dev_put(ndev);
487+
ret = -ENODEV;
488+
goto out_release_sock;
489+
}
490+
485491
can_ml = can_get_ml_priv(ndev);
486492
if (!can_ml) {
487493
dev_put(ndev);

net/can/j1939/transport.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,8 @@ int j1939_session_activate(struct j1939_session *session)
15671567
if (active) {
15681568
j1939_session_put(active);
15691569
ret = -EAGAIN;
1570+
} else if (priv->ndev->reg_state != NETREG_REGISTERED) {
1571+
ret = -ENODEV;
15701572
} else {
15711573
WARN_ON_ONCE(session->state != J1939_SESSION_NEW);
15721574
list_add_tail(&session->active_session_list_entry,

0 commit comments

Comments
 (0)