From patchwork Mon May 17 14:00:28 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: 440129 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1187725jac; Mon, 17 May 2021 08:24:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaoHhwVh9ESLjIikvJK/UcsKip2B5N6sJTL9dcKSOfOiOvsgldSHn5sphSIMbH8MC+Xo13 X-Received: by 2002:a05:6402:1489:: with SMTP id e9mr733702edv.8.1621265057884; Mon, 17 May 2021 08:24:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621265057; cv=none; d=google.com; s=arc-20160816; b=e8upAFJTDEWuip2fj7v3YqJSLEUKdwrOsFeRkoldNtnXuzwT9HRZjLxHxG4YCe7vEq 3spefKTgLOM3ee6hlziW2/OzKsWspUUnq2CDrOWIoSh3ojUxhcKWZUyLLaIdLxfce6Tj EibOEBNXbddp0tEfxklJHRqyXdS8Q2y6I0A+YPDjTHLdJz+gHGSVXFAitdPMt4nD0mWJ Hfj/9Q5B74di8soUfEesAC0tfaJhQOZGmgp7NuGNH7GW6Mo8vLoY+7W8BpkReeBbkAnA LBnO8dsteRHXtBYMX8Zqt8CO1NxbiaIlnN8kUz8wwgn1ru7pH2dXuqnLno8Se0GbM1I6 AvlA== 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=B8WMzn96IlCxkT9ClgbxOSf8sG4dlYM4FbPb12lyTos=; b=ZrME3MkLIOshBjph8ovJqk3mY/YU2fwKJMo+m9PppMAH2LMlTw9pZWz5nah/TXEG3X Sl8CkYyD/gIgNidLCnDtmtAmHtxDvOIy2FhcFRmQgce0KNHRLGaYSFErJHZo5xk4qFex BPoIjevlEKwFjOY7JE0aw26hnen4PoOXOc5Aco76Mzm3dD81xH+pdVWOivnfxZINENXB MKZ7u9eIdCDztZFZ+1aaESUNP54D8zCB9XpHmzKc62b9Y8Tr9dNOmb8vrjHjTUXqWq1b U3Vv8BtA7mcENqX/T1rer07t3mvh3p1eywFGBSvZTSIoSH/VpmoYfTTwtXjj7snMIm/M Jj0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CLz3FV7H; 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 kt7si4868543ejb.630.2021.05.17.08.24.17; Mon, 17 May 2021 08:24:17 -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=CLz3FV7H; 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 S243795AbhEQPYS (ORCPT + 12 others); Mon, 17 May 2021 11:24:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:59456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244293AbhEQPUA (ORCPT ); Mon, 17 May 2021 11:20:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 439ED613F0; Mon, 17 May 2021 14:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262043; bh=XPjacxrlW1tQTLcuBvhRa6ImoHgZ9mlVyBflt7JAq/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CLz3FV7H+wzXD+s6L6nbrHrJsOCZ8dpBoXtKT3KExsJ9/gAJMRiQpSC7eY6bges9O p5ylvEAJUirjq+IkMq7qWCwMO32t4U9R3OO5vDKGof9U3o5ldpIlTqwPZrXT3SeDWD ffrnEScqDyrPKHOVmdmUFxwRVm1jPN6uwoUJNtCg= 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 5.10 103/289] PCI: Release OF node in pci_scan_device()s error path Date: Mon, 17 May 2021 16:00:28 +0200 Message-Id: <20210517140308.651649590@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 4289030b0fff..ece90a23936d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2367,6 +2367,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;