scsi: fix off-by-one error in sd_read_block_characteristics()
PATCH 1/1 scsi: fix off-by-one error in sd_read_block_characteristics()
if 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")
Signed-off-by Martin Wilck <[email protected]>
--- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sd.c +1 -1
@@ -3404,7 +3404,7 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp,rcu_read_lock (); vpd =rcu_dereference (sdkp->device->vpd_pgb1); -if (!vpd || vpd->len <8 ) { +if (!vpd || vpd->len <=8 ) {rcu_read_unlock ();return ; }
Signature · 1 line
2.46.0
Martin K. Petersen
AppliedMartin,
Quoted 4 lines
if the device returns page
0xb1with 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.
Applied to 6.12/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering