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=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 3B561C433E0 for ; Thu, 9 Jul 2020 16:12:01 +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 048A12078B for ; Thu, 9 Jul 2020 16:12:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KcHdMODR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 048A12078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=6EqS3dkkqp9t2fDh6G7/MsPZkthWtBxZlJD/2FuLhao=; b=KcHdMODRP+fhhszEW2fL6FoH9K LuQ/UUf2uBjD/4tUSjc3TMP/K87z5zFk275llGlZPHeaf8qYY/BwIvDwLGq6F0mkBSO5YrYi11TJp H4j15LHhhSC9sLr2LHAhVDViycQY/Csk201+ksN5MDg3eWxTGVsFathMYihc9sVh22/jLJxjDl4bL TZVyxrGeGtkzxni+jdXwUlRbjftTbu6BqMdmMM9R8U5tOw5Wcp9zcDWb/IFBYCf4WfOm3MjPjs5Eo tBX6XrKuhNYww3aFXTaG5Seitptkp87Osshb4No78Z4nDK9ujE6ihPZ3NARkNuJLdK/637nyCkFYG Lx6wfPWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtZ7g-0002uX-Pu; Thu, 09 Jul 2020 16:10:08 +0000 Received: from mail-io1-f65.google.com ([209.85.166.65]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtZ7e-0002tx-LQ for linux-arm-kernel@lists.infradead.org; Thu, 09 Jul 2020 16:10:07 +0000 Received: by mail-io1-f65.google.com with SMTP id k23so2864562iom.10 for ; Thu, 09 Jul 2020 09:10:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0jV5Q2BcP9CMI/8a5AeORE3bGcjhTMGqCxpwCuMOewE=; b=hrh5bo2cj4dFmfutM01k3ReYa5w9WLXl28Iwi0VLFy4M3OK3CNo5uMy414a5E6CrZy UrgVCmRWZlNshXKs6Y/pB95PdervJzd+bZkO7OjGGSHcJS1iHK1/nGoQ95G0czbZIrNb bcH2sB7/Ya9Hn71/72xFXfOr2tYRCQ1SMvcMrsRw9YWOJTJiAMb052DMKf3cMq5EyC/d m//De0OStkWY0vvs4LpNF8LxqKf4wTbzCpzEiPAFt8Z6XZzQTrNE7i8C+BtYys7nHW65 MKmBanPPsOmOtm8NtqVJPsYJ/ZgYedIjYoCriSxwi87zbNajhkwIg9usnSH2VnPCZDU1 oQDg== X-Gm-Message-State: AOAM530384MNXVccugeoeSG+Z2C8iGaNGXQX9/oCDHCCv3U/DG3sJOTa FVJNa696iXmq/pkMagabKw== X-Google-Smtp-Source: ABdhPJxOxcxWHIXwKodn/2E2bz39ppKYVPjV0S5kIpCKTdM6mYDLe1vnSajLjkbX188DWocHGh/Qyw== X-Received: by 2002:a05:6602:15ca:: with SMTP id f10mr43795236iow.52.1594311003988; Thu, 09 Jul 2020 09:10:03 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.254]) by smtp.googlemail.com with ESMTPSA id t74sm2238925ild.6.2020.07.09.09.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 09:10:03 -0700 (PDT) From: Rob Herring To: linux-pci@vger.kernel.org Subject: [PATCH] PCI: host-common: Fix driver remove NULL bridge->bus dereference Date: Thu, 9 Jul 2020 10:10:02 -0600 Message-Id: <20200709161002.439699-1-robh@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200709_121006_751453_A4C10E57 X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. 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: Bjorn Helgaas , Will Deacon , Lorenzo Pieralisi , Anders Roxell , 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 Commit 2d716c37b5ce ("PCI: host-common: Use struct pci_host_bridge.windows list directly") moved platform_set_drvdata() before pci_host_probe() which results in the bridge->bus pointer being NULL. Let's change the drvdata to the bridge struct instead to fix this. Fixes: 2d716c37b5ce ("PCI: host-common: Use struct pci_host_bridge.windows list directly") Reported-by: Anders Roxell Cc: Will Deacon Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Signed-off-by: Rob Herring --- drivers/pci/controller/pci-host-common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c index f8f71d99e427..b76e55f495e4 100644 --- a/drivers/pci/controller/pci-host-common.c +++ b/drivers/pci/controller/pci-host-common.c @@ -83,7 +83,7 @@ int pci_host_common_probe(struct platform_device *pdev) bridge->map_irq = of_irq_parse_and_map_pci; bridge->swizzle_irq = pci_common_swizzle; - platform_set_drvdata(pdev, bridge->bus); + platform_set_drvdata(pdev, bridge); return pci_host_probe(bridge); } @@ -91,11 +91,11 @@ EXPORT_SYMBOL_GPL(pci_host_common_probe); int pci_host_common_remove(struct platform_device *pdev) { - struct pci_bus *bus = platform_get_drvdata(pdev); + struct pci_host_bridge *bridge = platform_get_drvdata(pdev); pci_lock_rescan_remove(); - pci_stop_root_bus(bus); - pci_remove_root_bus(bus); + pci_stop_root_bus(bridge->bus); + pci_remove_root_bus(bridge->bus); pci_unlock_rescan_remove(); return 0; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel