diff options
| author | Bodo Stroesser <[email protected]> | 2022-05-17 19:29:13 +0000 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2022-05-20 00:16:27 +0000 |
| commit | 325d5c5fb216674296f3902a8902b942da3adc5b (patch) | |
| tree | 98cee22612befcbff95316d83366e73fc4e6ecd2 /arch/arm/mm/init.c | |
| parent | scsi: elx: efct: Remove NULL check after calling container_of() (diff) | |
| download | kernel-325d5c5fb216674296f3902a8902b942da3adc5b.tar.gz kernel-325d5c5fb216674296f3902a8902b942da3adc5b.zip | |
scsi: target: tcmu: Avoid holding XArray lock when calling lock_page
In tcmu_blocks_release(), lock_page() is called to prevent a race causing
possible data corruption. Since lock_page() might sleep, calling it while
holding XArray lock is a bug.
To fix this, replace the xas_for_each() call with xa_for_each_range().
Since the latter does its own handling of XArray locking, the xas_lock()
and xas_unlock() calls around the original loop are no longer necessary.
The switch to xa_for_each_range() slows down the loop slightly. This is
acceptable since tcmu_blocks_release() is not relevant for performance.
Link: https://lore.kernel.org/r/[email protected]
Fixes: bb9b9eb0ae2e ("scsi: target: tcmu: Fix possible data corruption")
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Bodo Stroesser <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'arch/arm/mm/init.c')
0 files changed, 0 insertions, 0 deletions
