Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp625359pxj; Thu, 20 May 2021 18:16:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCdvwdc/z3Lk7snkrgXYpLfxcyv16aHXv4n5TiNxg/GonAC7fbfKczF8cRdreRZnHrOh/C X-Received: by 2002:aa7:dbc9:: with SMTP id v9mr7901850edt.183.1621559789080; Thu, 20 May 2021 18:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621559789; cv=none; d=google.com; s=arc-20160816; b=EJYGmLPoSRNbu+QGsIPESgcc84XqJdf/J/ZUdNw4kAMNFdHaMvtiHJVUhiIAjzTgzT Y3UP93zsIeRrCopskvsURQKU0LLn5Av+Oe/Jj4SkNfzLalnyUWbWua4htpbowZETOJeD vG0TCqWU0pXO/HzTIHJZM69daOWd6vOuYDBIx76th2r5RwC4b4JrxlZ10/4Naum+sLrM tVFrs3vV+tNZYThP5z8/+jPqQkzq4lqLYKMHFcmTC8nEy2jlX4QPdeSCa8ivJC2+JlWu 86jyS7m9l4abnzZVMUd9WwjI/X9yzymL8BSKrT04RkTRDN8GqAsqmT2q+mN9jpeKqvJx TPvQ== 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=8nq82iyavmGYParbKSAw0w5ogUm7GK7qyaEi82kU09U=; b=lt61XkkitGJOs6BlJsCb9bKnagxxKremzh87ZA7yrpRuLLI3aiXIH/eUdwvlW8Sp69 P4WFigjqRugLTX37JSoR5QdrmxZTgmKBl25zTGcFZYAhv8e69s4eFRGfptQ1tno3zwFN hCYJpIqsoQJy8+behVNGFxpsCjztXlOLawOGHRZmAzigHA0f/qQz733HHYMhj5pKBAQ3 ZZEA2+kg7TWfXggyNFVJ9ZYJByUsHqDwjSPkPKMqzdcBCtLegHfi9QU3TNSTbeGP1EgV hWGDLYWkM5cvEfZd7wN04Z7XPeTnsuHsdk53l/4S1CDKBAma7sVXXiRkFpu3SlqzRf1f Ligg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WM4tTLSi; 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 m7si4182855edq.235.2021.05.20.18.16.04; Thu, 20 May 2021 18:16:29 -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=WM4tTLSi; 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 S241953AbhETLqA (ORCPT + 99 others); Thu, 20 May 2021 07:46:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:43486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241412AbhETLY2 (ORCPT ); Thu, 20 May 2021 07:24:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 50A6161D9F; Thu, 20 May 2021 10:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505555; bh=jVHIvELmuxCXcqhfsNSwc3RHyZvQZH8D+Yd1iwnxavw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WM4tTLSi/6H3JtPF1DcsFs+2BO+y3xpMD+5NdUCltSDSQBsOodTAYqpuA3ZledGcy ONOCM/XgN3d0Fq3x9O8UbyEmp3h1ZgJEk521I603UhI1qM3r1+BGomCsHafZm/fiwL tQNOV8MYnlDrr2/U/7hoWNzBE6VlW4QMdSilhN/0= 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.4 154/190] PCI: Release OF node in pci_scan_device()s error path Date: Thu, 20 May 2021 11:23:38 +0200 Message-Id: <20210520092107.264256877@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 becedabff141..63c62e2c8c0d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1668,6 +1668,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