This is a note to let you know that I've just added the patch titled loop: Use blk_validate_block_size() to validate block size to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: loop-use-blk_validate_block_size-to-validate-block-size.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From af3c570fb0df422b4906ebd11c1bf363d89961d5 Mon Sep 17 00:00:00 2001 From: Xie Yongji <xieyongji@xxxxxxxxxxxxx> Date: Tue, 26 Oct 2021 22:40:14 +0800 Subject: loop: Use blk_validate_block_size() to validate block size From: Xie Yongji <xieyongji@xxxxxxxxxxxxx> commit af3c570fb0df422b4906ebd11c1bf363d89961d5 upstream. Remove loop_validate_block_size() and use the block layer helper to validate block size. Signed-off-by: Xie Yongji <xieyongji@xxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20211026144015.188-4-xieyongji@xxxxxxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/block/loop.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -273,19 +273,6 @@ static void __loop_update_dio(struct loo } /** - * loop_validate_block_size() - validates the passed in block size - * @bsize: size to validate - */ -static int -loop_validate_block_size(unsigned short bsize) -{ - if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize)) - return -EINVAL; - - return 0; -} - -/** * loop_set_size() - sets device size and notifies userspace * @lo: struct loop_device to set the size for * @size: new size of the loop device @@ -1236,7 +1223,7 @@ static int loop_configure(struct loop_de } if (config->block_size) { - error = loop_validate_block_size(config->block_size); + error = blk_validate_block_size(config->block_size); if (error) goto out_unlock; } @@ -1759,7 +1746,7 @@ static int loop_set_block_size(struct lo if (lo->lo_state != Lo_bound) return -ENXIO; - err = loop_validate_block_size(arg); + err = blk_validate_block_size(arg); if (err) return err; Patches currently in stable-queue which might be from xieyongji@xxxxxxxxxxxxx are queue-5.15/loop-use-blk_validate_block_size-to-validate-block-size.patch queue-5.15/block-add-a-helper-to-validate-the-block-size.patch