diff mbox series

[07/12] qla2xxx: Prevent SysFS access when chip is down

Message ID 20190212234046.29809-8-hmadhani@marvell.com (mailing list archive)
State Superseded
Headers show
Series qla2xxx: Misc bug fixes for the driver | expand

Commit Message

Himanshu Madhani Feb. 12, 2019, 11:40 p.m. UTC
From: Quinn Tran <qtran@marvell.com>

Prevent user from sending commands through SysFS while
FW is not running or reset is in progress.

Signed-off-by: Quinn Tran <qtran@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
---
 drivers/scsi/qla2xxx/qla_attr.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index dcdfcf3bc955..c4a129d049f5 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -543,6 +543,9 @@  qla2x00_sysfs_write_vpd(struct file *filp, struct kobject *kobj,
 	if (unlikely(pci_channel_offline(ha->pdev)))
 		return 0;
 
+	if (qla2x00_chip_is_down(vha))
+		return 0;
+
 	if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->vpd_size ||
 	    !ha->isp_ops->write_nvram)
 		return 0;
@@ -993,6 +996,9 @@  qla2x00_sysfs_read_dcbx_tlv(struct file *filp, struct kobject *kobj,
 		return 0;
 	}
 
+	if (qla2x00_chip_is_down(vha))
+		return 0;
+
 	ha->dcbx_tlv = dma_alloc_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE,
 	    &ha->dcbx_tlv_dma, GFP_KERNEL);
 	if (!ha->dcbx_tlv) {