Commit 05baf38a authored by Bart Van Assche's avatar Bart Van Assche
Browse files

ANDROID: sbitmap: Fix sbitmap_spinlock()



The sbitmap_spinlock() implementation is based on the assumption that
sbitmap.map_nr doesn't change. That assumption is wrong:
scsi_realloc_sdev_budget_map() reduces sbitmap.map_nr by calling
sbitmap_resize(). Fix sbitmap_spinlock() by using the number of maps
that has been allocated instead of the current number of maps. This CL
fixes the following lockdep kernel warning:

INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
Call trace:
 dump_backtrace+0xf0/0x13c
 show_stack+0x18/0x28
 dump_stack_lvl+0x60/0x84
 dump_stack+0x18/0x24
 assign_lock_key+0x174/0x180
 register_lock_class+0xc0/0x318
 __lock_acquire+0xa8/0x2ec4
 lock_acquire+0x130/0x2a8
 _raw_spin_lock_irqsave+0x5c/0x80
 sbitmap_resize+0x84/0x130
 scsi_change_queue_depth+0x74/0x8c
 scsi_alloc_sdev+0x41c/0x4fc
 scsi_probe_and_add_lun+0xc0/0xc38
 __scsi_add_device+0xc4/0x12c
 ufshcd_async_scan+0x6c/0x36c
 async_run_entry_fn+0x4c/0x17c
 process_one_work+0x274/0x62c
 worker_thread+0x264/0x3d0
 kthread+0x110/0x134
 ret_from_fork+0x10/0x20

Bug: 408487532
Test: Boot with lockdep enabled
Fixes: 783d6780 ("ANDROID: Fixed the KMI corruption issue caused by the patch of 72d04bdc.")
Change-Id: Id23c76db4711ea333e3a5424fcb157516a0e7362
Signed-off-by: default avatarBart Van Assche <bvanassche@google.com>
parent 42a23db4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment