2022-08-04 09:52:28

by syzbot

[permalink] [raw]
Subject: [syzbot] upstream test error: WARNING: ODEBUG bug in mgmt_index_removed

Hello,

syzbot found the following issue on:

HEAD commit: b44f2fd87919 Merge tag 'drm-next-2022-08-03' of git://anon..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12099eb6080000
kernel config: https://syzkaller.appspot.com/x/.config?x=4dcc926c2745b9bc
dashboard link: https://syzkaller.appspot.com/bug?extid=b8ddd338a8838e581b1c
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

------------[ cut here ]------------
ODEBUG: assert_init not available (active state 0) object type: timer_list hint: 0x0
WARNING: CPU: 2 PID: 3677 at lib/debugobjects.c:502 debug_print_object+0x16e/0x250 lib/debugobjects.c:502
Modules linked in:
CPU: 2 PID: 3677 Comm: syz-executor.0 Not tainted 5.19.0-syzkaller-07280-gb44f2fd87919 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
RIP: 0010:debug_print_object+0x16e/0x250 lib/debugobjects.c:502
Code: ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 af 00 00 00 48 8b 14 dd 80 6d 28 8a 4c 89 ee 48 c7 c7 60 61 28 8a e8 c5 6c 37 05 <0f> 0b 83 05 f5 4d bc 09 01 48 83 c4 18 5b 5d 41 5c 41 5d 41 5e c3
RSP: 0018:ffffc90002e976e0 EFLAGS: 00010086
RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000000000
RDX: ffff88801b79a1c0 RSI: ffffffff81604db8 RDI: fffff520005d2ece
RBP: 0000000000000001 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000001 R12: ffffffff89cec7e0
R13: ffffffff8a2867e0 R14: ffffffff81694bf0 R15: 1ffff920005d2ee7
FS: 0000000000000000(0000) GS:ffff88802ca00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055d5e4cfad58 CR3: 0000000015303000 CR4: 0000000000150ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
debug_object_assert_init lib/debugobjects.c:892 [inline]
debug_object_assert_init+0x1f4/0x2e0 lib/debugobjects.c:863
debug_timer_assert_init kernel/time/timer.c:792 [inline]
debug_assert_init kernel/time/timer.c:837 [inline]
del_timer+0x6d/0x110 kernel/time/timer.c:1257
try_to_grab_pending+0x6d/0xd0 kernel/workqueue.c:1275
__cancel_work_timer+0xa6/0x570 kernel/workqueue.c:3121
mgmt_index_removed+0x187/0x2e0 net/bluetooth/mgmt.c:8939
hci_unregister_dev+0x467/0x550 net/bluetooth/hci_core.c:2688
vhci_release+0x7c/0xf0 drivers/bluetooth/hci_vhci.c:568
__fput+0x277/0x9d0 fs/file_table.c:320
task_work_run+0xdd/0x1a0 kernel/task_work.c:177
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xade/0x29d0 kernel/exit.c:795
do_group_exit+0xd2/0x2f0 kernel/exit.c:925
get_signal+0x2542/0x2600 kernel/signal.c:2857
arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869
exit_to_user_mode_loop kernel/entry/common.c:166 [inline]
exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201
__syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f283b03bdbc
Code: Unable to access opcode bytes at RIP 0x7f283b03bd92.
RSP: 002b:00007ffec8e73250 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: fffffffffffffe00 RBX: 00007ffec8e73300 RCX: 00007f283b03bdbc
RDX: 0000000000000040 RSI: 00007f283b198020 RDI: 00000000000000f9
RBP: 0000000000000003 R08: 0000000000000000 R09: ff00000000000000
R10: 00007f283b16d6c0 R11: 0000000000000246 R12: 0000000000000032
R13: 000000000000e5af R14: 0000000000000003 R15: 00007ffec8e73340
</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 [email protected].

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


2022-08-05 07:15:16

by Tetsuo Handa

[permalink] [raw]
Subject: [PATCH (urgent)] Bluetooth: don't try to cancel uninitialized works at mgmt_index_removed()

syzbot is reporting attempt to cancel uninitialized work at
mgmt_index_removed() [1], for calling cancel_delayed_work_sync() without
INIT_DELAYED_WORK() is not permitted.

