Skip to content

Commit

Permalink
loop: Don't bother validating blocksize
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
johnpgarry authored and axboe committed Jul 9, 2024
1 parent af28172 commit 9423c65
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
@@ -1038,12 +1038,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
goto out_unlock;
}

if (config->block_size) {
error = blk_validate_block_size(config->block_size);
if (error)
goto out_unlock;
}

error = loop_set_status_from_info(lo, &config->info);
if (error)
goto out_unlock;
@@ -1075,7 +1069,7 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));

error = loop_reconfigure_limits(lo, config->block_size);
if (WARN_ON_ONCE(error))
if (error)
goto out_unlock;

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

err = blk_validate_block_size(arg);
if (err)
return err;

if (lo->lo_queue->limits.logical_block_size == arg)
return 0;

0 comments on commit 9423c65

Please sign in to comment.