]> www.infradead.org Git - users/jedix/linux-maple.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 14:55:32 +0000 (16:55 +0200)
commit231a49460ac0203270da2471928d392e5586370f
tree1ea1edd12c13a81a26cc13a32809bcbee77c5fc9
parentfb9ec305e7649aa76e6055d77cddd2bb691fd74a
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