From: sashiko-bot@kernel.org
To: "Pavel Begunkov" <asml.silence@gmail.com>
Cc: media-ci@linuxtv.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 13/13] io_uring/rsrc: add dmabuf backed registered buffers
Date: Mon, 21 Sep 2026 13:54:29 +0000 [thread overview]
Message-ID: <20260921135430.220561F000FF@smtp.kernel.org> (raw)
In-Reply-To: <0d82253d5e930981e6a21503e145a1ebd280f995.1789997898.git.asml.silence@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] io_uring: memory leak of io_regbuf_dma in io_release_reg_dmabuf()
--
commit 9778a7461fd88cbd1c8b6991ebea933808628a8d
Author: Pavel Begunkov <asml.silence@gmail.com>
io_uring/rsrc: add dmabuf backed registered buffers
This commit implements dmabuf-backed registered buffers, allowing them to be
used with io_uring fixed read/write requests. It introduces a new buffer type
IO_REGBUF_TYPE_DMABUF to set up a DMA map against a specific target file.
> diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
> index 79e3c686ecc15..cb7495df13b71 100644
> --- a/io_uring/rsrc.c
> +++ b/io_uring/rsrc.c
[ ... ]
> +static void io_release_reg_dmabuf(void *priv)
> +{
> + struct io_regbuf_dma *db = priv;
> +
> + fput(db->target_file);
> + dma_buf_io_ctx_release(db->ctx);
[Severity: Medium]
Does this code leak the io_regbuf_dma structure?
The db structure is dynamically allocated via kzalloc() in io_register_dmabuf()
and assigned to imu->priv. When a user unregisters a dmabuf-backed registered
buffer, this release callback drops the file and context references, but doesn't
seem to free the db structure itself. Should this include a call to kfree(db)?
> +}
> +
> +static struct io_rsrc_node *io_register_dmabuf(struct io_ring_ctx *ctx,
> + struct io_uring_regbuf_desc *desc)
> +{
[ ... ]
> + regbuf = kzalloc(sizeof(*regbuf), GFP_KERNEL);
> + if (!regbuf)
> + goto err;
[ ... ]
> + imu->release = io_release_reg_dmabuf;
> + imu->priv = regbuf;
> + imu->flags = IO_REGBUF_F_DMABUF;
> + imu->dir = IO_BUF_DEST | IO_BUF_SOURCE;
> + refcount_set(&imu->refs, 1);
> + node->buf = imu;
> + dma_buf_put(dmabuf);
> + return node;
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1789997898.git.asml.silence@gmail.com?part=13
prev parent reply other threads:[~2026-09-21 13:54 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 13:38 [PATCH v6 00/13] Add dmabuf read/write via io_uring Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 01/13] dma-buf: introduce initial file I/O infrastructure Pavel Begunkov
2026-09-21 13:53 ` sashiko-bot
2026-09-22 9:08 ` Pavel Begunkov
2026-09-30 6:54 ` Matthew Brost
2026-09-30 10:03 ` Pavel Begunkov
2026-09-30 3:00 ` Matthew Brost
2026-09-30 10:08 ` Pavel Begunkov
2026-09-30 12:48 ` Pavel Begunkov
2026-09-30 19:43 ` Matthew Brost
2026-10-05 11:49 ` Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 02/13] iov_iter: add iterator type for dmabuf maps Pavel Begunkov
2026-09-21 13:53 ` sashiko-bot
2026-09-22 9:15 ` Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 03/13] block: always adjust bi_offset on bio_advance_iter Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 04/13] block: introduce dma map backed bio type Pavel Begunkov
2026-09-22 13:16 ` Christoph Hellwig
2026-09-22 13:54 ` Pavel Begunkov
2026-09-23 4:51 ` Christoph Hellwig
2026-09-21 13:38 ` [PATCH v6 05/13] block: add dma-buf support for raw bdev Pavel Begunkov
2026-09-21 13:50 ` sashiko-bot
2026-09-21 13:38 ` [PATCH v6 06/13] nvme-pci: implement dma-buf backed requests Pavel Begunkov
2026-09-21 13:58 ` sashiko-bot
2026-09-22 13:20 ` Christoph Hellwig
2026-09-22 13:37 ` Pavel Begunkov
2026-09-23 4:55 ` Christoph Hellwig
2026-09-24 15:53 ` Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 07/13] nvme-pci: rename nvme_pci_sgl_set_data to nvme_pci_dma_iter_set_sgl Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 08/13] nvme-pci: add SGL support for the dmabuf path Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 09/13] io_uring/rsrc: introduce buf registration structure Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 10/13] io_uring/rsrc: extend buffer update Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 11/13] io_uring/rsrc: add uncloneable regbuf flag Pavel Begunkov
2026-09-21 13:53 ` sashiko-bot
2026-09-21 13:38 ` [PATCH v6 12/13] io_uring/rsrc: add regbuf import flags Pavel Begunkov
2026-09-21 13:38 ` [PATCH v6 13/13] io_uring/rsrc: add dmabuf backed registered buffers Pavel Begunkov
2026-09-21 13:54 ` sashiko-bot [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=20260921135430.220561F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=asml.silence@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.