]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: sd: Fix off-by-one error in sd_read_block_characteristics()
authorMartin Wilck <mwilck@suse.com>
Thu, 12 Sep 2024 13:43:08 +0000 (15:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:31 +0000 (16:33 +0200)
commita776050373893e4c847a49abeae2ccb581153df0
treefc60979eb0502454e3fa06e8338efb1743a6d794
parenta16ac25841eeeb0c04ccca124ba09cb99bc58ba1
scsi: sd: Fix off-by-one error in sd_read_block_characteristics()

commit f81eaf08385ddd474a2f41595a7757502870c0eb upstream.

Ff the device returns page 0xb1 with length 8 (happens with qemu v2.x, for
example), sd_read_block_characteristics() may attempt an out-of-bounds
memory access when accessing the zoned field at offset 8.

Fixes: 7fb019c46eee ("scsi: sd: Switch to using scsi_device VPD pages")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Wilck <mwilck@suse.com>
Link: https://lore.kernel.org/r/20240912134308.282824-1-mwilck@suse.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/sd.c