From patchwork Thu May 20 09:23:38 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: 443231 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp2196843jac; Thu, 20 May 2021 04:24:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeuLZMe87lmI8LTrnS1/FeJD+EcGtb7fzNx4PVw6nfL6TxBtUf/DmpAyu0f4scubDJRqUy X-Received: by 2002:a05:6e02:e05:: with SMTP id a5mr4008502ilk.235.1621509897594; Thu, 20 May 2021 04:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621509897; cv=none; d=google.com; s=arc-20160816; b=BX3w2SuQum9LiTrcInkvySYsdY39YIYcKC6gSzebSC8/jbD2b5/cf0aW1IyV9um2ww MScYFx0ubxeWI0w3rxPO0mlrV0jJngjy7yxAiMiPaF2yeEegl3n1T+WwWsNz4FacdiBt hRKmexJS86FN5qX5/7Qd7+MjOPcSaWleeU5eGVQhoFwTLguiIfhNOhmVQmWU1NCHTGW6 yPNVbPi3qXNryhwprC/9cdoWYIc6S4MYFL8McNFpAWIEFR/0G8PRhWDCf+q0EqpQUily b42TmXfFeI1Pdwpk0yEHPAp3m7DjuXJvGLcBObB1f2kEKrTkw/nZ5lb+eM7ur4Oldplm raMA== 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=XHDjPmJm70zqOg4ue7E6aKir+O81U4x4iVKFaozK9ESVOm1K+3+pWQ+ZYNht2pg5x7 Ektq69f/Anie5LjY0GAr3TePtAGFjc2Cr7MenquMIluxf3CNPAcJOO403WeEUso30WOC JrPvzJcuOsafsxgpH5VT2qtPYvpfIh3SOejLNQcv8+//Hd0hoZnsl2Qb9ZoKbMRE3fJY Wn+LT1EjCgq7WJc73ArY69NYQwnpZOBBAWrLV+1gEOpdSLBXvHxjzdI9zTNGeffCTnSo vuDocWqW37En86uDy95s6bC5gX+QjQekFtYvgQr/Vx5nfqjPJzTkosgc5Jdr+jewAr3T OViw== 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 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 b11si1937604iok.1.2021.05.20.04.24.57; Thu, 20 May 2021 04:24:57 -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=WM4tTLSi; 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 S239401AbhETL0I (ORCPT + 12 others); Thu, 20 May 2021 07:26:08 -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 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 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;