mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-06 17:35:20 +02:00
scsi: sd: Fix off-by-one error in sd_read_block_characteristics()
commitf81eaf0838
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:7fb019c46e
("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>
This commit is contained in:
parent
facf1e49a0
commit
568c7c4c77
|
@ -3118,7 +3118,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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user