Thread (11 messages) flat view 11 messages, 4 authors, 2021-07-24

Re: [PATCH v3] loop: reintroduce global lock for safe loop_validate_file() traversal

From: Jens Axboe <axboe@kernel.dk>
Date: 2021-07-23 16:19:43

On 7/6/21 8:40 AM, Tetsuo Handa wrote:
Commit 6cc8e7430801fa23 ("loop: scale loop device by introducing per
device lock") re-opened a race window for NULL pointer dereference at
loop_validate_file() where commit 310ca162d779efee ("block/loop: Use
global lock for ioctl() operation.") has closed.

Although we need to guarantee that other loop devices will not change
during traversal, we can't take remote "struct loop_device"->lo_mutex
inside loop_validate_file() in order to avoid AB-BA deadlock. Therefore,
introduce a global lock dedicated for loop_validate_file() which is
conditionally taken before local "struct loop_device"->lo_mutex is taken.
I'll queue this up for next weeks merging. Christoph, are you happy with
it at this point? Can't say it's a thing of beauty, but the problem does
seem real.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help