From patchwork Thu May 20 09:22:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 443211 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp2162489jac; Thu, 20 May 2021 03:38:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJYwGreNHFrDHNwuh/ZDqAmirR9OVBLSsTC1bVUzw/qiDgqFTcJacoFTt8wjNpW8ZtzY0u X-Received: by 2002:a17:906:8591:: with SMTP id v17mr4045973ejx.378.1621507130975; Thu, 20 May 2021 03:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507130; cv=none; d=google.com; s=arc-20160816; b=MNiqGJ0jGMWD1YaScNUnuEkaenRP32iQ+1dbikL9WacYYNk6mKD1JW/yvvMs48SKPY 8qWfGy/PFR0LQudMTfO+mDNYpZkQQiUXGO5gbX16FQ4O1VHG+4qPWUEbQ/jrKUJyJ+0Y R0/CS/A5p1YMTsqYf7MX+TJLPU9jiJxK6bWg/y30Hw3t6/HXDm5dPw7C3zanpbpGH8XL zJbzf/flk4QSFgP7hS7kQpYH97eLFnUHt0cdv0hv9ixfIin1MBfeI5KsOwswQ47f+kUe Zd5TsRhPbXQNSNMSu9qzqT/aCj35fQuR+mA61eo6sBYe50O5XQm4uvDWHOexefFA55oi R19w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=feHO1Z6zYVcYxgm6lyT9yx/x7tT8eQEkNBO6cl54Axo=; b=iwwCF9AjA+D2//FFfAIKwHCWsu9DKOWUC5ZgJmloauQVLL1b2NnenGsvjMJDR7rpJ1 GyN7Jdh7bSTmyLFPtOcu6yEbGxNqNIwVslSxA5XPMvkSDwqj6qZ+c38pV0HpLWN9TKDr 0Ch1v0V1AA36Yiaf3zg1RSc+9X3xvfI0iODShRs7kRBaqdHqlz+14EgxcNKHbAEvNirn ViRXXTvrm+TFX/2qWjxQOuHSrV0cT7aesv1+6Wb+HBrRJI2IzmvwOFW4F+59tGB0+e4+ HZvF5+1zXTMnHKfKqnyu5rbVIPEsrE5kbhJSXK5BBjtoK62MtJ/4OIU5HIMSXo7XSVsb Ufqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0+X7pfiQ; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t26si1865555edf.425.2021.05.20.03.38.50; Thu, 20 May 2021 03:38:50 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0+X7pfiQ; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234992AbhETKjv (ORCPT + 12 others); Thu, 20 May 2021 06:39:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:39828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237348AbhETKhi (ORCPT ); Thu, 20 May 2021 06:37:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7482F61184; Thu, 20 May 2021 09:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504470; bh=kGG51gVk4oUe1HtB/oZPpqkTAh6QD9POEA+VOCSGNPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0+X7pfiQzMmhi5VbIfpAo8f9/t4Cuc91pbt9XK6jvOgBhiK8+hHJym6k2ofzBq2IA x0EkLuz71NU9KhcK24uxExeMOo1NuwG0SBC189FRWTVIOpFiYdXfFVAJ4MysLRFmtt mo9A+uFeYmfZi6LHSJtcP52uKZeHBIHZWQdzz7HU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Bjorn Helgaas , Leon Romanovsky , Sasha Levin Subject: [PATCH 4.14 260/323] PCI: Release OF node in pci_scan_device()s error path Date: Thu, 20 May 2021 11:22:32 +0200 Message-Id: <20210520092129.119087446@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dmitry Baryshkov [ Upstream commit c99e755a4a4c165cad6effb39faffd0f3377c02d ] In pci_scan_device(), if pci_setup_device() fails for any reason, the code will not release device's of_node by calling pci_release_of_node(). Fix that by calling the release function. Fixes: 98d9f30c820d ("pci/of: Match PCI devices to OF nodes dynamically") Link: https://lore.kernel.org/r/20210124232826.1879-1-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Helgaas Reviewed-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/pci/probe.c | 1 + 1 file changed, 1 insertion(+) -- 2.30.2 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 55ece07e584a..e716d8bba227 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2014,6 +2014,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) pci_set_of_node(dev); if (pci_setup_device(dev)) { + pci_release_of_node(dev); pci_bus_put(dev->bus); kfree(dev); return NULL;