Skip to content

Commit 9423c65

Browse files
johnpgarryaxboe
authored andcommitted
loop: Don't bother validating blocksize
The block queue limits validation does this for us now. The loop_configure() -> WARN_ON_ONCE() call is dropped, as an invalid block size would trigger this now. We don't want userspace to be able to directly trigger WARNs. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: John Garry <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent af28172 commit 9423c65

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

drivers/block/loop.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,12 +1038,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
10381038
goto out_unlock;
10391039
}
10401040

1041-
if (config->block_size) {
1042-
error = blk_validate_block_size(config->block_size);
1043-
if (error)
1044-
goto out_unlock;
1045-
}
1046-
10471041
error = loop_set_status_from_info(lo, &config->info);
10481042
if (error)
10491043
goto out_unlock;
@@ -1075,7 +1069,7 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
10751069
mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
10761070

10771071
error = loop_reconfigure_limits(lo, config->block_size);
1078-
if (WARN_ON_ONCE(error))
1072+
if (error)
10791073
goto out_unlock;
10801074

10811075
loop_update_dio(lo);
@@ -1447,10 +1441,6 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg)
14471441
if (lo->lo_state != Lo_bound)
14481442
return -ENXIO;
14491443

1450-
err = blk_validate_block_size(arg);
1451-
if (err)
1452-
return err;
1453-
14541444
if (lo->lo_queue->limits.logical_block_size == arg)
14551445
return 0;
14561446

0 commit comments

Comments
 (0)