Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp415978pxj; Tue, 18 May 2021 06:20:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtGyPgxk+LSEplStQbKynoL3LVRCCqOlxQ2nFzmVvLq0pJLMjB2qSAV4BK78re+lXWZUol X-Received: by 2002:a92:d4c7:: with SMTP id o7mr4396302ilm.130.1621344039715; Tue, 18 May 2021 06:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621344039; cv=none; d=google.com; s=arc-20160816; b=AcrMj8ePXy1+6jZX/HRTovikTR+OqFm2uTjkwFeqGxk3HSpefuOujCv7Wiih1x5jXa bmHMHTjZ0oohViBRFH8HarqAYg71dlWEC6991QL5+EXykyzL0N5po0UHnyI6m2s+2isA ojMtZWSYE3ccPHhTCKxSPiqzrXwy7SON/aZt2qrO+JLAxEDByTiLZgzwA0CDDTlDWjBl HquGTuRVIcNp+eqmXI7baraJn1raeiz4xfBLf1jeH0aicKebOSSiY/kP1QbuTDdm7m/E eNXa5+CpS4fKU9JoppIOaNSLHdpJziEfW7SAeqyoabj9k+BbQV9IPdkf07eI5CjOrpS0 /qxw== 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=rKlilG3G+j+QQ/rDnjqcVHl7IsG4anT073wnQcZEna7349aR37u7WYyWjJotKHSLSo EM7qVtMOpw1TYX+CFmkg5JUW5op957wI+oWwiqHZgau5ffB+ovkCENT59SgpAC7Kf10/ svs8FGQtJYi1s+tpUWyE8onDBUR45yfK0ovdTdIvSuJzdtlBW4ZdlUjYA7hc9E+GFiKW Nw3w8iHnPNXv+n3TIdT2ZeHE+x6Cc0F+Gn4CzUiN0fuzmsMobrm+z8lhc3RW3h1bFVSW Sn33QUoqUCfFd3z8hwq9EcMGsP7u4Xtv+81aYtQbXQekCIu/a6W1d4FUQciB09c0HDLq wdqg== 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 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 n16si19449022ioh.74.2021.05.18.06.20.26; Tue, 18 May 2021 06:20:39 -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=CLz3FV7H; 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 S244337AbhEQPg4 (ORCPT + 99 others); Mon, 17 May 2021 11:36:56 -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 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 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; -- 2.30.2