nvme: sanitize metadata bounce buffer for reads
authorKeith Busch <kbusch@kernel.org>
Mon, 16 Oct 2023 20:12:47 +0000 (13:12 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 10:03:14 +0000 (12:03 +0200)
commit2c0b40c310a5d360aa322c7f7a0e8e43e0bd22d1
treeab4c21bb16de9fa0b9c2020aea92cdfd2a9beea9
parenta54974b0076f028f3533e6bb07f7652fc1b913ab
nvme: sanitize metadata bounce buffer for reads

commit 2b32c76e2b0154b98b9322ae7546b8156cd703e6 upstream.

User can request more metadata bytes than the device will write. Ensure
kernel buffer is initialized so we're not leaking unsanitized memory on
the copy-out.

Fixes: 0b7f1f26f95a51a ("nvme: use the block layer for userspace passthrough metadata")
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/host/ioctl.c