]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines
authorAndrew Vasquez <andrewv@marvell.com>
Tue, 2 Apr 2019 21:24:25 +0000 (14:24 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 23 Sep 2019 20:11:37 +0000 (21:11 +0100)
commit 5cbdae10bf11f96e30b4d14de7b08c8b490e903c upstream.

Commit e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs
code") incorrectly set 'optrom_region_size' to 'start+size', which can
overflow option-rom boundaries when 'start' is non-zero.  Continue setting
optrom_region_size to the proper adjusted value of 'size'.

Fixes: e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs code")
Signed-off-by: Andrew Vasquez <andrewv@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/scsi/qla2xxx/qla_attr.c

index 5ef9fa6c5a9172f458774c5013176954acc8ebb3..b3deae861900f2f5665fcfd9e8f81861ddff76b0 100644 (file)
@@ -423,7 +423,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
                }
 
                ha->optrom_region_start = start;
-               ha->optrom_region_size = start + size;
+               ha->optrom_region_size = size;
 
                ha->optrom_state = QLA_SREADING;
                ha->optrom_buffer = vmalloc(ha->optrom_region_size);
@@ -495,7 +495,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
                }
 
                ha->optrom_region_start = start;
-               ha->optrom_region_size = start + size;
+               ha->optrom_region_size = size;
 
                ha->optrom_state = QLA_SWRITING;
                ha->optrom_buffer = vmalloc(ha->optrom_region_size);