public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Keith Busch <[email protected]>,
	[email protected], [email protected],
	[email protected], [email protected]
Cc: [email protected], [email protected],
	Keith Busch <[email protected]>
Subject: Re: [PATCHv4 3/5] ublk: zc register/unregister bvec
Date: Thu, 20 Feb 2025 11:11:59 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 2/18/25 22:42, Keith Busch wrote:
> From: Keith Busch <[email protected]>
> 
> Provide new operations for the user to request mapping an active request
> to an io uring instance's buf_table. The user has to provide the index
> it wants to install the buffer.
> 
> A reference count is taken on the request to ensure it can't be
> completed while it is active in a ring's buf_table.
> 
> Signed-off-by: Keith Busch <[email protected]>
> ---
>   drivers/block/ublk_drv.c      | 137 +++++++++++++++++++++++++---------
>   include/uapi/linux/ublk_cmd.h |   4 +
>   2 files changed, 105 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> index 529085181f355..0c753176b14e9 100644
> --- a/drivers/block/ublk_drv.c
> +++ b/drivers/block/ublk_drv.c
> @@ -51,6 +51,9 @@
...
> +static int ublk_unregister_io_buf(struct io_uring_cmd *cmd,
> +				  struct ublk_queue *ubq, int tag,
> +				  const struct ublksrv_io_cmd *ub_cmd,
> +				  unsigned int issue_flags)
> +{
> +	struct io_ring_ctx *ctx = cmd_to_io_kiocb(cmd)->ctx;
> +	struct ublk_device *ub = cmd->file->private_data;
> +	int index = (int)ub_cmd->addr;
> +	struct ublk_rq_data *data;
> +	struct request *req;
> +
> +	if (!ub)
> +		return -EPERM;
> +
> +	req = blk_mq_tag_to_rq(ub->tag_set.tags[ubq->q_id], tag);

Shouldn't there some speculation sanitisation for the tag as well?
Looks like a user passed value directly indexing an array.

> +	if (!req)
> +		return -EINVAL;
> +
> +	data = blk_mq_rq_to_pdu(req);
> +	io_buffer_unregister_bvec(ctx, index, issue_flags);
> +	return 0;
> +}
> +


Pavel Begunkov


  parent reply	other threads:[~2025-02-20 11:10 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18 22:42 [PATCHv4 0/5] ublk zero-copy support Keith Busch
2025-02-18 22:42 ` [PATCHv4 1/5] io_uring: move fixed buffer import to issue path Keith Busch
2025-02-19  1:27   ` Caleb Sander Mateos
2025-02-19  4:23   ` Ming Lei
2025-02-19 16:48   ` Pavel Begunkov
2025-02-19 17:15     ` Pavel Begunkov
2025-02-20  1:25     ` Keith Busch
2025-02-20 10:12       ` Pavel Begunkov
2025-02-18 22:42 ` [PATCHv4 2/5] io_uring: add support for kernel registered bvecs Keith Busch
2025-02-19  1:54   ` Caleb Sander Mateos
2025-02-19 17:23     ` Pavel Begunkov
2025-02-20 10:31     ` Pavel Begunkov
2025-02-20 10:38   ` Pavel Begunkov
2025-02-18 22:42 ` [PATCHv4 3/5] ublk: zc register/unregister bvec Keith Busch
2025-02-19  2:36   ` Caleb Sander Mateos
2025-02-20 11:11   ` Pavel Begunkov [this message]
2025-02-24 21:02     ` Keith Busch
2025-02-18 22:42 ` [PATCHv4 4/5] io_uring: add abstraction for buf_table rsrc data Keith Busch
2025-02-19  3:04   ` Caleb Sander Mateos
2025-02-18 22:42 ` [PATCHv4 5/5] io_uring: cache nodes and mapped buffers Keith Busch
2025-02-19  4:22   ` Caleb Sander Mateos
2025-02-24 21:01     ` Keith Busch
2025-02-24 21:39       ` Caleb Sander Mateos
2025-02-20 11:08   ` Pavel Begunkov
2025-02-20 15:24     ` Keith Busch
2025-02-20 16:06       ` Pavel Begunkov
2025-02-24 21:04         ` Keith Busch
2025-02-25 13:06           ` Pavel Begunkov

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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