]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
block: ublk: make sure that block size is set correctly
authorMing Lei <ming.lei@redhat.com>
Thu, 6 Apr 2023 12:40:59 +0000 (20:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Apr 2023 15:02:54 +0000 (17:02 +0200)
commit9dbe85ac618ef6ae60abe5dd17ae2b29065d9c1e
treea8e93d587b07fd43e4f28f94c719497642946167
parentfc03ab6fdbfef20d84f6a98ed4810233699dfaf2
block: ublk: make sure that block size is set correctly

[ Upstream commit 1d1665279a845d16c93687389e364386e3fe0f38 ]

block size is one very key setting for block layer, and bad block size
could panic kernel easily.

Make sure that block size is set correctly.

Meantime if ublk_validate_params() fails, clear ub->params so that disk
is prevented from being added.

Fixes: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")
Reported-and-tested-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/ublk_drv.c