Re: [syzbot] [block?] possible deadlock in loop_set_status

Hillf Danton
2025-03-01T13:48:00Z

On Sat, 01 Mar 2025 02:18:23 -0800
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 276f98efb64a Merge tag 'block-6.14-20250228' of git://git...
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14f2c864580000

#syz test

--- x/drivers/block/loop.c
+++ y/drivers/block/loop.c
@@ -1286,17 +1286,16 @@ loop_set_status(struct loop_device *lo,
lo->lo_flags &= ~LOOP_SET_STATUS_CLEARABLE_FLAGS;
lo->lo_flags |= (info->lo_flags & LOOP_SET_STATUS_SETTABLE_FLAGS);

- if (size_changed) {
- loff_t new_size = get_size(lo->lo_offset, lo->lo_sizelimit,
- lo->lo_backing_file);
- loop_set_size(lo, new_size);
- }
-
/* update the direct I/O flag if lo_offset changed */
loop_update_dio(lo);

out_unfreeze:
blk_mq_unfreeze_queue(lo->lo_queue, memflags);
+ if (!err && size_changed) {
+ loff_t new_size = get_size(lo->lo_offset, lo->lo_sizelimit,
+ lo->lo_backing_file);
+ loop_set_size(lo, new_size);
+ }
if (partscan)
clear_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
out_unlock:
--