From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 099A2C43461 for ; Tue, 8 Sep 2020 10:04:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9816121D6C for ; Tue, 8 Sep 2020 10:04:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bPeoqoNu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9816121D6C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=q2JDdH1kt56AxWK+GhE16ENp29nmjgAOEo/zUEPEefs=; b=bPeoqoNuFwkbbPA1chkZCB65z jSWXUIWHHM4DkUE5fbkwHzqvJj6ZHRfw2yPVp8nGv9aFyoNLwQqgx86kK9um6B0/PYQCblOa6wOZu h6a2G/Ef+XLUYU3HKWJJQHA06SftD10vGCsC5DSdbtMax8uyf0Zcgdno6YdRJV82ChtPgHo8bYhWK TY+GCJo1Nr1KwG0zY0MDzHpKFU0z+XSM5f7bXi2mxKhA1E8jBNKO5m/8NOVziFkHUONRAdqh4ANRU RfP6CH68Ve86nCjwbmV7KiFYgCt2BIdEoN5/foD1JecY3HPIs5L6o9dHWNO2+PTbyUkAGkd66n7JR PfihRAwOQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFaSf-0004rZ-F4; Tue, 08 Sep 2020 10:02:49 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFaSY-0004qZ-51 for linux-arm-kernel@lists.infradead.org; Tue, 08 Sep 2020 10:02:43 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D6C2E31B; Tue, 8 Sep 2020 03:02:38 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F03FF3F66E; Tue, 8 Sep 2020 03:02:37 -0700 (PDT) Date: Tue, 8 Sep 2020 11:02:31 +0100 From: Lorenzo Pieralisi To: linux-pci@vger.kernel.org, Bjorn Helgaas Subject: Re: [PATCH] PCI: rockchip: Fix bus checks in rockchip_pcie_valid_device() Message-ID: <20200908100231.GA22909@e121166-lin.cambridge.arm.com> References: <20200904140904.944-1-lorenzo.pieralisi@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200904140904.944-1-lorenzo.pieralisi@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_060242_279652_9D48ADA3 X-CRM114-Status: GOOD ( 24.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Dionne-Riel , Rob Herring , Shawn Lin , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Sep 04, 2020 at 03:09:04PM +0100, Lorenzo Pieralisi wrote: > The root bus checks rework in: > > commit d84c572de1a3 ("PCI: rockchip: Use pci_is_root_bus() to check if bus is root bus") > > caused a regression whereby in rockchip_pcie_valid_device() if > the bus parameter is the root bus and the dev value == 0 the > function should return 1 (ie true) without checking if the > bus->parent pointer is a root bus because that triggers a NULL > pointer dereference. > > Fix this by streamlining the root bus detection. > > Fixes: d84c572de1a3 ("PCI: rockchip: Use pci_is_root_bus() to check if bus is root bus") > Reported-by: Samuel Dionne-Riel > Signed-off-by: Lorenzo Pieralisi > Cc: Bjorn Helgaas > Cc: Rob Herring > Cc: Shawn Lin > --- > drivers/pci/controller/pcie-rockchip-host.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) Hi Bjorn, this is a fix for a patch we merged in the last merge window, can we send it for one of the upcoming -rcX please ? Thanks, Lorenzo > diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c > index 0bb2fb3e8a0b..9705059523a6 100644 > --- a/drivers/pci/controller/pcie-rockchip-host.c > +++ b/drivers/pci/controller/pcie-rockchip-host.c > @@ -71,16 +71,13 @@ static void rockchip_pcie_update_txcredit_mui(struct rockchip_pcie *rockchip) > static int rockchip_pcie_valid_device(struct rockchip_pcie *rockchip, > struct pci_bus *bus, int dev) > { > - /* access only one slot on each root port */ > - if (pci_is_root_bus(bus) && dev > 0) > - return 0; > - > /* > - * do not read more than one device on the bus directly attached > + * Access only one slot on each root port. > + * Do not read more than one device on the bus directly attached > * to RC's downstream side. > */ > - if (pci_is_root_bus(bus->parent) && dev > 0) > - return 0; > + if (pci_is_root_bus(bus) || pci_is_root_bus(bus->parent)) > + return dev == 0; > > return 1; > } > -- > 2.26.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel