aboutsummaryrefslogtreecommitdiff
path: root/scripts/gdb/linux/genpd.py
diff options
context:
space:
mode:
authorTetsuo Handa <[email protected]>2021-11-24 19:47:40 +0900
committerJens Axboe <[email protected]>2021-11-29 06:41:47 -0700
commit6050fa4c84cc93ae509f5105f585a429dffc5633 (patch)
treedcbe09b1f733ee0cf44249412f8cb869fffb73fa /scripts/gdb/linux/genpd.py
parenta30e3441325ba4011ddf125932cda21ca820c0bb (diff)
loop: don't hold lo_mutex during __loop_clr_fd()
syzbot is reporting circular locking problem at __loop_clr_fd() [1], for commit 87579e9b7d8dc36e ("loop: use worker per cgroup instead of kworker") is calling destroy_workqueue() with lo->lo_mutex held. Since all functions where lo->lo_state matters are already checking lo->lo_state with lo->lo_mutex held (in order to avoid racing with e.g. ioctl(LOOP_CTL_REMOVE)), and __loop_clr_fd() can be called from either ioctl(LOOP_CLR_FD) xor close(), lo->lo_state == Lo_rundown is considered as an exclusive lock for __loop_clr_fd(). Therefore, hold lo->lo_mutex inside __loop_clr_fd() only when asserting/updating lo->lo_state. Since ioctl(LOOP_CLR_FD) depends on lo->lo_state == Lo_bound, a valid lo->lo_backing_file must have been assigned by ioctl(LOOP_SET_FD) or ioctl(LOOP_CONFIGURE). Thus, we can remove lo->lo_backing_file test, and convert __loop_clr_fd() into a void function. Link: https://syzkaller.appspot.com/bug?extid=63614029dfb79abd4383 [1] Reported-by: syzbot <[email protected]> Signed-off-by: Tetsuo Handa <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/genpd.py')
0 files changed, 0 insertions, 0 deletions