From patchwork Tue Aug 15 13:58:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 9901943 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 A5AFB603FB for ; Tue, 15 Aug 2017 13:59:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94C8728822 for ; Tue, 15 Aug 2017 13:59:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 890F02883A; Tue, 15 Aug 2017 13:59:47 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 483B128828 for ; Tue, 15 Aug 2017 13:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750950AbdHON7A (ORCPT ); Tue, 15 Aug 2017 09:59:00 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33236 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750904AbdHON66 (ORCPT ); Tue, 15 Aug 2017 09:58:58 -0400 Received: by mail-pg0-f67.google.com with SMTP id u185so1632924pgb.0; Tue, 15 Aug 2017 06:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=UUYZuw5iMd4p8rtJbFaXs+Wi7vMO2gwq0Uwk/wGyQN8=; b=L4j42kjr97YMf6yAQtMuHadO86dgsr/67ifqsDk9jQEOMk5rUXvQ11GaLKRNOpHRmS R7WBs3+efsS59By5F/PYAOlCNc+ZjLp1BQC8F5WrAKAFpCquTJy4IHa/ezaeceCR4WRc jRbRMR0UOzWYuGWgifqrpayB5ts+tw2hqNriwq4z2od/aTI1zGMb88N0f1Z+FSSHeOD8 RO80inkuh2w2zIVRLJ91Y5eDLMH4My2L0zfMftsqWHEp72ej6UW1NHHIW1Gv0y3kRpqI mScuGkVqRhUkXHZYHGGSPcmKCmsLmQ8RsV4/ATkp5VDhWAMOwJNaNkAw87DpchmHt/4T qalQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=UUYZuw5iMd4p8rtJbFaXs+Wi7vMO2gwq0Uwk/wGyQN8=; b=BobnbLEVHA9hsKtyjqBS1cwAmiGmcBeJzg5CK4FxhZwyoEp+Xe0DLXB8AxrTwDtPDh Wm/1TlMsEY3J2WSdK7JSmPZj4GmFBpC/CX98+Rj88+WV9jN/7aq/nr5UTXzRL2kUNeLe qNt7JvPEXeADBObqvyZ9N70IaVFIWmUBB7CoCLdk8chKHKQAY2yBhpcxhlWcWm640sx1 d1woSP3i7s4SuKkRDn4oyY4s+68TgXPUCRnWispnZg9yVHEHYlDNe0Id66TcmZgF8o7y GrquZ5kObxaJf7tNdC0rrqpgsHDh57yuzoRWHlYF34Yu6wbHv3apnF8ImOXiRCQXNRZ7 G2nQ== X-Gm-Message-State: AHYfb5jgVvt+I5mYu3GbRbUqzZS6/lOKudH1A0Hwcpvo5vyQXwPdzwyb yRIWJHyl+nwH0w== X-Received: by 10.98.152.77 with SMTP id q74mr28303228pfd.40.1502805538335; Tue, 15 Aug 2017 06:58:58 -0700 (PDT) Received: from [192.168.86.171] (c-67-180-167-114.hsd1.ca.comcast.net. [67.180.167.114]) by smtp.googlemail.com with ESMTPSA id t3sm16464285pfb.147.2017.08.15.06.58.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Aug 2017 06:58:57 -0700 (PDT) Message-ID: <1502805534.4936.73.camel@edumazet-glaptop3.roam.corp.google.com> Subject: Re: [PATCH v11 0/5] Add new PCI_DEV_FLAGS_NO_RELAXED_ORDERING flag From: Eric Dumazet To: David Miller Cc: dingtianhong@huawei.com, leedom@chelsio.com, ashok.raj@intel.com, bhelgaas@google.com, helgaas@kernel.org, werner@chelsio.com, ganeshgr@chelsio.com, asit.k.mallick@intel.com, patrick.j.cramer@intel.com, Suravee.Suthikulpanit@amd.com, Bob.Shaw@amd.com, l.stach@pengutronix.de, amira@mellanox.com, gabriele.paoloni@huawei.com, David.Laight@aculab.com, jeffrey.t.kirsher@intel.com, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, robin.murphy@arm.com, alexander.duyck@gmail.com, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com Date: Tue, 15 Aug 2017 06:58:54 -0700 In-Reply-To: <20170814.221512.1430356980828045690.davem@davemloft.net> References: <1502767407-6812-1-git-send-email-dingtianhong@huawei.com> <20170814.221512.1430356980828045690.davem@davemloft.net> X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 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 On Mon, 2017-08-14 at 22:15 -0700, David Miller wrote: > From: Ding Tianhong > Date: Tue, 15 Aug 2017 11:23:22 +0800 > > > Some devices have problems with Transaction Layer Packets with the Relaxed > > Ordering Attribute set. This patch set adds a new PCIe Device Flag, > > PCI_DEV_FLAGS_NO_RELAXED_ORDERING, a set of PCI Quirks to catch some known > > devices with Relaxed Ordering issues, and a use of this new flag by the > > cxgb4 driver to avoid using Relaxed Ordering with problematic Root Complex > > Ports. > ... > > Series applied, thanks. I got a NULL deref in pci_find_pcie_root_port() Was it expected ? This local hack seems to fix the issue. diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index af0cc3456dc1b48b1325c06c5edd2ca8cc22a640..cfd8eb5a3d0ba8347d44952ffab28d9c761044d3 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -522,7 +522,7 @@ struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev) bridge = pci_upstream_bridge(bridge); } - if (pci_pcie_type(highest_pcie_bridge) != PCI_EXP_TYPE_ROOT_PORT) + if (highest_pcie_bridge && pci_pcie_type(highest_pcie_bridge) != PCI_EXP_TYPE_ROOT_PORT) return NULL; return highest_pcie_bridge;