Blame SOURCES/0150-scsi-scsi-qla2xxx-Fix-partial-flash-write-of-MBI.patch

3c6e85
From e07773c931540bdd3668bf8210e44ffb03febfb5 Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 21 Nov 2019 16:37:00 -0500
3c6e85
Subject: [PATCH 150/155] [scsi] scsi: qla2xxx: Fix partial flash write of MBI
3c6e85
3c6e85
Message-id: <20191121163701.43688-26-hmadhani@redhat.com>
3c6e85
Patchwork-id: 287862
3c6e85
O-Subject: [RHLE 7.8 e-stor PATCH v3 25/26] scsi: qla2xxx: Fix partial flash write of MBI
3c6e85
Bugzilla: 1731581
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
RH-Acked-by: Ewan Milne <emilne@redhat.com>
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
3c6e85
From: Quinn Tran <qutran@marvell.com>
3c6e85
3c6e85
Bugzilla 1731581
3c6e85
3c6e85
For new adapters with multiple flash regions to write to, current code
3c6e85
allows FW & Boot regions to be written, while other regions are blocked via
3c6e85
sysfs. The fix is to block all flash read/write through sysfs interface.
3c6e85
3c6e85
Fixes: e81d1bcbde06 ("scsi: qla2xxx: Further limit FLASH region write access from SysFS")
3c6e85
Cc: stable@vger.kernel.org # 5.2
3c6e85
Link: https://lore.kernel.org/r/20191022193643.7076-3-hmadhani@marvell.com
3c6e85
Signed-off-by: Quinn Tran <qutran@marvell.com>
3c6e85
Signed-off-by: Girish Basrur <gbasrur@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 8d8b83f5be2a3bdac3695a94e6cb5e50bd114869)
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 | 7 +++----
3c6e85
 1 file changed, 3 insertions(+), 4 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
3c6e85
index a1fbf1af9ea0..21c18702010f 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_attr.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_attr.c
3c6e85
@@ -440,9 +440,6 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
3c6e85
 		valid = 0;
3c6e85
 		if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0)
3c6e85
 			valid = 1;
3c6e85
-		else if (start == (ha->flt_region_boot * 4) ||
3c6e85
-		    start == (ha->flt_region_fw * 4))
3c6e85
-			valid = 1;
3c6e85
 		else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha))
3c6e85
 			valid = 1;
3c6e85
 		if (!valid) {
3c6e85
@@ -489,8 +486,10 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
3c6e85
 		    "Writing flash region -- 0x%x/0x%x.\n",
3c6e85
 		    ha->optrom_region_start, ha->optrom_region_size);
3c6e85
 
3c6e85
-		ha->isp_ops->write_optrom(vha, ha->optrom_buffer,
3c6e85
+		rval = ha->isp_ops->write_optrom(vha, ha->optrom_buffer,
3c6e85
 		    ha->optrom_region_start, ha->optrom_region_size);
3c6e85
+		if (rval)
3c6e85
+			rval = -EIO;
3c6e85
 		break;
3c6e85
 	default:
3c6e85
 		rval = -EINVAL;
3c6e85
-- 
3c6e85
2.13.6
3c6e85