All of lore.kernel.org
 help / color / mirror / Atom feed
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 05/13] block: add dma-buf support for raw bdev
Date: Mon, 21 Sep 2026 13:50:06 +0000	[thread overview]
Message-ID: <20260921135006.828441F000FF@smtp.kernel.org> (raw)
In-Reply-To: <eafcbbf7e75e75e98d0791b843fae0f2423a4ecd.1789997898.git.asml.silence@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] block: blkdev_read_iter() discards partial direct read success for dma-bufs
- [Low] block: dmabuf error paths skip iov_iter_reexpand() teardown
--

commit 1ef88ba1be9691ca9af0098196766a3034d434e9
Author: Pavel Begunkov <asml.silence@gmail.com>

    block: add dma-buf support for raw bdev
    
    Add a simple proxy implementation of init_dma_buf_io_ctx() forwarding
    the call to a new struct block_device_operations operation. Also reject
    dma-buf backed iterators for buffered IO.

> diff --git a/block/fops.c b/block/fops.c
> index 641621db700f8..15fe5e39c68aa 100644
> --- a/block/fops.c
> +++ b/block/fops.c

[ ... ]

> @@ -783,7 +783,8 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
>  
>  	if (iocb->ki_flags & IOCB_DIRECT) {
>  		ret = blkdev_direct_write(iocb, from);
> -		if (ret >= 0 && iov_iter_count(from)) {
> +		if (ret >= 0 && iov_iter_count(from) &&
> +		    !iov_iter_is_dmabuf_map(from)) {
>  			ret = direct_write_fallback(iocb, from, ret,
>  					blkdev_buffered_write(iocb, from));
>  			need_sync = true;
> @@ -796,6 +797,9 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
>  			need_sync = true;
>  		}
>  	} else {
> +		if (unlikely(iov_iter_is_dmabuf_map(from)))
> +			return -EOPNOTSUPP;
                        ^^^^^^^^^^^^^^^^^^

[Severity: Low]
At the start of blkdev_write_iter(), iov_iter_truncate() restricts the I/O
length and tracks the truncated amount in shorted. By returning directly here,
does this bypass the iov_iter_reexpand() call at the end of the function,
leaving the iterator incorrectly truncated?

> +
>  		/*
>  		 * Take i_rwsem and invalidate_lock to avoid racing with
>  		 * set_blocksize changing i_blkbits/folio order and punching

[ ... ]

> @@ -851,6 +855,8 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
>  		if (ret < 0 || !count)
>  			goto reexpand;
>  	}
> +	if (unlikely(iov_iter_is_dmabuf_map(to)))
> +		return -EOPNOTSUPP;
                ^^^^^^^^^^^^^^^^^^

[Severity: Medium]
If a partial O_DIRECT read using a dma-buf iterator successfully reads data and
advances ki_pos in the preceding direct I/O path, could this check
unconditionally return -EOPNOTSUPP? Does this overwrite the successful byte
count (ret > 0) with an error and hide the read data from userspace?

[Severity: Low]
Similar to blkdev_write_iter(), if this returns directly, does it bypass the
goto reexpand path, leaving the iterator incorrectly truncated if
iov_iter_truncate() was called earlier in blkdev_read_iter()?

>  
>  	/*
>  	 * Take i_rwsem and invalidate_lock to avoid racing with set_blocksize

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1789997898.git.asml.silence@gmail.com?part=5

  reply	other threads:[~2026-09-21 13:50 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 [this message]
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

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=20260921135006.828441F000FF@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.