Commit 47903fa
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 <axboe@kernel.dk>
Closes: https://lore.kernel.org/linux-block/0349d72d-dff8-4f9f-b448-919fa5ae96da@kernel.dk/
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260423033058.2805135-2-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 1cdf3b2 commit 47903fa
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5486 | 5486 | | |
5487 | 5487 | | |
5488 | 5488 | | |
| 5489 | + | |
5489 | 5490 | | |
5490 | 5491 | | |
5491 | 5492 | | |
5492 | 5493 | | |
5493 | 5494 | | |
| 5495 | + | |
| 5496 | + | |
5494 | 5497 | | |
5495 | 5498 | | |
5496 | 5499 | | |
| |||
5503 | 5506 | | |
5504 | 5507 | | |
5505 | 5508 | | |
| 5509 | + | |
5506 | 5510 | | |
5507 | 5511 | | |
5508 | 5512 | | |
| |||
0 commit comments