From patchwork Wed Aug 1 06:13:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10551741 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 650D81822 for ; Wed, 1 Aug 2018 06:13:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 559B22A662 for ; Wed, 1 Aug 2018 06:13:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A1DA2A677; Wed, 1 Aug 2018 06:13:49 +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 A7B7A2A5FC for ; Wed, 1 Aug 2018 06:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733165AbeHAH5p (ORCPT ); Wed, 1 Aug 2018 03:57:45 -0400 Received: from mail-cys01nam02on0040.outbound.protection.outlook.com ([104.47.37.40]:25600 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733143AbeHAH5o (ORCPT ); Wed, 1 Aug 2018 03:57:44 -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=7QEHONVogTFjNNhDELMUjRj0QSQSBj/dbCjirnDR8AQ=; b=iXOVS52Ym8rek2xLWv/U1/mIsnL0HfJ2FxLrtg3nqygnMnwQF9mJm2Ek9QPPVm2VZ7qOTkPYOl5kRCP5HdECp/DvWFh322AeHu0+6NmqOocc0NGCKzRTR1Pn/KQNhksDwvpL28RQn0fe3UKNYVlECVorn0NJVaM1Zpnfz06SJAs= Received: from BYAPR07CA0027.namprd07.prod.outlook.com (2603:10b6:a02:bc::40) by DM2PR07MB1467.namprd07.prod.outlook.com (2a01:111:e400:50c3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.20; Wed, 1 Aug 2018 06:13:43 +0000 Received: from BY2NAM05FT043.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::202) by BYAPR07CA0027.outlook.office365.com (2603:10b6:a02:bc::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.995.17 via Frontend Transport; Wed, 1 Aug 2018 06:13:43 +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 BY2NAM05FT043.mail.protection.outlook.com (10.152.100.180) 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; Wed, 1 Aug 2018 06:13:43 +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; Tue, 31 Jul 2018 23:13:36 -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 w716DboR028764; Tue, 31 Jul 2018 23:13:37 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w716Dbbq028763; Tue, 31 Jul 2018 23:13:37 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 05/16] qla2xxx: Prevent SysFS access when chip is down Date: Tue, 31 Jul 2018 23:13:24 -0700 Message-ID: <20180801061335.28709-6-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180801061335.28709-1-himanshu.madhani@cavium.com> References: <20180801061335.28709-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)(39850400004)(136003)(346002)(376002)(396003)(2980300002)(438002)(189003)(199004)(106466001)(81166006)(8936002)(2906002)(5660300001)(81156014)(6666003)(47776003)(1076002)(80596001)(11346002)(69596002)(575784001)(486006)(305945005)(44832011)(86362001)(87636003)(54906003)(110136005)(16586007)(316002)(42186006)(106002)(186003)(26005)(14444005)(48376002)(50226002)(51416003)(446003)(76176011)(52396003)(8676002)(50466002)(356003)(336012)(126002)(2616005)(4326008)(476003)(72206003)(36756003)(478600001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR07MB1467;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Pass;LANG:en;PTR:50-232-66-26-static.hfc.comcastbusiness.net;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;BY2NAM05FT043;1:AEg6cFpKf9eyu8aNM6pgjEPrEjnL9c674xNpsLtF2um4FRXQeXnV01L9hCg134/sBzvCpbF04XWV4RIn+BDCprbzLkNOu9buyUHV1aneJGrVi8uRM0Qeohx59dqURQOF X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e8a8b89-b560-406a-7d4e-08d5f775eece X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060);SRVR:DM2PR07MB1467; X-Microsoft-Exchange-Diagnostics: 1;DM2PR07MB1467;3:wTTa+0HJeFk+f91+ofi7S4dxatcCJ/YJ+y2hLVmnNLAAoM/LVDZ9JSIuV13d1gNxPnlxDmCURFBIq/+SEMabcwKHozUbxH1YbCMlbmyy0H5UioCxSSelYNg8rp7wDd+rrJK9ZwN9QizSovQU2ZhGm9ch6RTkm3ilqJhGmQdOL76lfRGLEIbSzV4QW8EnWonrBkSRfTtW2Jgds7PT/JrZ0E6S3bKf7HaW7Kjd/G00K62Wusd5Pl1py+7b1a+wnVVUNmuJpYnIS1k5fEZ6stqK90XFCl6MwkgX/v1rFtEmwlj484TE2mSxC7FezmJ2z1QQufPaY0N0WqyHhGST+ctX7gGpSpWrYl5fS2P9fS5AB7c=;25:kwQNqgXzwNYufe35dFIXida/aMQ2h/hprLTmMaUoV6d1rU3mM1l5ph+tdbGWvwrb6k00yGbfLDvufbx+CQR4tIbyMqCG4pwDEgXnUy0ggXbQcRAL61oU0sximuuuQ+m9RIAcdE53lC3QrbODVbWayLntx6csqXiMy36icduRWkqtG4rGv2F64Jt8b0K7tUqKeZPSYkdZgGRICHXrzDl4RxsMUEfRzKGm88q2JAOyfCKISw7qEg467UmFuCwXvRFr6FxPktJed/lR0db9xSGSTLPXP7UEF1p1seYHTnE1rYsVew/+yNA33/a7f55nmdBZloXARCMYp1Tsv3fKMWewfg== X-MS-TrafficTypeDiagnostic: DM2PR07MB1467: X-Microsoft-Exchange-Diagnostics: 1;DM2PR07MB1467;31:CiJuI9L8UXQvR2/1FCtxXAC3L8m0xP14pFo9L5MBif9qv9bEIG88s5qLxWQwe+f2/S3Rp/0jURSaVazcxe2vh8YzFvn/eN+IG3n0l3lo+JHdVx/fdaIxdLyYhJc9dDpiuQmpj/Nua7u24ZRqGrj5xBWo/KzNDCXhZm+PLVu+FzoYSY5ysLshB9ja6w0xGJtoqp1LBwZqU8gKu+sVkecYF/bNvnx16CAtIPp9BvpWch0=;20:iR70FSUbSaDuUZWfrVkk2Jypb2YUmMSWjZHr2wGlDAFqSbelcDmfPsFwztPlaw4th0iKC/s6Z4boNfqw+v4+osX5fL8sRDX9uxrLF93ShvfIzsOQaBlKtKyuhGyYYq2ucLGtxS6ghsT2xMR8eW+5SMJesaIciGjRB+/UJMloljm+Y8Ybo8wp6XlHjWcDIljkUaVc+ylQrizsJL4rZhnxhluJgPELsvKjZ+KQeDOTga66lSpII184PEyZimJF66LWWoMp5JSKL4a+OH4JLRJDqIYln0/s7Yqksl7i2fKH1AysgvOoWhWqGSh1NWyu8AizHpgaz9gd1cFOe5BbHNkn5T3Llu0+5bT2YrgDjGDnTn5O5vluWz/VmbbhCA08gzt1hXVWG53ahzPs5mDatILOTMYUTGXZREHF0+sgeiLqRUkr2x/fhh7Fd8mod3RgSo1AyHJqMAL4mVoRNRs6cjAsni4m6OpU0vPzCf01P/V6T3KEAcluwWGQY+KZPCqg4md4 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)(3231311)(944501410)(52105095)(93006095)(93004095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:DM2PR07MB1467;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB1467; X-Microsoft-Exchange-Diagnostics: 1;DM2PR07MB1467;4:Vk4dnJDGOmpjUvdRn/1N7KYMNqbBafC89MDQra8UWZ6Pmy7+JG79GbwVVv8ATV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OKgBlM2RqWxbHPiVB67yUVNuPdnEQkXCq0r7R8iK53UTj58BTtsE5aqYpjNtCt1KTUT0zLSc1hrHi5bHGNIvmJPzDw7Hn0u2ZDx2B6RB6MIua7L+oMe46z7e6RT04SKipbjJSZUSjRP2YiRFd++E/zMecIn/g0s+jPMmexz512JmbsA6tJpXV8bew/wJDN4CsTAxo/EtpgLnpiNpUhus0pWRneJzZ9a52A==;5:HURbWZ4VtvcViXEhIParcRbCLwhq70wB4CrG5WbjJTglN2vM/rZbNAQeiCjtPmpZt9H/6NCyrJjoornvZ9NBhTWG87Q0b4u4UclhovcPdT3RWtngl0ZINNkxe8EJ0Yf5A982QOkRg/Y4/dBa17+Q6JgIDzsUHblWk2hFKyjqkHM=;7:ZPCCKKtO4F2jmTlS3EARS5VB8F2/EsNtqHhlRegGu0+TMFD994qi/7nd9lC0xQSYJAwMmGB/hosiPQ/57JjwwJCpXNi684hancrfszsIi27LSzS7ANsxFogzgbux7O12A4wcSuzv7Ju328CH/AR4voxCQGZkRMOEU+8XmgdapooDWjao42egCw9kteIh4NzUx/B1CzB12ZzHRpf3cZXH0JUaW8IXkYSSZk1RVSo4nHyjI5r6eV3woEcWKfP63RD1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2018 06:13:43.0506 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e8a8b89-b560-406a-7d4e-08d5f775eece 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: DM2PR07MB1467 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 848ffd602e0b..79738294b069 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -7016,7 +7016,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) {