[syzbot] possible deadlock in j1939_sk_errqueue

Started by syzbot on Oct 8, 2021 · 2 messages from 1 author · Last reply Jun 14, 2022

open the first message on its own page

Message details and related content
Hello,

syzbot found the following issue on:

HEAD commit:    7cd8b1542a7b ptp_pch: Load module automatically if ID matc..
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=12ebf7df300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9290a409049988d4
dashboard link: https://syzkaller.appspot.com/bug?extid=ee1cd780f69483a8616b
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: <redacted>

vcan0: j1939_tp_rxtimer: 0xffff8881480fd400: rx timeout, send abort
======================================================
WARNING: possible circular locking dependency detected
5.15.0-rc3-syzkaller #0 Not tainted
------------------------------------------------------
kworker/u4:6/9270 is trying to acquire lock:
ffff8880909c90d0 (&priv->j1939_socks_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:368 [inline]
ffff8880909c90d0 (&priv->j1939_socks_lock){+.-.}-{2:2}, at: j1939_sk_errqueue+0x9f/0x1a0 net/can/j1939/socket.c:1078

but task is already holding lock:
ffff8880909c9088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:368 [inline]
ffff8880909c9088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: j1939_session_list_lock net/can/j1939/transport.c:238 [inline]
ffff8880909c9088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: j1939_tp_rxtimer+0x1c0/0x36b net/can/j1939/transport.c:1243

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&priv->active_session_list_lock){+.-.}-{2:2}:
       __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
       _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:178
       spin_lock_bh include/linux/spinlock.h:368 [inline]
       j1939_session_list_lock net/can/j1939/transport.c:238 [inline]

188 more lines

Message details and related content
syzbot has found a reproducer for the following issue on:

HEAD commit:    24625f7d91fb Merge tag 'for-linus' of git://git.kernel.org..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1391e2d7f00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=70e1a4d352a3c6ae
dashboard link: https://syzkaller.appspot.com/bug?extid=ee1cd780f69483a8616b
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=163611bff00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=157d01e7f00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: <redacted>

vcan0: j1939_tp_rxtimer: 0xffff88814717a000: rx timeout, send abort
vcan0: j1939_tp_rxtimer: 0xffff88807b7b3800: rx timeout, send abort
======================================================
WARNING: possible circular locking dependency detected
5.19.0-rc2-syzkaller-00049-g24625f7d91fb #0 Not tainted
------------------------------------------------------
swapper/0/0 is trying to acquire lock:
ffff8880777290d0 (&priv->j1939_socks_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:354 [inline]
ffff8880777290d0 (&priv->j1939_socks_lock){+.-.}-{2:2}, at: j1939_sk_errqueue+0x9f/0x1a0 net/can/j1939/socket.c:1078

but task is already holding lock:
ffff888077729088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:354 [inline]
ffff888077729088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: j1939_session_list_lock net/can/j1939/transport.c:238 [inline]
ffff888077729088 (&priv->active_session_list_lock){+.-.}-{2:2}, at: j1939_tp_rxtimer+0xe5/0x220 net/can/j1939/transport.c:1240

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&priv->active_session_list_lock){+.-.}-{2:2}:
       __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
       _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:178
       spin_lock_bh include/linux/spinlock.h:354 [inline]
       j1939_session_list_lock net/can/j1939/transport.c:238 [inline]
       j1939_session_activate+0x43/0x4b0 net/can/j1939/transport.c:1553

198 more lines

Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help