Skip to content

Commit

Permalink
scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS rout…
Browse files Browse the repository at this point in the history
…ines

Commit e6f7754 ("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: e6f7754 ("scsi: qla2xxx: Fix an integer overflow in sysfs code")
Cc: stable@vger.kernel.org
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>
  • Loading branch information
Andrew Vasquez authored and Martin K. Petersen committed Apr 4, 2019
1 parent 5da05a2 commit 5cbdae1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/scsi/qla2xxx/qla_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,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);
Expand Down Expand Up @@ -449,7 +449,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);
Expand Down

0 comments on commit 5cbdae1

Please sign in to comment.