INIT_DELAYED_WORK() is called from mgmt_init_hdev() via chan->hdev_init()
from hci_mgmt_cmd(), but cancel_delayed_work_sync() is unconditionally
called from mgmt_index_removed().

Call cancel_delayed_work_sync() only if HCI_MGMT flag was set, for
mgmt_init_hdev() sets HCI_MGMT flag when calling INIT_DELAYED_WORK().

Link: https://syzkaller.appspot.com/bug?extid=b8ddd338a8838e581b1c [1]
Reported-by: syzbot <[email protected]>
Signed-off-by: Tetsuo Handa <[email protected]URA.ne.jp>
Fixes: 0ef08313cefdd60d ("Bluetooth: Convert delayed discov_off to hci_sync")
---
I can't test this patch due to lack of reproducer. But please review and
send to linux.git as soon as possible, for currently syzbot can't test
changes for 6.0-rc1 due to this problem (please see "Instances:" table at
https://syzkaller.appspot.com/upstream ).

syzbot was unable to test linux-next.git since 20220628 due to a different bug.
As an unfortunate result, this bug (being there since 20220725) which would have
been already found and fixed in linux-next.git arrived at linux.git...

net/bluetooth/mgmt.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f0bb2fc883d7..6e31023b84f5 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -8935,6 +8935,8 @@ void mgmt_index_removed(struct hci_dev *hdev)
HCI_MGMT_EXT_INDEX_EVENTS);

/* Cancel any remaining timed work */
+ if (!hci_dev_test_flag(hdev, HCI_MGMT))
+ return;
cancel_delayed_work_sync(&hdev->discov_off);
cancel_delayed_work_sync(&hdev->service_cache);
cancel_delayed_work_sync(&hdev->rpa_expired);
--
2.34.1


2022-08-05 08:15:26

by bluez.test.bot

[permalink] [raw]
Subject: RE: [(urgent)] Bluetooth: don't try to cancel uninitialized works at mgmt_index_removed()

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=665551

---Test result---

Test Summary:
CheckPatch PASS 1.63 seconds
GitLint FAIL 1.01 seconds
SubjectPrefix PASS 0.88 seconds
BuildKernel PASS 34.88 seconds
BuildKernel32 PASS 30.75 seconds
Incremental Build with patchesPASS 41.93 seconds
TestRunner: Setup PASS 502.14 seconds
TestRunner: l2cap-tester PASS 17.94 seconds
TestRunner: bnep-tester PASS 6.99 seconds
TestRunner: mgmt-tester PASS 105.50 seconds
TestRunner: rfcomm-tester PASS 10.44 seconds
TestRunner: sco-tester PASS 10.18 seconds
TestRunner: smp-tester PASS 10.16 seconds
TestRunner: userchan-tester PASS 7.21 seconds

Details
##############################
Test: GitLint - FAIL - 1.01 seconds
Run gitlint with rule in .gitlint
[(urgent)] Bluetooth: don't try to cancel uninitialized works at mgmt_index_removed()
1: T1 Title exceeds max length (85>80): "[(urgent)] Bluetooth: don't try to cancel uninitialized works at mgmt_index_removed()"




---
Regards,
Linux Bluetooth

2022-08-05 22:29:22

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH (urgent)] Bluetooth: don't try to cancel uninitialized works at mgmt_index_removed()

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Fri, 5 Aug 2022 16:12:18 +0900 you wrote:
> syzbot is reporting attempt to cancel uninitialized work at
> mgmt_index_removed() [1], for calling cancel_delayed_work_sync() without
> INIT_DELAYED_WORK() is not permitted.
>
> INIT_DELAYED_WORK() is called from mgmt_init_hdev() via chan->hdev_init()
> from hci_mgmt_cmd(), but cancel_delayed_work_sync() is unconditionally
> called from mgmt_index_removed().
>
> [...]

Here is the summary with links:
- [(urgent)] Bluetooth: don't try to cancel uninitialized works at mgmt_index_removed()
https://git.kernel.org/bluetooth/bluetooth-next/c/0659969095f6

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html