From patchwork Thu Aug 2 20:16:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10554157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A23A157D for ; Thu, 2 Aug 2018 20:17:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44A5A2C444 for ; Thu, 2 Aug 2018 20:17:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38B162C459; Thu, 2 Aug 2018 20:17:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9785D2C444 for ; Thu, 2 Aug 2018 20:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727684AbeHBWJv (ORCPT ); Thu, 2 Aug 2018 18:09:51 -0400 Received: from mail-eopbgr720055.outbound.protection.outlook.com ([40.107.72.55]:35712 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727362AbeHBWJv (ORCPT ); Thu, 2 Aug 2018 18:09:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0GzZZEWAfoMBsSn5tPeOC6b6Wngai9gQdolOe52O0xM=; b=QXRF30q5KUjmfP56BW+/4l5HcIJDKF0FIBEUDe4BwHnbBKRB823qthL1j5W40XQ9X7Qq9H793kETH51FH+8Yxa3A5n9B4TLUbOyk0XeStZg6/KWMbgoDjLYbZMm9WIICaMW3fRgDTX+cuoYPPl+TE/l6J35tYByjnONv0GaV+2E= Received: from BYAPR07CA0016.namprd07.prod.outlook.com (2603:10b6:a02:bc::29) by DM2PR0701MB1390.namprd07.prod.outlook.com (2a01:111:e400:5119::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.19; Thu, 2 Aug 2018 20:17:07 +0000 Received: from BY2NAM05FT024.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::201) by BYAPR07CA0016.outlook.office365.com (2603:10b6:a02:bc::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1017.15 via Frontend Transport; Thu, 2 Aug 2018 20:17:06 +0000 Authentication-Results: spf=pass (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BY2NAM05FT024.mail.protection.outlook.com (10.152.100.161) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.1038.3 via Frontend Transport; Thu, 2 Aug 2018 20:17:06 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Thu, 2 Aug 2018 13:17:00 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id w72KGx5a007958; Thu, 2 Aug 2018 13:16:59 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w72KGxov007957; Thu, 2 Aug 2018 13:16:59 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v3 05/16] qla2xxx: Prevent SysFS access when chip is down Date: Thu, 2 Aug 2018 13:16:47 -0700 Message-ID: <20180802201658.7903-6-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180802201658.7903-1-himanshu.madhani@cavium.com> References: <20180802201658.7903-1-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(346002)(396003)(136003)(376002)(2980300002)(438002)(199004)(189003)(81166006)(316002)(305945005)(356003)(86362001)(81156014)(47776003)(72206003)(54906003)(110136005)(106002)(50226002)(16586007)(4326008)(6666003)(478600001)(106466001)(8676002)(44832011)(36756003)(8936002)(51416003)(186003)(126002)(476003)(336012)(87636003)(50466002)(5660300001)(1076002)(48376002)(14444005)(486006)(2616005)(76176011)(42186006)(26005)(2906002)(69596002)(11346002)(80596001)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR0701MB1390;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Pass;LANG:en;PTR:50-232-66-26-static.hfc.comcastbusiness.net;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BY2NAM05FT024;1:QU6ATPAWcPEviyZ/EIjCqZ0M2yV9TQfr2qGEjZzzaNWCA4Z7rj5GddeFVK9SNesijUUNbYHVc46XTu0qJYXhtO13SltVGneV263OxyG2hRWpO/R/m21fPoOnM8YHxYHB X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6e446b0b-debf-4d44-d894-08d5f8b4eb4e X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM2PR0701MB1390; X-Microsoft-Exchange-Diagnostics: 1;DM2PR0701MB1390;3:DNBvzY4gWMuQZ7YgHz2QfCuJnBkvcpzIeXre/JfhdYBqL8PV+O5M3PGAcdT5J0UM/fAD/g/OscKo+yvSU6ISTSm5eMvI3aC5sCLqxrJIecPShQWC60++Q7O3gVlXCOtYLYVuztsUxyQCrg5XoZS8SyEnYCC95004CzDhaqmOxtsc0tpN2WQ6wFFNUO9MelyRGB4v2gBfnHv5/64HdwvBbJ48S5vikfxt9YXLnwhnlHTtDd3zh3qRzIeA+a3ChYN5d+tlNdMD74Eb/g2yFcwEIPzI4coEr58GHiQ98fYmflgIxuyaqLdt9n1KOYBc00ON2c+1aKK7/IiSrhfKaKFOjO4sjGdPTYz+KOfHOsq0z1I=;25:qALuVuTXdiDZu7EuqVpha9Fxkml+KL3+JRNRw8iiV+YwUPiLMvvku2djnaHTl1GNA3Q8HeVo8aLY83LzPgVtEwXO0cVi0ATXOXipm2+SC3izJK/+PV9HJlHoZmn8VDXpdgYHKEsTOH0wY+GMUi7nrS5L3+7N6jxtAIYB/Sxot+TFKG1W5NoY6GxvA61OeMoWWjzxxyKQefQqaLzCqdI1kka5XpcIkluDSZd4r1ltEt7hxHY8ROlgjfB9MswJgAnp6YF90fV8tj4w/f44ByTIX7rW/G8di/DgIeFHYvc2/9bJA++6ZJzhnffCpTCyvyt3LOliSLzu5pkXF5njfRIH2w== X-MS-TrafficTypeDiagnostic: DM2PR0701MB1390: X-Microsoft-Exchange-Diagnostics: 1;DM2PR0701MB1390;31:4QhGczfPLwNmDtzxtXBEF3pwxZKrVoEtCQRSL+XYIoo2WrWzjC8v0MY8nSdeUK6X9vPTcyVSq9ZNBtk2bsMnFXVj3CtvKF19c+LXeWJNXJGtTxYVzBba/m9U/CVd+Sqgh6c59NxX4LZUYDDyKE4lN+/vJ9NnbudnEgtVBGu7saZKHykiPXK4WVJFPH+XkOPpOhA/N7yaldmtS1w7l5Hitdyt4fDeSYOG+b+rwoClWKY=;20:U/JV7Yd3G4QtLCOvDJT/6JttQixxYj8OIkrFAQdvUZUAOm68HuxXvQpHXnQR/uHoohMoSH9XJrpbye/DQmIbcgV9bWreNyjmNHu4e5v2Kv5LYRoS0GOpalGOYrq4M83P3aJKcRg29NCj2I+V+TDqoBWZaCWalkp1tWw1GsGJeAADtK0rZzDvFfnCrBnDYbDor87ujEjkvR16clLjlBBVxHOzsT++ShUcFIkB9x8Bi/1btjG//SZfnn1F+4pdvq5Fv6lKrid1C1XtPDLok6Gzzz/LNbUt0gkebyDwg+tecU6NGJGPrw0zVDcF3pfV5FXDdCYf+PjmzueFE7rnnIns1A4O+cT3wCXmI1fHIe0tVnbYbrfRNjQ3a7yHm0O3udkCu1wivbqCDg3c5yAIRxUMmvRuRp+6/3gWFMN3dNCt+IfgT0/d6W7UFpvEM4UKPIRa0FyfW7trSVlu5YcSWtxX4yKe7pspHg/usjwCz1vygwZzWmOHK9Jqg7wMlRaYW7hw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93004095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:DM2PR0701MB1390;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0701MB1390; X-Microsoft-Exchange-Diagnostics: 1;DM2PR0701MB1390;4:AfZZ0oTKzsaDAbUPdyM73CPeBaSjt4//pkdDNfUfMtxNnb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i9A7fS5VzZVwpBqwtBqHaqbM6U0MEMQ22o95Ycv37rsK/qms14vwKJkeNOuZrKmDotZBE1wHLNMWSQaoC00Z+Xt1bls01nssDbpc1kBvRyeBHIPiKLR9O7LXqes8vDW8/5h7b36QoF+RScmu0f8fgY2dRpSwNR7cMudW1N2ug==;5:Or98Y6cjWLwzfM+Eox9De9tdixyu81dmztrVLzdgTlWaRHG7xOn/d4SmlhOtu3MjUoHibuJRCNWfkVb7QiITUWLgHFu8zdvVHQ3F4fQyW9p3BJ+6LQ/C05B7MBq/4d7bPZZVolB5mExLw6qcRmfVqf2B8CPVLVK5iykDwOJUxrg=;7:+DxjyMuj75/UKLDTRrD3UgPt00iVKWGj/xYunPzNWq8ptS1HGXeQ71imqUNg+HkI/B1nmBgR+vvD3q+cxOPKVf2mL0M00cxjgcNejeg/2xboS2gCczWGAw3nNVwdo0eB7beugQNAIAyN5aOcPdkHdlLhruf2JR7rLAFP5NRM8tMuctPcf37Si5QJHf4WwBurtL3xa4ao6tcnGAq9h0qZ/4ubm/MnQCBVJ0tcS+wDoFAeH93RvRyiFezYLEggsRf1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2018 20:17:06.6220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e446b0b-debf-4d44-d894-08d5f8b4eb4e X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194;Ip=[50.232.66.26];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0701MB1390 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran 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 --- drivers/scsi/qla2xxx/qla_attr.c | 33 +++++++++++++++++++++++++++------ drivers/scsi/qla2xxx/qla_init.c | 2 +- drivers/scsi/qla2xxx/qla_inline.h | 6 ++++++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 89a4999fa631..cc04caf83bd3 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -518,6 +518,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; @@ -570,7 +573,7 @@ qla2x00_sysfs_read_sfp(struct file *filp, struct kobject *kobj, if (!capable(CAP_SYS_ADMIN) || off != 0 || count < SFP_DEV_SIZE) return 0; - if (qla2x00_reset_active(vha)) + if (qla2x00_chip_is_down(vha)) return 0; rval = qla2x00_read_sfp_dev(vha, buf, count); @@ -733,6 +736,15 @@ qla2x00_issue_logo(struct file *filp, struct kobject *kobj, int type; port_id_t did; + if (!capable(CAP_SYS_ADMIN)) + return 0; + + if (unlikely(pci_channel_offline(vha->hw->pdev))) + return 0; + + if (qla2x00_chip_is_down(vha)) + return 0; + type = simple_strtol(buf, NULL, 10); did.b.domain = (type & 0x00ff0000) >> 16; @@ -771,6 +783,12 @@ qla2x00_sysfs_read_xgmac_stats(struct file *filp, struct kobject *kobj, if (!capable(CAP_SYS_ADMIN) || off != 0 || count > XGMAC_DATA_SIZE) return 0; + if (unlikely(pci_channel_offline(ha->pdev))) + return 0; + + if (qla2x00_chip_is_down(vha)) + return 0; + if (ha->xgmac_data) goto do_read; @@ -825,6 +843,9 @@ qla2x00_sysfs_read_dcbx_tlv(struct file *filp, struct kobject *kobj, if (ha->dcbx_tlv) goto do_read; + 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) { @@ -1036,7 +1057,7 @@ qla2x00_link_state_show(struct device *dev, struct device_attribute *attr, vha->device_flags & DFLG_NO_CABLE) len = scnprintf(buf, PAGE_SIZE, "Link Down\n"); else if (atomic_read(&vha->loop_state) != LOOP_READY || - qla2x00_reset_active(vha)) + qla2x00_chip_is_down(vha)) len = scnprintf(buf, PAGE_SIZE, "Unknown Link State\n"); else { len = scnprintf(buf, PAGE_SIZE, "Link Up - "); @@ -1163,7 +1184,7 @@ qla2x00_beacon_store(struct device *dev, struct device_attribute *attr, if (IS_QLA2100(ha) || IS_QLA2200(ha)) return -EPERM; - if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) { + if (qla2x00_chip_is_down(vha)) { ql_log(ql_log_warn, vha, 0x707a, "Abort ISP active -- ignoring beacon request.\n"); return -EBUSY; @@ -1350,7 +1371,7 @@ qla2x00_thermal_temp_show(struct device *dev, scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); uint16_t temp = 0; - if (qla2x00_reset_active(vha)) { + if (qla2x00_chip_is_down(vha)) { ql_log(ql_log_warn, vha, 0x70dc, "ISP reset active.\n"); goto done; } @@ -1381,7 +1402,7 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr, return scnprintf(buf, PAGE_SIZE, "0x%x\n", pstate); } - if (qla2x00_reset_active(vha)) + if (qla2x00_chip_is_down(vha)) ql_log(ql_log_warn, vha, 0x707c, "ISP reset active.\n"); else if (!vha->hw->flags.eeh_busy) @@ -1840,7 +1861,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) if (unlikely(pci_channel_offline(ha->pdev))) goto done; - if (qla2x00_reset_active(vha)) + if (qla2x00_chip_is_down(vha)) goto done; stats = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*stats), diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index aea264100673..740403510779 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -7017,7 +7017,7 @@ uint8_t qla27xx_find_valid_image(struct scsi_qla_host *vha) ha->active_image = QLA27XX_SECONDARY_IMAGE; } - ql_dbg(ql_dbg_init, vha, 0x018f, "%s image\n", + ql_dbg(ql_dbg_init + ql_dbg_verbose, vha, 0x018f, "%s image\n", ha->active_image == 0 ? "default bootld and fw" : ha->active_image == 1 ? "primary" : ha->active_image == 2 ? "secondary" : diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index bcbdf28bd7b9..acf6511e8ef7 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -202,6 +202,12 @@ qla2x00_reset_active(scsi_qla_host_t *vha) test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); } +static inline int +qla2x00_chip_is_down(scsi_qla_host_t *vha) +{ + return (qla2x00_reset_active(vha) || !vha->hw->flags.fw_started); +} + static inline srb_t * qla2xxx_get_qpair_sp(struct qla_qpair *qpair, fc_port_t *fcport, gfp_t flag) {