From: Thierry Reding <treding@nvidia.com>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: linux-pci@vger.kernel.org, bhelgaas@google.com, arnd@arndb.de
Subject: Re: [PATCH] PCI: fix double put_device() in error case in pci_create_root_bus()
Date: Tue, 18 Oct 2022 12:38:11 +0200 [thread overview]
Message-ID: <Y06CE+xz2h6dBpC6@orome> (raw)
In-Reply-To: <20221018035134.2016891-1-yangyingliang@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]
On Tue, Oct 18, 2022 at 11:51:34AM +0800, Yang Yingliang wrote:
> If device_add() fails in pci_register_host_bridge(), the bridge device will
> be put once, and it will be put again in error path of pci_create_root_bus().
> Fix this by removing put_device() after device_add() is failed.
>
> Fixes: 37d6a0a6f470 ("PCI: Add pci_register_host_bridge() interface")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/pci/probe.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Seems fine. All callers, as far as I can tell, of this end up invoking
pci_free_host_bridge() which does the corresponding put_device() itself:
Reviewed-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-10-18 10:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 3:51 [PATCH] PCI: fix double put_device() in error case in pci_create_root_bus() Yang Yingliang
2022-10-18 10:38 ` Thierry Reding [this message]
2022-11-23 7:42 ` Yang Yingliang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y06CE+xz2h6dBpC6@orome \
--to=treding@nvidia.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=yangyingliang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox