public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: Sahil Chandna <sahilchandna@linux.microsoft.com>,
	kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, longli@microsoft.com, lpieralisi@kernel.org,
	kwilczynski@kernel.org, robh@kernel.org, bhelgaas@google.com,
	dan.j.williams@intel.com, mhklinux@outlook.com,
	linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: hv: Fix double ida_free in hv_pci_probe error path
Date: Sat, 4 Apr 2026 05:19:18 +0000	[thread overview]
Message-ID: <20260404051918.GA60588@liuwe-devbox-debian-v2.local> (raw)
In-Reply-To: <v7l3vghep7h52f3qyoxdbqzu6un5vhio3njy4u46wjrqzhrrvx@hl5imwzjwocf>

On Sat, Apr 04, 2026 at 08:12:36AM +0530, Manivannan Sadhasivam wrote:
> On Fri, Apr 03, 2026 at 05:09:29AM -0700, Sahil Chandna wrote:
> > If hv_pci_probe() fails after storing the domain number in
> > hbus->bridge->domain_nr, there is a call to free this domain_nr via
> > pci_bus_release_emul_domain_nr(), however, during cleanup, the bridge
> > release callback pci_release_host_bridge_dev() also frees the domain_nr
> > causing ida_free to be called on same ID twice and triggering following
> > warning:
> > 
> >   ida_free called for id=28971 which is not allocated.
> >   WARNING: lib/idr.c:594 at ida_free+0xdf/0x160, CPU#0: kworker/0:2/198
> >   Call Trace:
> >    pci_bus_release_emul_domain_nr+0x17/0x20
> >    pci_release_host_bridge_dev+0x4b/0x60
> >    device_release+0x3b/0xa0
> >    kobject_put+0x8e/0x220
> >    devm_pci_alloc_host_bridge_release+0xe/0x20
> >    devres_release_all+0x9a/0xd0
> >    device_unbind_cleanup+0x12/0xa0
> >    really_probe+0x1c5/0x3f0
> >    vmbus_add_channel_work+0x135/0x1a0
> > 
> > Fix this by letting pci core handle the free domain_nr and remove
> > the explicit free called in pci-hyperv driver.
> > 
> > Fixes: bcce8c74f1ce ("PCI: Enable host bridge emulation for PCI_DOMAINS_GENERIC platforms")
> > Signed-off-by: Sahil Chandna <sahilchandna@linux.microsoft.com>
> 
> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
> 
> Wei: I see that you've taken previous hyperv patches. So feel free to take this
> one also.

Sure. I will pick this up.

Wei

      reply	other threads:[~2026-04-04  5:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 12:09 [PATCH] PCI: hv: Fix double ida_free in hv_pci_probe error path Sahil Chandna
2026-04-03 17:16 ` Saurabh Singh Sengar
2026-04-04  2:42 ` Manivannan Sadhasivam
2026-04-04  5:19   ` Wei Liu [this message]

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=20260404051918.GA60588@liuwe-devbox-debian-v2.local \
    --to=wei.liu@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=dan.j.williams@intel.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kwilczynski@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=robh@kernel.org \
    --cc=sahilchandna@linux.microsoft.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