summaryrefslogtreecommitdiffstats
path: root/drivers/block/loop.c
diff options
context:
space:
mode:
authorJohn Garry <john.g.garry@oracle.com>2024-07-08 11:16:51 +0200
committerJens Axboe <axboe@kernel.dk>2024-07-09 08:00:17 +0200
commit9423c653fe611070d875b374fb322dc44acce3f2 (patch)
tree1d0e14a7ff1cab241a70e309f0d20072a2164d64 /drivers/block/loop.c
parentvirtio_blk: Don't bother validating blocksize (diff)
downloadlinux-9423c653fe611070d875b374fb322dc44acce3f2.tar.xz
linux-9423c653fe611070d875b374fb322dc44acce3f2.zip
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 <hch@lst.de> Signed-off-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Link: https://lore.kernel.org/r/20240708091651.177447-6-john.g.garry@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r--drivers/block/loop.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index a6f2d6367898..5e93d1c96267 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -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;