From patchwork Mon Feb 27 08:08:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ethan zhao X-Patchwork-Id: 9592817 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5C33560453 for ; Mon, 27 Feb 2017 07:56:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4110E283FB for ; Mon, 27 Feb 2017 07:56:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3513128408; Mon, 27 Feb 2017 07:56:42 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 70510283FB for ; Mon, 27 Feb 2017 07:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751550AbdB0HzC (ORCPT ); Mon, 27 Feb 2017 02:55:02 -0500 Received: from aserp1050.oracle.com ([141.146.126.70]:22241 "EHLO aserp1050.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011AbdB0Hx4 (ORCPT ); Mon, 27 Feb 2017 02:53:56 -0500 Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) by aserp1050.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1R7pHlS019584 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Feb 2017 07:51:18 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1R7o4BK002272 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Feb 2017 07:50:04 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v1R7o3UY025001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Feb 2017 07:50:03 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v1R7o3Yi000555; Mon, 27 Feb 2017 07:50:03 GMT Received: from localhost.localdomain.com (/10.182.69.73) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 26 Feb 2017 23:50:03 -0800 From: Ethan Zhao To: bhelgaas@google.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ethan.kernel@gmail.com, ethan.zhao@oracle.com, babu.moger@oracle.com Subject: [PATCH] pci: Prevent VPD access for QLogic ISP2722 Date: Mon, 27 Feb 2017 17:08:44 +0900 Message-Id: <1488182924-23334-1-git-send-email-ethan.zhao@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Source-IP: aserp1040.oracle.com [141.146.126.69] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP QLogic ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter has the VPD access issue too, while read the common pci-sysfs access interface shown as /sys/devices/pci0000:00/0000:00:03.2/0000:0b:00.0/vpd with simple 'cat' could cause system hang and panic: [ 48.219586] Kernel panic - not syncing: An NMI occurred. Depending on your system the reason for the NMI is logged in any one of the following resources: [ 48.219586] 1. Integrated Management Log (IML) [ 48.219586] 2. OA Syslog [ 48.219586] 3. OA Forward Progress Log [ 48.219586] 4. iLO Event Log [ 48.352034] CPU: 0 PID: 15070 Comm: udevadm Not tainted 4.1.12 [ 48.390989] Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS P89 12/27/2015 [ 48.431201] 0000000000000086 000000007f0cdf51 ffff880c4fa05d58 ffffffff817193de [ 48.467185] ffffffffa00b42d8 0000000000000075 ffff880c4fa05dd8 ffffffff81714072 [ 48.502631] 0000000000000008 ffff880c4fa05de8 ffff880c4fa05d88 000000007f0cdf51 [ 48.538427] Call Trace: [ 48.549991] [] dump_stack+0x63/0x81 [ 48.577496] [] panic+0xd0/0x20e [ 48.600598] [] hpwdt_pretimeout+0xdd/0xe0 [hpwdt] [ 48.630913] [] ? sched_clock+0x9/0x10 [ 48.656286] [] nmi_handle+0x91/0x170 [ 48.681362] [] ? nmi_handle+0x9c/0x170 [ 48.707383] [] io_check_error+0x1e/0xa0 [ 48.733603] [] default_do_nmi+0x99/0x140 [ 48.759570] [] do_nmi+0xf4/0x170 [ 48.782977] [] end_repeat_nmi+0x1a/0x1e [ 48.809290] [] ? pci_conf1_read+0xeb/0x120 [ 48.837782] [] ? pci_conf1_read+0xeb/0x120 [ 48.865045] [] ? pci_conf1_read+0xeb/0x120 [ 48.892877] <> [] raw_pci_read+0x23/0x40 [ 48.923060] [] pci_read+0x2c/0x30 [ 48.947340] [] pci_user_read_config_word+0x72/0x110 [ 48.978937] [] pci_vpd_pci22_wait+0x96/0x130 [ 49.007983] [] pci_vpd_pci22_read+0xdb/0x1a0 [ 49.036370] [] pci_read_vpd+0x20/0x30 [ 49.062608] [] read_vpd_attr+0x30/0x40 [ 49.088627] [] sysfs_kf_bin_read+0x47/0x70 [ 49.116383] [] kernfs_fop_read+0xae/0x180 [ 49.143396] [] __vfs_read+0x37/0x100 [ 49.169059] [] ? security_file_permission+0x84/0xa0 [ 49.200526] [] ? rw_verify_area+0x56/0xe0 [ 49.227578] [] vfs_read+0x86/0x140 [ 49.252842] [] SyS_read+0x55/0xd0 [ 49.277378] [] system_call_fastpath+0x12/0x71 [ 50.349812] Shutting down cpus with NMI [ 50.368388] Kernel Offset: disabled [ 50.385327] drm_kms_helper: panic occurred, switching back to text console So blacklist the access to its VPD. Signed-off-by: Ethan Zhao --- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 3a035e07..087a218 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -2173,6 +2173,7 @@ static void quirk_blacklist_vpd(struct pci_dev *dev) DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, quirk_blacklist_vpd); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID, quirk_blacklist_vpd); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_QLOGIC, 0x2261, quirk_blacklist_vpd); /* * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the