syzbot


WARNING: bad unlock balance in elevator_init_mq

Status: upstream: reported syz repro on 2024/11/07 02:47
Subsystems: block usb
[Documentation on labels]
Reported-by: syzbot+a95fab8e491d4ac8cbe9@syzkaller.appspotmail.com
First crash: 18d, last: 18d
Cause bisection: introduced by (bisect log) :
commit f1be1788a32e8fa63416ad4518bbd1a85a825c9d
Author: Ming Lei <ming.lei@redhat.com>
Date: Fri Oct 25 00:37:20 2024 +0000

  block: model freeze & enter queue as lock for supporting lockdep

Crash: WARNING: bad unlock balance in blk_mq_update_tag_set_shared (log)
Repro: syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [block?] [usb?] WARNING: bad unlock balance in elevator_init_mq 0 (2) 2024/11/17 08:14
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/11/17 02:43 1h12m retest repro linux-next error

Sample crash report:
sd 4:0:0:1: [sdb] 0-byte physical blocks
sd 4:0:0:1: [sdb] Test WP failed, assume Write Enabled
sd 4:0:0:1: [sdb] Asking for cache data failed
sd 4:0:0:1: [sdb] Assuming drive cache: write through
=====================================
WARNING: bad unlock balance detected!
6.12.0-rc5-next-20241101-syzkaller #0 Not tainted
-------------------------------------
kworker/u8:4/67 is trying to release lock (&q->q_usage_counter(queue)) at:
[<ffffffff849207a2>] elevator_init_mq+0x1e2/0x2d0 block/elevator.c:607
but there are no more locks to release!

other info that might help us debug this:
3 locks held by kworker/u8:4/67:
 #0: ffff88801d681148 ((wq_completion)async){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3204 [inline]
 #0: ffff88801d681148 ((wq_completion)async){+.+.}-{0:0}, at: process_scheduled_works+0x93b/0x1850 kernel/workqueue.c:3310
 #1: ffffc900020bfd00 ((work_completion)(&entry->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3205 [inline]
 #1: ffffc900020bfd00 ((work_completion)(&entry->work)){+.+.}-{0:0}, at: process_scheduled_works+0x976/0x1850 kernel/workqueue.c:3310
 #2: ffff8880327ca378 (&dev->mutex){....}-{4:4}, at: device_lock include/linux/device.h:1014 [inline]
 #2: ffff8880327ca378 (&dev->mutex){....}-{4:4}, at: __device_attach_async_helper+0xfc/0x300 drivers/base/dd.c:973

stack backtrace:
CPU: 1 UID: 0 PID: 67 Comm: kworker/u8:4 Not tainted 6.12.0-rc5-next-20241101-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: async async_run_entry_fn
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_unlock_imbalance_bug+0x25b/0x2d0 kernel/locking/lockdep.c:5287
 __lock_release kernel/locking/lockdep.c:5526 [inline]
 lock_release+0x5cb/0xa30 kernel/locking/lockdep.c:5870
 blk_unfreeze_release_lock block/blk.h:745 [inline]
 blk_mq_unfreeze_queue+0xd2/0x140 block/blk-mq.c:213
 elevator_init_mq+0x1e2/0x2d0 block/elevator.c:607
 add_disk_fwnode+0x10d/0xf80 block/genhd.c:413
 sd_probe+0xba6/0x1100 drivers/scsi/sd.c:4024
 really_probe+0x2b8/0xad0 drivers/base/dd.c:658
 __driver_probe_device+0x1a2/0x390 drivers/base/dd.c:800
 driver_probe_device+0x50/0x430 drivers/base/dd.c:830
 __device_attach_driver+0x2d6/0x530 drivers/base/dd.c:958
 bus_for_each_drv+0x24e/0x2e0 drivers/base/bus.c:459
 __device_attach_async_helper+0x22d/0x300 drivers/base/dd.c:987
 async_run_entry_fn+0xa8/0x420 kernel/async.c:129
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310
 worker_thread+0x870/0xd30 kernel/workqueue.c:3391
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
sd 4:0:0:1: [sdb] Attached SCSI removable disk
sd 5:0:0:0: [sdc] Media removed, stopped polling
sd 5:0:0:0: [sdc] Attached SCSI removable disk
sd 2:0:0:0: [sdb] Media removed, stopped polling
sd 2:0:0:0: [sdb] Attached SCSI removable disk
sd 1:0:0:0: [sdb] Media removed, stopped polling
sd 1:0:0:0: [sdb] Attached SCSI removable disk
sd 4:0:0:0: [sdb] Media removed, stopped polling
sd 4:0:0:0: [sdb] Attached SCSI removable disk
sd 1:0:0:1: [sdf] Media removed, stopped polling
sd 1:0:0:1: [sdf] Attached SCSI removable disk

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/03 02:36 linux-next c88416ba074a f00eed24 .config console log report syz / log [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING: bad unlock balance in elevator_init_mq
* Struck through repros no longer work on HEAD.