All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [bluetooth?] WARNING in ida_free (2)
@ 2024-02-13 16:36 syzbot
  2024-02-14  0:24 ` Hillf Danton
  2024-02-14 11:22 ` Hillf Danton
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2024-02-13 16:36 UTC (permalink / raw)
  To: johan.hedberg, linux-bluetooth, linux-kernel, luiz.dentz, marcel,
	syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    c664e16bb1ba Merge tag 'docs-6.8-fixes2' of git://git.lwn...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15ebd7f4180000
kernel config:  https://syzkaller.appspot.com/x/.config?x=df82262440d95bc4
dashboard link: https://syzkaller.appspot.com/bug?extid=dfab1425afcdae5ac970
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11f832cc180000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14ee7970180000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-c664e16b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c838390fdb6c/vmlinux-c664e16b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d25123cb1896/bzImage-c664e16b.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+dfab1425afcdae5ac970@syzkaller.appspotmail.com

------------[ cut here ]------------
ida_free called for id=8192 which is not allocated.
WARNING: CPU: 0 PID: 5169 at lib/idr.c:525 ida_free+0x1fb/0x2f0 lib/idr.c:525
Modules linked in:
CPU: 0 PID: 5169 Comm: syz-executor420 Not tainted 6.8.0-rc4-syzkaller-00005-gc664e16bb1ba #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:ida_free+0x1fb/0x2f0 lib/idr.c:525
Code: dc f6 41 83 fe 3e 76 73 e8 82 95 dc f6 48 8b 7c 24 28 4c 89 ee e8 55 8f 18 00 90 48 c7 c7 00 7c 5b 8c 89 ee e8 46 ba a0 f6 90 <0f> 0b 90 90 e8 5c 95 dc f6 48 b8 00 00 00 00 00 fc ff df 48 01 c3
RSP: 0018:ffffc90003007a48 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 1ffff92000600f4a RCX: ffffffff814f7499
RDX: ffff88801ccac800 RSI: ffffffff814f74a6 RDI: 0000000000000001
RBP: 0000000000002000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000002 R12: 0000000000000000
R13: 0000000000000293 R14: 0000000000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff88806b200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fcad7713f08 CR3: 0000000027a24000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 hci_conn_cleanup net/bluetooth/hci_conn.c:157 [inline]
 hci_conn_del+0x795/0xe20 net/bluetooth/hci_conn.c:1188
 hci_conn_hash_flush+0x18f/0x260 net/bluetooth/hci_conn.c:2646
 hci_dev_close_sync+0x59b/0x1160 net/bluetooth/hci_sync.c:4954
 hci_dev_do_close+0x2e/0x90 net/bluetooth/hci_core.c:554
 hci_unregister_dev+0x1eb/0x600 net/bluetooth/hci_core.c:2739
 vhci_release+0x7f/0x100 drivers/bluetooth/hci_vhci.c:674
 __fput+0x270/0xb80 fs/file_table.c:376
 task_work_run+0x14f/0x250 kernel/task_work.c:180
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0xa8a/0x2ad0 kernel/exit.c:871
 do_group_exit+0xd4/0x2a0 kernel/exit.c:1020
 __do_sys_exit_group kernel/exit.c:1031 [inline]
 __se_sys_exit_group kernel/exit.c:1029 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7fcad76bb449
Code: Unable to access opcode bytes at 0x7fcad76bb41f.
RSP: 002b:00007ffcea444888 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fcad76bb449
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000001
RBP: 00007fcad77472b0 R08: ffffffffffffffb0 R09: 000000ff00ff3650
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fcad77472b0
R13: 0000000000000000 R14: 00007fcad7747d00 R15: 00007fcad7689500
 </TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [bluetooth?] WARNING in ida_free (2)
  2024-02-13 16:36 [syzbot] [bluetooth?] WARNING in ida_free (2) syzbot
