Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3025967pxj; Mon, 17 May 2021 15:54:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/UTI9dCNVBnJNcjS3n748t7ZfOgZX4IQvzQM0J1MfllX7jHgWfbGM/KqT0EG0f7oXueRC X-Received: by 2002:a92:2a09:: with SMTP id r9mr1695691ile.300.1621292090631; Mon, 17 May 2021 15:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621292090; cv=none; d=google.com; s=arc-20160816; b=yCFw3ksYqd9fssCTtPNJjQyvKZ0Vv0rEGAr/GIHFZ6c1zaZdflhYsQmaZaetDuPPrt 9y4db0JxMcUCW/XvEsn5qPMKyKGB/Xl8ZC/JWpv0cLhV9jr4MJuVeQF5OVA3yHQZbJWx tmqFuN2anTpTde7mlKhK+NwDELYh0mIzgA1Kpl3VdB/BYn9I6syBn8oKRx0Hv2/eyp2h AMSr6MxGwVXFatCQQDnw58QZpYaIMwYkSj+gLmvvO68St0C6WQY9AlnUCc9v69cJyitn EUWNGSapt3jjTK2YctcI8XD0odGE4+TjsJR46z1smdFyss2m/3JGQ0HZ11PgmtDBAtF6 uEQw== 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=pnM3Po/+eN02nxJ7TE0FQkprFxV+nM5vNMqsZVvXqM7LRElKutH8KGj9x0Sw0xre6s vCcqaXXSjvsVZChFEJ6y/gIW11obyLnSEY72rr5U/YmYOwi5nS0vVYO8C4niUzuPnMUa x1pU6l/hIIIqBvVsz6gUqeUGlBiqKaRrEOEgDuvOPIiLlCfG4b9s6ciFYneC8samA0go 17vxle/GhkCoaMKcLMuTPMX9lFWnIwpt5O6+Wq6JDzl39hZvvFoam0mXqADbyxgLI9lh btrwC2gzgzVjf3z+cE/9SCCgXS7rrxusKE3XSXzKUK2beoLGJg/4mzzka1RNr8RkSM+S RzLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P8l9CC3a; 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 x7si21643626jat.98.2021.05.17.15.54.15; Mon, 17 May 2021 15:54:50 -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=P8l9CC3a; 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 S239004AbhEQORr (ORCPT + 99 others); Mon, 17 May 2021 10:17:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:43504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbhEQOPJ (ORCPT ); Mon, 17 May 2021 10:15:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 234BA613F2; Mon, 17 May 2021 14:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260559; bh=RUVuHS+F/d/46/TBsNU+jXzy2X9vN5usIJ0/c1wl9MI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P8l9CC3ayjlVu/hsikZUNv2UMKobIT70gcJY8sL7S38IDp7LNWR/vQdXN7p/bSUCJ nSIFLcX3V8egumMeDz/BgEpI4P/eINrCEMk1ymw7G499ED5C64Tnqp/pTII40/bwZs EfTKgbz8EnLaj8JM2XcqceX2BrvU6ja54dmgzT2k= 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.12 135/363] PCI: Release OF node in pci_scan_device()s error path Date: Mon, 17 May 2021 16:00:01 +0200 Message-Id: <20210517140307.186594675@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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 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; -- 2.30.2