From patchwork Fri Feb 15 22:37:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10816071 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 B9C1D17E0 for ; Fri, 15 Feb 2019 22:39:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A44FE2FD5E for ; Fri, 15 Feb 2019 22:39:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98A272FDAC; Fri, 15 Feb 2019 22:39:24 +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,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 412132FD5E for ; Fri, 15 Feb 2019 22:39:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392967AbfBOWjY (ORCPT ); Fri, 15 Feb 2019 17:39:24 -0500 Received: from mail-eopbgr770042.outbound.protection.outlook.com ([40.107.77.42]:61133 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2392956AbfBOWjX (ORCPT ); Fri, 15 Feb 2019 17:39:23 -0500 Received: from DM6PR07CA0026.namprd07.prod.outlook.com (2603:10b6:5:94::39) by BL0PR07MB5457.namprd07.prod.outlook.com (2603:10b6:208:37::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Fri, 15 Feb 2019 22:38:49 +0000 Received: from BY2NAM05FT019.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::207) by DM6PR07CA0026.outlook.office365.com (2603:10b6:5:94::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1622.16 via Frontend Transport; Fri, 15 Feb 2019 22:38:49 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT019.mail.protection.outlook.com (10.152.100.156) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1580.2 via Frontend Transport; Fri, 15 Feb 2019 22:38:48 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Fri, 15 Feb 2019 14:37:46 -0800 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 x1FMbjkQ025503; Fri, 15 Feb 2019 14:37:45 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x1FMbj4t025502; Fri, 15 Feb 2019 14:37:45 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v3 07/11] qla2xxx: Prevent SysFS access when chip is down Date: Fri, 15 Feb 2019 14:37:18 -0800 Message-ID: <20190215223722.25439-8-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190215223722.25439-1-hmadhani@marvell.com> References: <20190215223722.25439-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131947439291420298;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(346002)(136003)(39860400002)(376002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(446003)(126002)(2906002)(2616005)(305945005)(86362001)(8936002)(476003)(105606002)(50466002)(76176011)(51416003)(356004)(47776003)(11346002)(1076003)(4326008)(48376002)(6666004)(80596001)(110136005)(54906003)(4744005)(87636003)(42186006)(53936002)(316002)(97736004)(16586007)(36756003)(498600001)(69596002)(81156014)(486006)(106466001)(68736007)(81166006)(50226002)(85426001)(36906005)(26826003)(336012)(8676002)(26005)(5660300002);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR07MB5457;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 502711b5-c2b6-4234-476f-08d693965a72 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600110)(711020)(4605077)(2017052603328);SRVR:BL0PR07MB5457; X-MS-TrafficTypeDiagnostic: BL0PR07MB5457: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09497C15EB X-Microsoft-Exchange-Diagnostics: 1;BL0PR07MB5457;23:x2wSpnvFoezZEKkWBZ/BdV4RDU6BoE378Lv1MqnPQwStlnhDO/9p1pxSkcxPVYi+G/ayi3fYEzYWqLWqhkOJyVD4kikqfIFkYU2GH8H1Ww8p2MLuJPBjXsIHPrld3AWQxWSoaVidG/o+Iy8ezw8YFxDGQDhsU6Yia7gp6TiTO1Gnr0ofgK4lxNnqxLkUsv+ikdAcs4KtbG4eXg91xt57+5hP4NyjB5yCC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yWyAjhq2nURjl/yW7F46jQnZ+jHvEn8ckJO/HOSJQxibP+MGEI/PZeoOxIj6WE8yY3w7vz8fb49vig0FvqLepy55rgI2jckvoo9tyKXLxPa5pXRz5zPzVJhOURgcfvc1iaNdZHzwC28E4/jMbeQVNBKQJ6LYlA5LhEEbEKGWKYrUQfXtNZOlNNOY3XMgGBM20GdGA2YS0/D1uLNe1YlZ7KQZ1Q6bUc/3k0aF9GR/ZswW8YJPy9nD41yDhPEVdiKmdin89jFmqeRpDuA3nZvfWOTtIiIcW3LO70OERzeEaevgp34811N2m0r9eTaZWcF6hzUsUGRRBoWNJru4M7QjYRXaCtUS5R85MtdYymcQE4jLekE0dwAFBM1PSpAQvZyPjKhojIl8Md7wElZpZPcQ+kvVA4/s= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2019 22:38:48.8798 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 502711b5-c2b6-4234-476f-08d693965a72 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR07MB5457 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index ee9f943f4d07..f8fd482a06e0 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;