Skip to content

Commit f81eaf0

Browse files
mwilckmartinkpetersen
authored andcommitted
scsi: sd: Fix off-by-one error in sd_read_block_characteristics()
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: 7fb019c ("scsi: sd: Switch to using scsi_device VPD pages") Cc: [email protected] Signed-off-by: Martin Wilck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent a141c17 commit f81eaf0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3402,7 +3402,7 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp,
34023402
rcu_read_lock();
34033403
vpd = rcu_dereference(sdkp->device->vpd_pgb1);
34043404

3405-
if (!vpd || vpd->len < 8) {
3405+
if (!vpd || vpd->len <= 8) {
34063406
rcu_read_unlock();
34073407
return;
34083408
}

0 commit comments

Comments
 (0)