Commit 4027807
ublk: fix maple tree lockdep warning in ublk_buf_cleanup
ublk_buf_cleanup() iterates the maple tree with mas_for_each()
without holding mas_lock, triggering a lockdep splat on
CONFIG_PROVE_RCU kernels since mas_find() internally uses
rcu_dereference_check() which requires either RCU or the tree lock.
Fix by holding mas_lock around the iteration, and call mas_erase()
before freeing each range to avoid dangling pointers in the tree.
Fixes: 5e86443 ("ublk: replace xarray with IDA for shmem buffer index allocation")
Reported-by: Jens Axboe <[email protected]>
Closes: https://lore.kernel.org/linux-block/[email protected]/
Signed-off-by: Ming Lei <[email protected]>1 parent 6a0b974 commit 4027807
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5478 | 5478 | | |
5479 | 5479 | | |
5480 | 5480 | | |
| 5481 | + | |
5481 | 5482 | | |
5482 | 5483 | | |
5483 | 5484 | | |
5484 | 5485 | | |
5485 | 5486 | | |
| 5487 | + | |
| 5488 | + | |
5486 | 5489 | | |
5487 | 5490 | | |
5488 | 5491 | | |
| |||
5495 | 5498 | | |
5496 | 5499 | | |
5497 | 5500 | | |
| 5501 | + | |
5498 | 5502 | | |
5499 | 5503 | | |
5500 | 5504 | | |
| |||
0 commit comments