From patchwork Thu May 20 09:23:05 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: 443220 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp2180367jac; Thu, 20 May 2021 04:04:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzXs2iPUyctdMEd7evADBUWKN7Z0Np/m6VClBVlz0ioNYiVJA+sItpkztd8jIYg74y6HqV X-Received: by 2002:aa7:d9d6:: with SMTP id v22mr4294196eds.16.1621508653468; Thu, 20 May 2021 04:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621508653; cv=none; d=google.com; s=arc-20160816; b=Vo43asVPe7sAa7FABla5zoI3rnOJpfyrgKmTU719do5FRVPXcE9XQilqMQNtimjjDh +VMkYxPK9PzYbG8jigMSdfUMFzPEAYEGKEMvADi8K1KOZt+WQvC2x4O89qjJkwb7kGcw P8jU3i70AXcUN5req/vCTunWD16sWaRFBJ6HAnbOQN8UZVCBfOmbv8fKlwWTlSqWwJHT YFDLYI0vN+q9Wwyw16t8T4xK9xn9IMqmSlN/14AHw+mWVbA+pNfGigKEzeQCtxUbKvcF gLxr8CpAoZthm3slQrQvG3KB3gHLhjCUSVcBijw/O8oc3YqHdyDUsOfcSvzh1IrVkilN ZeGw== 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=xuouNr2CAQ6pN2kgx1l/oEahUpkrI2RZ0TUN82wHN1r9clDg3Vtv0sUhVP9sGX5+oL sTiBBvPyaaXXshsQ6buQ5Aa8he+nTfB8RuzF3uS2/XqV2zNZDYXxp9ua3vuny4yVZQN7 TCL0DFHnaU8IqbCog45RsB8R7k9Nno6oowUg1O/k6rLv2WlZ9ZdhkAOR+msL6lhuyRHz JsTWxk4/wh9bYM9Yq1nGkDcPlSDweHFxngLn11urUVhmXAM7PnX6HRDKSKiH5ITcb9+l gZR/rH8PoJh8ilw3G4InlxyJKMhdl68rRORFA0YXC2+KHdB6vTKaeV6VUoM6bWq5I0EW vsvg== 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 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 cq25si1918786edb.107.2021.05.20.04.04.13; Thu, 20 May 2021 04:04:13 -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=uqw6wYcv; 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 S237033AbhETLFB (ORCPT + 12 others); Thu, 20 May 2021 07:05:01 -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 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 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;