@ 2024-02-14  0:24 ` Hillf Danton
  2024-02-14  0:50   ` syzbot
  2024-02-14 11:22 ` Hillf Danton
  1 sibling, 1 reply; 5+ messages in thread
From: Hillf Danton @ 2024-02-14  0:24 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, syzkaller-bugs

On Tue, 13 Feb 2024 08:36:20 -0800
> HEAD commit:    c664e16bb1ba Merge tag 'docs-6.8-fixes2' of git://git.lwn...
> git tree:       upstream
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14ee7970180000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master

--- x/net/bluetooth/hci_conn.c
+++ y/net/bluetooth/hci_conn.c
@@ -970,6 +970,9 @@ struct hci_conn *hci_conn_add(struct hci
 
 	bt_dev_dbg(hdev, "dst %pMR handle 0x%4.4x", dst, handle);
 
+	if (HCI_CONN_HANDLE_UNSET(handle))
+		BUG_ON(!ida_alloc_range(&hdev->unset_handle_ida, handle, handle +1, GFP_ATOMIC));
+
 	conn = kzalloc(sizeof(*conn), GFP_KERNEL);
 	if (!conn)
 		return NULL;
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [bluetooth?] WARNING in ida_free (2)
  2024-02-14  0:24 ` Hillf Danton
@ 2024-02-14  0:50   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2024-02-14  0:50 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+dfab1425afcdae5ac970@syzkaller.appspotmail.com

Tested on:

commit:         7e90b5c2 Merge tag 'trace-tools-v6.8-rc4' of git://git..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=16cc5184180000
kernel config:  https://syzkaller.appspot.com/x/.config?x=df82262440d95bc4
dashboard link: https://syzkaller.appspot.com/bug?extid=dfab1425afcdae5ac970
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15cb5e42180000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [bluetooth?] WARNING in ida_free (2)
  2024-02-13 16:36 [syzbot] [bluetooth?] WARNING in ida_free (2) syzbot
  2024-02-14  0:24 ` Hillf Danton
@ 2024-02-14 11:22 ` Hillf Danton
  2024-02-14 12:26   ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: Hillf Danton @ 2024-02-14 11:22 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, syzkaller-bugs

On Tue, 13 Feb 2024 08:36:20 -0800
> HEAD commit:    c664e16bb1ba Merge tag 'docs-6.8-fixes2' of git://git.lwn...
> git tree:       upstream
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14ee7970180000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master

--- x/net/bluetooth/hci_conn.c
+++ y/net/bluetooth/hci_conn.c
@@ -970,6 +970,9 @@ struct hci_conn *hci_conn_add(struct hci
 
 	bt_dev_dbg(hdev, "dst %pMR handle 0x%4.4x", dst, handle);
 
+	if (HCI_CONN_HANDLE_UNSET(handle))
+		BUG_ON(!ida_alloc_range(&hdev->unset_handle_ida, handle, handle, GFP_ATOMIC));
+
 	conn = kzalloc(sizeof(*conn), GFP_KERNEL);
 	if (!conn)
 		return NULL;
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [bluetooth?] WARNING in ida_free (2)
  2024-02-14 11:22 ` Hillf Danton
@ 2024-02-14 12:26   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2024-02-14 12:26 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+dfab1425afcdae5ac970@syzkaller.appspotmail.com

Tested on:

commit:         7e90b5c2 Merge tag 'trace-tools-v6.8-rc4' of git://git..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=175a2c52180000
kernel config:  https://syzkaller.appspot.com/x/.config?x=df82262440d95bc4
dashboard link: https://syzkaller.appspot.com/bug?extid=dfab1425afcdae5ac970
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=10d404a4180000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-14 12:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 16:36 [syzbot] [bluetooth?] WARNING in ida_free (2) syzbot
2024-02-14  0:24 ` Hillf Danton
2024-02-14  0:50   ` syzbot
2024-02-14 11:22 ` Hillf Danton
2024-02-14 12:26   ` syzbot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.