From patchwork Thu May 20 09:21:45 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: 443198 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp2140338jac; Thu, 20 May 2021 03:07:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxof5gn/xnqmrl0jxIsQmoE2jfLElVaEBaQiIxpzeeMEHcmTSDgBD743XjdrS5EGmEKgVI0 X-Received: by 2002:a50:fe94:: with SMTP id d20mr284262edt.127.1621505256805; Thu, 20 May 2021 03:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621505256; cv=none; d=google.com; s=arc-20160816; b=FwVT1EWNfoC6Gh3UKPNd+YRoPXzKWM6VrOYU5hWF3o+BHHsP/BZnxDXAUiwh+IMpr0 8GC/SdQKCmNPrpeYDHnG+yyeMfzjK92q6bArtB82yw40Mc55iWyLEJ500v217ktFd/od 22ZKfe0StS3sEJ1gCp82UBVTQjbcUOhef03H0/vT1TfutJ/Y7CNd7iA/APYJRvZtL7yY 2lOYVSCb6+R1xMsgTGNyJyV8VJL/2jSA33VBDeZALndryDf5u+f7Pp6tuAVV744vJYKU RCbZtnIV1caBNZ8lXMMh9seUkawdkTZKkjoeRG7dZDHc92+b93/Ju2n2bBGKPYBKGmyD Cx5g== 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=gX2HZRjplYN979a84im3pvqKfJKSNuHhf9T9nyAuYCM=; b=zvYZoGD8gHPVwUfPZTHjfUiVZXdxDI12mr9iBlJDEUmr6X+1qoG1OIbPNW+dUBdAE5 2Pl1ymyurTua/gjanjDAY0CF3Ta2P42xcNmiFRP7N/wqRjysn74QvKrK8WZIoYQd5Q/+ 4Bcx+2kc5Qx7jrqAgb59hgo9ZIVfaCXDYdKR0ZvpKA3uvEUIGHStNOxwt+u6hZpIe8DX 1JNHCKZXHvnqRcxMBZ6NmjJE90yseZdpwQkegA0jjvM5sR5pTZgQn4sdsbRMEIcXAAig 9j/QmcJl/zuGhr5eOJy+4PvWr+2UBRLXDN6Jevy2HRp6UNZVn10pn0s+1YTNXjZnJk3u FqzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1P4Rl17f; 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 nc2si2886097ejc.593.2021.05.20.03.07.36; Thu, 20 May 2021 03:07:36 -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=1P4Rl17f; 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 S235462AbhETKIw (ORCPT + 12 others); Thu, 20 May 2021 06:08:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:38522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234970AbhETKGu (ORCPT ); Thu, 20 May 2021 06:06:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B26461942; Thu, 20 May 2021 09:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503690; bh=88OaBPMzv7rnU9SnM3IPGdNpC4vsioS4BfabOHjJ9Xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1P4Rl17fqNWQHMasOjkQ+z4fc+kwPo0A5IAQhGO7CtxrrLD+yB+AmHsPOMSSE2z1C UzEWd7l2Ij317QKaskjLB0cXlGTilYBRq8PgzR7qP2vP52fDHfAlg3Atg+G8DQhV7J vqW75BCHSQ9ldqAty/GFkI/r7JxpCshKs+iKavcc= 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.19 336/425] PCI: Release OF node in pci_scan_device()s error path Date: Thu, 20 May 2021 11:21:45 +0200 Message-Id: <20210520092142.449980699@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 9a5b6a8e2502..113b7bdf86dd 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2359,6 +2359,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;