Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp460427pxj; Thu, 20 May 2021 13:29:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUUEauqtOmRkqhjTwStJgioS1bivIwsvA4esA7EYzo4U2lMTByu35ycYCpX1/1Ic0xYGkH X-Received: by 2002:a05:6602:3427:: with SMTP id n39mr7735452ioz.157.1621542549961; Thu, 20 May 2021 13:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621542549; cv=none; d=google.com; s=arc-20160816; b=KZwnfGu8RTepyAqSyaPz2VsiDVQCUEFOR5OJdaR4LXLi5HGioQvLswqiX2qY0B2j1W spSBdPUsk1UrMB7evnVQnJkVSuiha4jx8zp+LnR4DrGpPJ++riAS5fO3RapcB0xrTfcX 3axgtqG3zycVKg7jfojJUkg8Wjn9GNs095EUrH1QSnx/8ya6ewtx2nvApWqKHo6mNRln 9aIUlOxeTUKrPmkW7MshFqOyu8PRXnaedva8mIEnYRCRQyZK7J66pi0nJa6lzbqt7FY+ Zs5J1IJ4CFFGMxJsqhk3CTR6GKDVENXoQqTKLpXis2Y5kdf1Gn6ztqoxOgp6W0Q4tbqv JA6g== 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=SZsAZ8n+h5CcmEOiVmVJ0txMNBZwXucYHFd/SVPPJqBRs0hSvnBemNUvC3MKeu3/gi TI4HCrB6uVe9VwyAWSoCGc7RAcrBEHljKzihBB0Ih7MiDhL1kULDgem71DA9MPee6vDD hBvThK+LmW2Ar8f3g3Pkj7AmrUKQ7JlhS6ieXWd2dqe6r3nM2Ahh84HwHpNUHhHspx4O wPlUjYlMHERDckofNIHtlVIKtn/ja0+MqmHvQpQy7Lx7csCNev+hd2V7xLRwLLQnqrp5 CKh2WEodB3Y1wMQGMOpbkTfYaZ/vNw826X1qU9nFPrTd+eqzh+roLtAAyXPwpzWrdJSJ s4wg== 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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 a11si3696223jat.23.2021.05.20.13.28.57; Thu, 20 May 2021 13:29:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S237690AbhETKxM (ORCPT + 99 others); Thu, 20 May 2021 06:53:12 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) 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; -- 2.30.2