syzbot
WARNING: refcount bug in i2c_get_adapter (2)
Status:
upstream: reported on 2026/04/22 20:31
Subsystems:
i2c
Labels:
prio:high
[Documentation on labels]
Reported-by: syzbot+c0291c8c9aaa473c7721@syzkaller.appspotmail.com
First crash: 129d, last: 42d
Sample crash report:
------------[ cut here ]-[ 279.907398][ T7792] ------------[ cut here ]------------
refcount_t: addition on 0; use-after-free.
WARNING: lib/refcount.c:25 at refcount_warn_saturate+0x9f/0x110 lib/refcount.c:25, CPU#1: syz.4.527/7792
Modules linked in:
CPU: 1 UID: 0 PID: 7792 Comm: syz.4.527 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
RIP: 0010:refcount_warn_saturate+0x9f/0x110 lib/refcount.c:25
Code: eb 66 85 db 74 3e 83 fb 01 75 4c e8 6b 61 24 fd 48 8d 3d 54 7a d2 0a 67 48 0f b9 3a eb 4a e8 58 61 24 fd 48 8d 3d 51 7a d2 0a <67> 48 0f b9 3a eb 37 e8 45 61 24 fd 48 8d 3d 4e 7a d2 0a 67 48 0f
RSP: 0000:ffffc90002f3f6d8 EFLAGS: 00010283
RAX: ffffffff849fa648 RBX: 0000000000000002 RCX: 0000000000080000
RDX: ffffc9000eb72000 RSI: 0000000000000744 RDI: ffffffff8f7220a0
RBP: 0000000000000000 R08: ffff888037a51ec0 R09: 0000000000000005
R10: 0000000000000100 R11: 0000000000000004 R12: ffffffff8be5b108
R13: dffffc0000000000 R14: ffff888060089188 R15: dffffc0000000000
FS: 00007f20440566c0(0000) GS:ffff8881264a1000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffe9657c0a8 CR3: 000000003ffac000 CR4: 00000000003526f0
Call Trace:
<TASK>
__refcount_add include/linux/refcount.h:-1 [inline]
__refcount_inc include/linux/refcount.h:366 [inline]
refcount_inc include/linux/refcount.h:383 [inline]
kref_get include/linux/kref.h:45 [inline]
kobject_get+0xfa/0x120 lib/kobject.c:643
i2c_get_adapter+0x6d/0xa0 drivers/i2c/i2c-core-base.c:2611
i2cdev_open+0x48/0x190 drivers/i2c/i2c-dev.c:604
chrdev_open+0x4dc/0x600 fs/char_dev.c:411
do_dentry_open+0x849/0x1420 fs/open.c:947
vfs_open+0x3b/0x350 fs/open.c:1079
do_open fs/namei.c:4699 [inline]
path_openat+0x2e76/0x38d0 fs/namei.c:4858
do_file_open+0x23e/0x4a0 fs/namei.c:4887
do_sys_openat2+0x113/0x200 fs/open.c:1364
do_sys_open fs/open.c:1370 [inline]
__do_sys_openat fs/open.c:1386 [inline]
__se_sys_openat fs/open.c:1381 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1381
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2045dbd68e
Code: 08 0f 85 a5 a8 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 80 00 00 00 00 48 83 ec 08
RSP: 002b:00007f2044055b28 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f20440566c0 RCX: 00007f2045dbd68e
RDX: 00000000001a0d82 RSI: 00007f2044055c00 RDI: ffffffffffffff9c
RBP: 00007f2044055c00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: cccccccccccccccd
R13: 00007f2046076038 R14: 00007f2046075fa0 R15: 00007ffe29daef28
</TASK>
----------------
Code disassembly (best guess):
0: eb 66 jmp 0x68
2: 85 db test %ebx,%ebx
4: 74 3e je 0x44
6: 83 fb 01 cmp $0x1,%ebx
9: 75 4c jne 0x57
b: e8 6b 61 24 fd call 0xfd24617b
10: 48 8d 3d 54 7a d2 0a lea 0xad27a54(%rip),%rdi # 0xad27a6b
17: 67 48 0f b9 3a ud1 (%edx),%rdi
1c: eb 4a jmp 0x68
1e: e8 58 61 24 fd call 0xfd24617b
23: 48 8d 3d 51 7a d2 0a lea 0xad27a51(%rip),%rdi # 0xad27a7b
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: eb 37 jmp 0x68
31: e8 45 61 24 fd call 0xfd24617b
36: 48 8d 3d 4e 7a d2 0a lea 0xad27a4e(%rip),%rdi # 0xad27a8b
3d: 67 addr32
3e: 48 rex.W
3f: 0f .byte 0xf
* Struck through repros no longer work on HEAD.