syzbot


WARNING: refcount bug in sco_conn_put

Status: upstream: reported on 2025/02/21 09:40
Subsystems: bluetooth
[Documentation on labels]
Reported-by: syzbot+81d70446f786c253e1b1@syzkaller.appspotmail.com
First crash: 5d00h, last: 5d00h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bluetooth?] WARNING: refcount bug in sco_conn_put 0 (1) 2025/02/21 09:40

Sample crash report:
------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 0 PID: 21153 at lib/refcount.c:28 refcount_warn_saturate+0x14a/0x210 lib/refcount.c:28
Modules linked in:
CPU: 0 UID: 0 PID: 21153 Comm: syz.3.12815 Not tainted 6.14.0-rc2-syzkaller-00346-gba643b6d8440 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:refcount_warn_saturate+0x14a/0x210 lib/refcount.c:28
Code: ff 89 de e8 08 71 f7 fc 84 db 0f 85 66 ff ff ff e8 5b 76 f7 fc c6 05 ef 92 88 0b 01 90 48 c7 c7 80 f0 d2 8b e8 37 b0 b7 fc 90 <0f> 0b 90 90 e9 43 ff ff ff e8 38 76 f7 fc 0f b6 1d ca 92 88 0b 31
RSP: 0018:ffffc90004e97ac8 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffc90031b18000
RDX: 0000000000080000 RSI: ffffffff817a1236 RDI: 0000000000000001
RBP: ffff88806a5878fc R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000002 R12: ffff88806a5878fc
R13: ffff88806a587808 R14: 0000000000000000 R15: ffff88802b1292c0
FS:  0000000000000000(0000) GS:ffff88802b400000(0063) knlGS:00000000f5064b40
CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
CR2: 0000000031cf2ffc CR3: 000000005e816000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 00000000000f0102 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __refcount_sub_and_test include/linux/refcount.h:275 [inline]
 __refcount_dec_and_test include/linux/refcount.h:307 [inline]
 refcount_dec_and_test include/linux/refcount.h:325 [inline]
 kref_put include/linux/kref.h:64 [inline]
 sco_conn_put+0x2ea/0x4c0 net/bluetooth/sco.c:107
 sco_chan_del+0x9c/0x1b0 net/bluetooth/sco.c:236
 __sco_sock_close+0xab/0x210 net/bluetooth/sco.c:511
 sco_sock_close net/bluetooth/sco.c:526 [inline]
 sco_sock_release+0x6f/0x2d0 net/bluetooth/sco.c:1300
 __sock_release+0xb0/0x270 net/socket.c:647
 sock_close+0x1c/0x30 net/socket.c:1398
 __fput+0x3ff/0xb70 fs/file_table.c:464
 task_work_run+0x14e/0x250 kernel/task_work.c:227
 get_signal+0x1d3/0x26c0 kernel/signal.c:2809
 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x150/0x2a0 kernel/entry/common.c:218
 __do_fast_syscall_32+0x80/0x120 arch/x86/entry/common.c:389
 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e
RIP: 0023:0xf7f83579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000f506455c EFLAGS: 00000296 ORIG_RAX: 000000000000016a
RAX: fffffffffffffffc RBX: 000000000000000a RCX: 0000000080000040
RDX: 0000000000000008 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
----------------
Code disassembly (best guess), 2 bytes skipped:
   0:	10 06                	adc    %al,(%rsi)
   2:	03 74 b4 01          	add    0x1(%rsp,%rsi,4),%esi
   6:	10 07                	adc    %al,(%rdi)
   8:	03 74 b0 01          	add    0x1(%rax,%rsi,4),%esi
   c:	10 08                	adc    %cl,(%rax)
   e:	03 74 d8 01          	add    0x1(%rax,%rbx,8),%esi
  1e:	00 51 52             	add    %dl,0x52(%rcx)
  21:	55                   	push   %rbp
  22:	89 e5                	mov    %esp,%ebp
  24:	0f 34                	sysenter
  26:	cd 80                	int    $0x80
* 28:	5d                   	pop    %rbp <-- trapping instruction
  29:	5a                   	pop    %rdx
  2a:	59                   	pop    %rcx
  2b:	c3                   	ret
  2c:	90                   	nop
  2d:	90                   	nop
  2e:	90                   	nop
  2f:	90                   	nop
  30:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi
  37:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/17 06:31 upstream ba643b6d8440 40a34ec9 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING: refcount bug in sco_conn_put
* Struck through repros no longer work on HEAD.