]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvme-core: check for too small lba shift
authorKeith Busch <kbusch@kernel.org>
Tue, 28 Nov 2023 17:36:04 +0000 (09:36 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 22:52:27 +0000 (14:52 -0800)
commit05d753d74c3a0adcff1228d1aa47df0acf6d3c01
treeeb57dde8f71e002af4286d5ab1bd36feb68baae5
parent9ad8b171c4e6ceb4fd80a9852b84ceace400edee
nvme-core: check for too small lba shift

[ Upstream commit 74fbc88e161424b3b96a22b23a8e3e1edab9d05c ]

The block layer doesn't support logical block sizes smaller than 512
bytes. The nvme spec doesn't support that small either, but the driver
isn't checking to make sure the device responded with usable data.
Failing to catch this will result in a kernel bug, either from a
division by zero when stacking, or a zero length bio.

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c