Commit d5337683 authored by Andrew Vasquez's avatar Andrew Vasquez Committed by Khalid Elmously

scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines

BugLink: https://bugs.launchpad.net/bugs/1830176

commit 5cbdae10 upstream.

Commit e6f77540 ("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: e6f77540 ("scsi: qla2xxx: Fix an integer overflow in sysfs code")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarAndrew Vasquez <andrewv@marvell.com>
Signed-off-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent f4a5805c
...@@ -431,7 +431,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, ...@@ -431,7 +431,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
} }
ha->optrom_region_start = start; ha->optrom_region_start = start;
ha->optrom_region_size = start + size; ha->optrom_region_size = size;
ha->optrom_state = QLA_SREADING; ha->optrom_state = QLA_SREADING;
ha->optrom_buffer = vmalloc(ha->optrom_region_size); ha->optrom_buffer = vmalloc(ha->optrom_region_size);
...@@ -504,7 +504,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, ...@@ -504,7 +504,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
} }
ha->optrom_region_start = start; ha->optrom_region_start = start;
ha->optrom_region_size = start + size; ha->optrom_region_size = size;
ha->optrom_state = QLA_SWRITING; ha->optrom_state = QLA_SWRITING;
ha->optrom_buffer = vmalloc(ha->optrom_region_size); ha->optrom_buffer = vmalloc(ha->optrom_region_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment