mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Hungyu Lin <dennylin0707@gmail.com>
Cc: jgg@ziepe.ca, yishaih@nvidia.com, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/mlx5: Validate the DEVX command length before setting umem valid bits
Date: Mon, 16 Nov 2026 15:39:27 +0200	[thread overview]
Message-ID: <20261116133927.GO11319@unreal> (raw)
In-Reply-To: <20261115164658.88420-1-dennylin0707@gmail.com>

On Sun, Nov 15, 2026 at 04:46:58PM +0000, Hungyu Lin wrote:
> devx_set_umem_valid() sets the umem valid bits in the command supplied
> by user space, at offsets that depend on the opcode. The DEVX object
> create and modify methods only require the command to be as long as
> general_obj_in_cmd_hdr, which is 16 bytes, so when the command is
> shorter than the layout of its opcode the bits are written past the end
> of the command buffer. For MLX5_CMD_OP_CREATE_QP the modified words are
> 232 and 268 bytes into the command.
> 
> The command buffer is allocated with uverbs_alloc(), so the write lands
> either past the internal buffer of the bundle, which normally lives on
> the stack of ib_uverbs_cmd_verbs(), or past a separate allocation.
> 
> Fail with -EINVAL when the command does not cover the layout that is
> modified, as devx_handle_mkey_create() already does for
> MLX5_CMD_OP_CREATE_MKEY.
> 
> Fixes: ba1a057da2f1 ("IB/mlx5: Set valid umem bit on DEVX")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
>  drivers/infiniband/hw/mlx5/devx.c | 44 ++++++++++++++++++++++++++++++++-------
>  1 file changed, 37 insertions(+), 7 deletions(-)

Thanks for the report. We are aware of this issue and are working on a fix.

Unfortunately, the proposed solution would require DEVX userspace applications
to provide a size that is already known to the kernel, preventing us from
extending these structures in the future.

Thanks

      reply	other threads:[~2026-11-16 13:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 16:46 Hungyu Lin
2026-11-16 13:39 ` Leon Romanovsky [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=20261116133927.GO11319@unreal \
    --to=leon@kernel.org \
    --cc=dennylin0707@gmail.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yishaih@nvidia.com \
    /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

all inboxes | Powered by JetHome®