Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 568c7c4

Browse files
mwilckgregkh
authored andcommitted
scsi: sd: Fix off-by-one error in sd_read_block_characteristics()
commit f81eaf0 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: 7fb019c ("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>
1 parent facf1e4 commit 568c7c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/sd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3118,7 +3118,7 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
31183118
rcu_read_lock();
31193119
vpd = rcu_dereference(sdkp->device->vpd_pgb1);
31203120

3121-
if (!vpd || vpd->len < 8) {
3121+
if (!vpd || vpd->len <= 8) {
31223122
rcu_read_unlock();
31233123
return;
31243124
}

0 commit comments

Comments
 (0)