From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: <dev@dpdk.org>, Chenbo Xia <chenbox@nvidia.com>,
Nipun Gupta <nipun.gupta@amd.com>,
David Marchand <david.marchand@redhat.com>,
"Thomas Monjalon" <thomas@monjalon.net>
Subject: Re: [PATCH v3 7/8] bus/pci: fix leaked device FD warning on VFIO unmap
Date: Fri, 23 Oct 2026 15:49:31 +0200 [thread overview]
Message-ID: <9b77587f-0b8c-477d-af32-7d69752b8a67@intel.com> (raw)
In-Reply-To: <cc295d28b94c6b041c6dbecf0c2c963067bbce90.1792762746.git.anatoly.burakov@intel.com>
On 10/23/2026 3:39 PM, Anatoly Burakov wrote:
> When unmapping a VFIO device, the interrupt handle FD is closed but the
> reference to the VFIO device FD is left in the handle. The device FD is
> owned by the VFIO layer and released separately, so freeing the handle
> later reports it as leaked.
>
> Clear the reference once the device FD has been retrieved, as is already
> done for the request notifier handle.
>
> Fixes: d770ee9caed0 ("interrupts: warn on leaked FDs")
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> drivers/bus/pci/linux/pci_vfio.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
> index fb35bc1d491..1116603f43f 100644
> --- a/drivers/bus/pci/linux/pci_vfio.c
> +++ b/drivers/bus/pci/linux/pci_vfio.c
> @@ -1091,6 +1091,8 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)
> vfio_dev_fd = rte_intr_dev_fd_get(dev->intr_handle);
> if (vfio_dev_fd < 0)
> return -1;
> + /* vfio_dev_fd is managed by VFIO layer, only clear reference here. */
> + rte_intr_dev_fd_set(dev->intr_handle, -1);
>
> if (rte_pci_set_bus_master(dev, false)) {
> PCI_LOG(ERR, "%s cannot unset bus mastering for PCI device!", pci_addr);
> @@ -1135,6 +1137,8 @@ pci_vfio_unmap_resource_secondary(struct rte_pci_device *dev)
> vfio_dev_fd = rte_intr_dev_fd_get(dev->intr_handle);
> if (vfio_dev_fd < 0)
> return -1;
> + /* vfio_dev_fd is managed by VFIO layer, only clear reference here. */
> + rte_intr_dev_fd_set(dev->intr_handle, -1);
>
> ret = dev_vfio_release_device(rte_pci_get_sysfs_path(), pci_addr,
> vfio_dev_fd);
Those intr_dev_fd_set's should've been put after the
dev_vfio_device_release. I'll send a v4 fixing that.
--
Thanks,
Anatoly
next prev parent reply other threads:[~2026-10-23 13:50 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 9:36 [PATCH v1 1/1] eal/linux: fix eventfd leaks when enabling interrupts Anatoly Burakov
2026-10-23 11:42 ` David Marchand
2026-10-23 12:25 ` Burakov, Anatoly
2026-10-23 13:07 ` [PATCH v2 1/3] eal/linux: fix closing of event FDs not owned by EAL Anatoly Burakov
2026-10-23 13:07 ` [PATCH v2 2/3] interrupts: warn on leaked event FDs Anatoly Burakov
2026-10-23 13:07 ` [PATCH v2 3/3] eal/linux: fix eventfd leaks when enabling interrupts Anatoly Burakov
2026-10-23 13:39 ` [PATCH v3 1/8] interrupts: fix size of duplicated instance Anatoly Burakov
2026-10-23 13:39 ` [PATCH v3 2/8] interrupts: fix event arrays copy on instance duplication Anatoly Burakov
2026-10-23 13:39 ` [PATCH v3 3/8] eal/linux: fix closing of event FDs not owned by EAL Anatoly Burakov
2026-10-23 13:39 ` [PATCH v3 4/8] eal/linux: fix eventfd leaks when enabling interrupts Anatoly Burakov
2026-10-23 13:39 ` [PATCH v3 5/8] eal/linux: fix leaked FD warnings for interrupt sources Anatoly Burakov
2026-10-23 13:39 ` [PATCH v3 6/8] eal/freebsd: fix interrupt source handle leak Anatoly Burakov
2026-10-23 13:39 ` [PATCH v3 7/8] bus/pci: fix leaked device FD warning on VFIO unmap Anatoly Burakov
2026-10-23 13:49 ` Burakov, Anatoly [this message]
2026-10-23 13:39 ` [PATCH v3 8/8] interrupts: warn on leaked event FDs Anatoly Burakov
2026-10-23 13:51 ` [PATCH v4 1/8] interrupts: fix size of duplicated instance Anatoly Burakov
2026-10-23 13:51 ` [PATCH v4 2/8] interrupts: fix event arrays copy on instance duplication Anatoly Burakov
2026-10-23 14:15 ` David Marchand
2026-10-23 14:36 ` Burakov, Anatoly
2026-10-23 14:44 ` David Marchand
2026-10-23 14:55 ` Burakov, Anatoly
2026-10-23 13:51 ` [PATCH v4 3/8] eal/linux: fix closing of event FDs not owned by EAL Anatoly Burakov
2026-10-23 14:17 ` David Marchand
2026-10-23 13:51 ` [PATCH v4 4/8] eal/linux: fix eventfd leaks when enabling interrupts Anatoly Burakov
2026-10-23 14:37 ` David Marchand
2026-10-23 13:51 ` [PATCH v4 5/8] eal/linux: fix leaked FD warnings for interrupt sources Anatoly Burakov
2026-10-23 13:51 ` [PATCH v4 6/8] eal/freebsd: fix interrupt source handle leak Anatoly Burakov
2026-10-23 13:51 ` [PATCH v4 7/8] bus/pci: fix leaked device FD warning on VFIO unmap Anatoly Burakov
2026-10-23 13:51 ` [PATCH v4 8/8] interrupts: warn on leaked event FDs Anatoly Burakov
2026-10-23 14:41 ` David Marchand
2026-10-23 14:48 ` Burakov, Anatoly
2026-10-24 8:56 ` David Marchand
2026-10-24 9:57 ` Burakov, Anatoly
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=9b77587f-0b8c-477d-af32-7d69752b8a67@intel.com \
--to=anatoly.burakov@intel.com \
--cc=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=nipun.gupta@amd.com \
--cc=thomas@monjalon.net \
/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