From: Quinn Tran Date: Fri, 15 Feb 2019 22:37:18 +0000 (-0800) Subject: scsi: qla2xxx: Prevent SysFS access when chip is down X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b726d99d72fd4b36ae82efb35d0073b0c9441205;p=linux.git scsi: qla2xxx: Prevent SysFS access when chip is down Prevent user from sending commands through sysfs while FW is not running or reset is in progress. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index ee9f943f4d079..f8fd482a06e0c 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;