Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933629AbdCHCTo (ORCPT ); Tue, 7 Mar 2017 21:19:44 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:34832 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933562AbdCHCTn (ORCPT ); Tue, 7 Mar 2017 21:19:43 -0500 Subject: Re: [PATCH] pci: Prevent VPD access for QLogic ISP2722 To: Bjorn Helgaas References: <1488182924-23334-1-git-send-email-ethan.zhao@oracle.com> <20170307202217.GG21358@bhelgaas-glaptop.roam.corp.google.com> Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ethan.kernel@gmail.com, babu.moger@oracle.com From: Ethan Zhao Organization: Oracle Corporation Message-ID: <58BF6A4B.6010103@oracle.com> Date: Wed, 8 Mar 2017 10:19:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20170307202217.GG21358@bhelgaas-glaptop.roam.corp.google.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4200 Lines: 85 On 2017/3/8 4:22, Bjorn Helgaas wrote: > On Mon, Feb 27, 2017 at 05:08:44PM +0900, Ethan Zhao wrote: >> 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 > Applied to for-linus for v4.11, thanks! > > I added a stable tag for v4.6+ because quirk_blacklist_vpd() was added > by 7c20078a8197 ("PCI: Prevent VPD access for buggy devices"), which > appeared in v4.6. Nice ! Thanks again. Ethan >> --- >> 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 >> -- >> 1.8.3.1 >>