Blame SOURCES/0049-scsi-scsi-qla2xxx-Fix-incorrect-region-size-setting-.patch

3c6e85
From f56241674fc137af2221a52cfa31326391a41626 Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 1 Aug 2019 15:55:09 -0400
3c6e85
Subject: [PATCH 049/124] [scsi] scsi: qla2xxx: Fix incorrect region-size
3c6e85
 setting in optrom SYSFS routines
3c6e85
3c6e85
Message-id: <20190801155618.12650-50-hmadhani@redhat.com>
3c6e85
Patchwork-id: 267826
3c6e85
O-Subject: [RHEL 7.8 e-stor PATCH 049/118] scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines
3c6e85
Bugzilla: 1729270
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
3c6e85
From: Andrew Vasquez <andrewv@marvell.com>
3c6e85
3c6e85
Bugzilla 1729270
3c6e85
3c6e85
Commit e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs
3c6e85
code") incorrectly set 'optrom_region_size' to 'start+size', which can
3c6e85
overflow option-rom boundaries when 'start' is non-zero.  Continue setting
3c6e85
optrom_region_size to the proper adjusted value of 'size'.
3c6e85
3c6e85
Fixes: e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs code")
3c6e85
Cc: stable@vger.kernel.org
3c6e85
Signed-off-by: Andrew Vasquez <andrewv@marvell.com>
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3c6e85
(cherry picked from commit 5cbdae10bf11f96e30b4d14de7b08c8b490e903c)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_attr.c | 4 ++--
3c6e85
 1 file changed, 2 insertions(+), 2 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
3c6e85
index 14c19df8cb93..3903c68b4fe3 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_attr.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_attr.c
3c6e85
@@ -376,7 +376,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
3c6e85
 		}
3c6e85
 
3c6e85
 		ha->optrom_region_start = start;
3c6e85
-		ha->optrom_region_size = start + size;
3c6e85
+		ha->optrom_region_size = size;
3c6e85
 
3c6e85
 		ha->optrom_state = QLA_SREADING;
3c6e85
 		ha->optrom_buffer = vmalloc(ha->optrom_region_size);
3c6e85
@@ -449,7 +449,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
3c6e85
 		}
3c6e85
 
3c6e85
 		ha->optrom_region_start = start;
3c6e85
-		ha->optrom_region_size = start + size;
3c6e85
+		ha->optrom_region_size = size;
3c6e85
 
3c6e85
 		ha->optrom_state = QLA_SWRITING;
3c6e85
 		ha->optrom_buffer = vmalloc(ha->optrom_region_size);
3c6e85
-- 
3c6e85
2.13.6
3c6e85