From patchwork Mon May 17 14:00:31 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: 440124 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1167884jac; Mon, 17 May 2021 08:01:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrXtRFqZlU9Z1iTrIikNl2gNP0dnqkM1k/Y74QOE8NQ6NMXINpuaX5md7Depx2H5SgZ6DQ X-Received: by 2002:a05:6402:3481:: with SMTP id v1mr533277edc.312.1621263712643; Mon, 17 May 2021 08:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621263712; cv=none; d=google.com; s=arc-20160816; b=M+T2jzfLjz8t/TGaFDJKBch5o76QF0e5lkOqhlw6fmcyVyYmbC1OxDWUSvsb8J/64i L/Bepv/sV3g5WRh+Jyj3lrGrAaS/oJUq4xPVzwMXOF4syhHpwtrv8ekL1SKro1fvivD+ JyGt6j1nb0JJY7YdCCrxZRzJJFcsO7rAIjbtQVgYxBtS/BStvLDjir7Mdv6MpO7pi7lH Et9/jDOB4RRveTPd4NYcF3ySILvu3YuFqRhwaAB/eh9B7878IgNoXt/efNFnyigCuvNG 1TloeIUd+DhN5PU0WdqL9ggQ5qbJR1D5ztH5i3UCELaI0XhhdsP6VdKgnOlptrEL6MTH bGPQ== 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=jaaD95FDBmMVb9dW0YQpsrQIss8npIaERDvMbJg91Ss=; b=uzO9DpGx3SHQ2MBIUJO6XI6dPT4l+9gCcaDThXzT8ktWT7ylzHFAsMzMEPGVvv0kDW RLzQVV7lYZzZHBG4Pi8bR+gXB2204N+NjFuysnq36yki6V/Lxz496OyC0XmW9RrWrbQD A/Gso0zX0J38onCsdePhUtmr7J70n8i53yBQAnI2DWUD33CiwhP4Fz9/Xk6V2KliwIf0 oT8wa0BwL+vwmQ9gVz1Q+h1eNlOBvCUprjEp9AqQwNLRRAioCY1+SuNhIhqUDpCFp7wW 7jGFBSp+Y0A6IrDRXBbRO3KoiMtD39pFiw+ykwLu4gD71NneUb9QwWYCKZeEEIznLivJ NKpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MytxeLpS; 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 i5si14276243eje.413.2021.05.17.08.01.52; Mon, 17 May 2021 08:01:52 -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=MytxeLpS; 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 S241019AbhEQPDH (ORCPT + 12 others); Mon, 17 May 2021 11:03:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:32850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241268AbhEQPBG (ORCPT ); Mon, 17 May 2021 11:01:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B28D261364; Mon, 17 May 2021 14:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261632; bh=RUVuHS+F/d/46/TBsNU+jXzy2X9vN5usIJ0/c1wl9MI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MytxeLpSSHIMJdThqaX+DTIMrwpKPGoqTKOSilxAr2or5d4od8QJAmhZzFybscMAB cYZ15DESk2Qck4bNXU8ouKeXUOHrwxGJOfeis/2zECV9jM+/gIyo1WJm4KuhAMPHTr MdvA/BGODjgAGHdOaxBQ/ZKldgFkpkyHNQ7H4vtU= 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.11 120/329] PCI: Release OF node in pci_scan_device()s error path Date: Mon, 17 May 2021 16:00:31 +0200 Message-Id: <20210517140306.169765059@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.043055203@linuxfoundation.org> References: <20210517140302.043055203@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 953f15abc850..be51670572fa 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2353,6 +2353,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;