Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp588730pxj; Thu, 20 May 2021 17:08:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTZzyaqyg9qjXWRrBGiMGxy9rjmtA+wLySiEW7Hh1cMpVRN+0Nb3D2rrHQb5Apw5hpc5PC X-Received: by 2002:a92:c566:: with SMTP id b6mr7555697ilj.222.1621555689360; Thu, 20 May 2021 17:08:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621555689; cv=none; d=google.com; s=arc-20160816; b=vYOWd4XFa55hLAXSgFuJm9A8HQQMeIIpytQZGykMTwoZvdOofWoqjch76EAq2R4X8Q Qirr02IwJJEnCLfsP+TNNXyeTxAJF1sYifWR9INB2xwUX6gNh8F8FwqeEwrYf1F+fTLf SbtVFfOaZpJaf6OWfrbAnSizbe+TXmmLyLreDkTvvhIDwT8cJjjYfx4jsKYiTBG8CL/X 3Bv1xSIUFExiMkcOAdt6qZkh7LptlBthrMcSqrLa0elECNRl+pZbIATmcg1nvY+rmPbA 9ArpHc1vgIZeqENHfZwuqN++p6PHbofdvcKub4QK/PjzLxM/s4CevE4tU5jHleh1YILx XdcA== 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=uoB1+CzbhKtz1Lz4K4B5ctvd2YmXLiUlAbV5CZ346ww=; b=x5VMgG9ocHY77Dx86tUI95kvacPBprw2shPEKdn+3NlBTyRAzL+F7ACYRDjroeSCWb D9h1MkHvhJIClN+49//SDX3EZW/sLWu58NuhbwobW3sNEQK1vhH7sowXWDGE6dWVhmaf YCPf1NsPfIQ8Vcrw5SUHtrROzr9DKHU/lDNAbo5rtnpAAbTWh3zmofH0uT+OIeB1/Iap fPCu7LhOWu7aCKGvk47XxXImgTCM9WGiNCrVV6oTVx0PjOeWi4WTObp4FovrKDwxPNCg ga1oTuzUyLPXQs0w2ZmifvyFJ5O/u4VfijmKtjzL9pjBoIlhYwXYVYI02H8rHrYCimoe NwEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uqw6wYcv; 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 g5si3574913jan.100.2021.05.20.17.07.56; Thu, 20 May 2021 17:08:09 -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=uqw6wYcv; 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 S239263AbhETLWf (ORCPT + 99 others); Thu, 20 May 2021 07:22:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:57186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239365AbhETLB5 (ORCPT ); Thu, 20 May 2021 07:01:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6BF5161D10; Thu, 20 May 2021 10:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505033; bh=fh02Oba5fs53fiOg+PgVr3aAD93ERAV/xbwbMvskzb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uqw6wYcvSne73dtAlBpOg2bnKn8kBXUKZ9r8yca2Hxf17Sw4Yh2G8fXIUbr1kL7wv 8k7btHavymtwUgbt/NxGsT21ARLZ7ev7E8FwYcATBcPi9AvW1be+7iA/0MMqXR82NN GME1VFAk4s1Pimo440LqZv9TbSznqFJMQ9/ho4bM= 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.9 193/240] PCI: Release OF node in pci_scan_device()s error path Date: Thu, 20 May 2021 11:23:05 +0200 Message-Id: <20210520092115.145414917@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@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 19658873b4c1..ddf5ba63b195 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1694,6 +1694,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