From: Jason Gunthorpe <jgg@ziepe.ca>
To: YeeLi <seven.yi.lee@gmail.com>
Cc: kevin.tian@intel.com, joro@8bytes.org, will@kernel.org,
robin.murphy@arm.com, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommufd/selftest: Fix dmabuf leak in iommufd_test_dmabuf_get()
Date: Mon, 13 Jul 2026 13:16:37 -0300 [thread overview]
Message-ID: <20260713161637.GD3133966@ziepe.ca> (raw)
In-Reply-To: <20260707030635.221577-1-seven.yi.lee@gmail.com>
On Tue, Jul 07, 2026 at 11:06:35AM +0800, YeeLi wrote:
> From: yeeli <seven.yi.lee@gmail.com>
>
> iommufd/selftest: Fix dmabuf leak in iommufd_test_dmabuf_get()
>
> When dma_buf_export() succeeds but dma_buf_fd() fails (e.g. -EMFILE
> from fd exhaustion), the dmabuf is leaked with no dma_buf_put() called.
>
> Reproducer: exhaust fd table near RLIMIT_NOFILE, then repeatedly call
> IOMMU_TEST_OP_DMABUF_GET — htop shows unbounded memory growth.
>
> Fix by calling dma_buf_put(dmabuf) on error and returning directly.
>
> Signed-off-by: yeeli <seven.yi.lee@gmail.com>
> ---
> drivers/iommu/iommufd/selftest.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Applied thanks
Jason
prev parent reply other threads:[~2026-07-13 16:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 3:06 [PATCH] iommufd/selftest: Fix dmabuf leak in iommufd_test_dmabuf_get() YeeLi
2026-07-13 16:16 ` Jason Gunthorpe [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=20260713161637.GD3133966@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=seven.yi.lee@gmail.com \
--cc=will@kernel.org \
/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