Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp372888pxj; Thu, 20 May 2021 11:16:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzg0Iilj7FzTx6TzQLuUTZzKNF4A41sli2R4QI1iO3kAmcNL6jh1E30kEl4yES6w65oFU2 X-Received: by 2002:a92:d24d:: with SMTP id v13mr6640856ilg.174.1621534583147; Thu, 20 May 2021 11:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621534583; cv=none; d=google.com; s=arc-20160816; b=sMMWMpdCEYBm7z53dU/KLD1hOdXtZhYTfn7o0rhd9ki89nI4aqqdNuaIe0801fBZaa jgmDGjdPpa6LUm0oPzQF4UVav4PLJwwnemw0g5Svr+mBHxEnuw3begqCKSojKtiAaasq xvLbIjT59lCXTN0I0BgIrRRn5w2IWGhCgoru7BdieyVmlOpDmg3MrZNl31LvI3Bj3+tz vnDisaFr3ivrR39qZV5OIG8rP+RpL48g7iUju/UG5QcdNvjxx+p6Nnx7X/c+aOCO3doq XQ/aSeqzBMvnH+1Bx4kj8AUEsu+ljWHOgpO6vPLDHB4iQ/F9UU2lZRJYCHjSFFVg7Szo WvZA== 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=gX2HZRjplYN979a84im3pvqKfJKSNuHhf9T9nyAuYCM=; b=yEPjbgSuwKTGbbMYVHZmDCUp+AA2fIDhI10TDYKbbTAdereJ2q3kKdw1dStYXoKkt4 gICvIRhu5xMopxOdRhj4TgJCUmdsnxifBeN019EMVUGV+Eizo2ntS09lKlDWtmn2Cgch Qq5P1a87GI+/b/+wFC+RifIpp0kRm6kVCdfgw+XqSfletoX5e74yNTjxsQYLoa/MyuGi 9iwpe/BPN0O6ArfURRKI3D5kZD58EQ14SETwqgf9O+NcoK/cJcmi/6KxQlt9IyuA+0kB DXnxX693RfCYpiULPnP24CwVaUmzANaUDSbi+BzuCGOoheXl5l/hu71WNmtGYm/mu4Dc TPYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1P4Rl17f; 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 l23si2578429jas.94.2021.05.20.11.16.08; Thu, 20 May 2021 11:16:23 -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=1P4Rl17f; 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 S236238AbhETKOu (ORCPT + 99 others); Thu, 20 May 2021 06:14:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:38522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234970AbhETKGu (ORCPT ); Thu, 20 May 2021 06:06:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B26461942; Thu, 20 May 2021 09:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503690; bh=88OaBPMzv7rnU9SnM3IPGdNpC4vsioS4BfabOHjJ9Xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1P4Rl17fqNWQHMasOjkQ+z4fc+kwPo0A5IAQhGO7CtxrrLD+yB+AmHsPOMSSE2z1C UzEWd7l2Ij317QKaskjLB0cXlGTilYBRq8PgzR7qP2vP52fDHfAlg3Atg+G8DQhV7J vqW75BCHSQ9ldqAty/GFkI/r7JxpCshKs+iKavcc= 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.19 336/425] PCI: Release OF node in pci_scan_device()s error path Date: Thu, 20 May 2021 11:21:45 +0200 Message-Id: <20210520092142.449980699@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 9a5b6a8e2502..113b7bdf86dd 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2359,6 +2359,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