syzbot


WARNING: refcount bug in qrtr_node_lookup

Status: fixed on 2023/04/17 07:57
Reported-by: syzbot+d4c3e0920771e38a6831@syzkaller.appspotmail.com
Fix commit: b9ba5906c420 net: qrtr: Fix a refcount bug in qrtr_recvmsg()
First crash: 396d, last: 396d
Fix bisection: fixed by (bisect log) :
commit b9ba5906c42089f8e1d0001b7b50a7940f086cbb
Author: Ziyang Xuan <william.xuanziyang@huawei.com>
Date: Thu Mar 30 01:25:32 2023 +0000

  net: qrtr: Fix a refcount bug in qrtr_recvmsg()

  
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING: refcount bug in qrtr_node_lookup (2) arm-msm net C 1 396d 389d 0/26 auto-obsoleted due to no activity on 2023/07/14 08:21
linux-6.1 WARNING: refcount bug in qrtr_node_lookup C done 1 395d 395d 3/3 fixed on 2023/04/17 07:57
upstream WARNING: refcount bug in qrtr_node_lookup arm-msm net C done done 16 991d 1315d 0/26 auto-obsoleted due to no activity on 2022/09/28 21:58

Sample crash report:
------------[ cut here ]------------
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 0 PID: 136 at lib/refcount.c:25 refcount_warn_saturate+0x1a8/0x20c lib/refcount.c:25
Modules linked in:
CPU: 0 PID: 136 Comm: kworker/u4:1 Not tainted 5.15.102-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Workqueue: qrtr_ns_handler qrtr_ns_worker
pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : refcount_warn_saturate+0x1a8/0x20c lib/refcount.c:25
lr : refcount_warn_saturate+0x1a8/0x20c lib/refcount.c:25
sp : ffff800018e66e40
x29: ffff800018e66e40 x28: dfff800000000000 x27: ffff7000031ccddc
x26: ffff800018e66f00 x25: 0000000000000000 x24: 00000000003a6056
x23: ffff0000cc2ff670 x22: 0000000000000000 x21: 0000000000000002
x20: ffff0000ce43e098 x19: ffff800016dd0000 x18: 0000000000000002
x17: ff808000083386a0 x16: ffff800011a080c4 x15: ffff8000083386a0
x14: 00000000ffffffff x13: ffffffffffffffff x12: 0000000000000000
x11: ff80800008330148 x10: 0000000000000000 x9 : 88691575a4efc200
x8 : 88691575a4efc200 x7 : 0000000000000001 x6 : 0000000000000001
x5 : ffff800018e665b8 x4 : ffff800014aa0700 x3 : ffff8000085518f8
x2 : 0000000000000001 x1 : 0000000100000001 x0 : 000000000000002a
Call trace:
 refcount_warn_saturate+0x1a8/0x20c lib/refcount.c:25
 __refcount_inc include/linux/refcount.h:250 [inline]
 refcount_inc include/linux/refcount.h:267 [inline]
 kref_get include/linux/kref.h:45 [inline]
 qrtr_node_acquire net/qrtr/qrtr.c:202 [inline]
 qrtr_node_lookup+0xe0/0x110 net/qrtr/qrtr.c:398
 qrtr_send_resume_tx net/qrtr/qrtr.c:1003 [inline]
 qrtr_recvmsg+0x3e0/0x958 net/qrtr/qrtr.c:1071
 sock_recvmsg_nosec net/socket.c:947 [inline]
 sock_recvmsg net/socket.c:965 [inline]
 kernel_recvmsg+0x128/0x154 net/socket.c:990
 qrtr_ns_worker+0x25c/0x4fb8 net/qrtr/ns.c:687
 process_one_work+0x84c/0x14b8 kernel/workqueue.c:2306
 worker_thread+0x910/0x1034 kernel/workqueue.c:2453
 kthread+0x37c/0x45c kernel/kthread.c:319
 ret_from_fork+0x10/0x20 <unknown>:870
irq event stamp: 142944
hardirqs last  enabled at (142943): [<ffff800011adb7e0>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
hardirqs last  enabled at (142943): [<ffff800011adb7e0>] _raw_spin_unlock_irqrestore+0xac/0x158 kernel/locking/spinlock.c:194
hardirqs last disabled at (142944): [<ffff800011adb2bc>] __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline]
hardirqs last disabled at (142944): [<ffff800011adb2bc>] _raw_spin_lock_irqsave+0xfc/0x14c kernel/locking/spinlock.c:162
softirqs last  enabled at (142940): [<ffff80000fdc01a0>] spin_unlock_bh include/linux/spinlock.h:408 [inline]
softirqs last  enabled at (142940): [<ffff80000fdc01a0>] lock_sock_nested+0x160/0x1ec net/core/sock.c:3223
softirqs last disabled at (142938): [<ffff80000fdc0148>] spin_lock_bh include/linux/spinlock.h:368 [inline]
softirqs last disabled at (142938): [<ffff80000fdc0148>] lock_sock_nested+0x108/0x1ec net/core/sock.c:3219
---[ end trace c5272773e48d5854 ]---

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/03/16 13:48 linux-5.15.y 2ddbd0f967b3 18b58603 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 WARNING: refcount bug in qrtr_node_lookup
* Struck through repros no longer work on HEAD.