mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Srouji <edwards@nvidia.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>,
	Yishai Hadas <yishaih@nvidia.com>,
	Yishai Hadas <yishaih@mellanox.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	Uri Dar <udar@nvidia.com>,
	stable@vger.kernel.org, Michael Gur <michaelgur@nvidia.com>
Subject: Re: [PATCH rdma-next 1/2] RDMA/mlx5: Fix DEVX UMEM mailbox size truncation
Date: Wed, 11 Nov 2026 15:17:56 +0200	[thread overview]
Message-ID: <ff41e0cc-94e0-49c8-a83d-7d602cb4d884@nvidia.com> (raw)
In-Reply-To: <20261109144829.GM663069@ziepe.ca>



On 11/9/2026 4:48 PM, Jason Gunthorpe wrote:
> External email: Use caution opening links or attachments
> 
> 
> On Mon, Nov 09, 2026 at 04:42:32PM +0200, Edward Srouji wrote:
>> From: Uri Dar <udar@nvidia.com>
>>
>> devx_umem_reg_cmd_alloc() stores the CREATE_UMEM mailbox size, a header
>> plus 8 bytes per MTT, in the u32 cmd->inlen. The number of MTTs is
>> derived from the user-supplied length and pgsz_bitmap, so a UMEM of about
>> 2TB registered with 4KB pages wraps the size, the mailbox is
>> under-allocated and mlx5_ib_populate_pas() writes past its end.
>>
>> Store the size in an int, the in_size type of mlx5_cmd_exec(), where a
>> larger value would turn negative, and compute it with overflow checks so
>> a UMEM whose mailbox does not fit is rejected.
>>
>> Mailbox sizes within 512 bytes of INT_MAX still overflow the block count
>> in mlx5_calc_cmd_blocks(), but the command then fails with -ENOMEM
>> before reaching firmware. This predates the change.
>>
>> Fixes: aeae94579caf ("IB/mlx5: Add DEVX support for memory registration")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Uri Dar <udar@nvidia.com>
>> Reviewed-by: Michael Gur <michaelgur@nvidia.com>
>> Signed-off-by: Edward Srouji <edwards@nvidia.com>
>> ---
>>   drivers/infiniband/hw/mlx5/devx.c | 15 +++++++++------
>>   1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
>> index fc6f793dcc6584e6a22b40c57e2df8f24579eb14..1da6c0e440d6e19d8791b012a148f479cfdddad7 100644
>> --- a/drivers/infiniband/hw/mlx5/devx.c
>> +++ b/drivers/infiniband/hw/mlx5/devx.c
>> @@ -113,7 +113,7 @@ struct devx_umem {
>>
>>   struct devx_umem_reg_cmd {
>>        void                            *in;
>> -     u32                             inlen;
>> +     int                             inlen;
> 
> Do not change things which must be unsigned into signed values.

I asked to use check_add_overflow() but it was dumb to ignore this from 
my side. Will fix in V2.

> 
> Jason


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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 14:42 [PATCH rdma-next 0/2] RDMA: Fix DEVX UMEM mailbox size overflow Edward Srouji
2026-11-09 14:42 ` [PATCH rdma-next 1/2] RDMA/mlx5: Fix DEVX UMEM mailbox size truncation Edward Srouji
2026-11-09 14:48   ` Jason Gunthorpe
2026-11-11 13:17     ` Edward Srouji [this message]
2026-11-09 14:42 ` [PATCH rdma-next 2/2] RDMA/core: Don't warn on oversized bundle allocations Edward Srouji

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=ff41e0cc-94e0-49c8-a83d-7d602cb4d884@nvidia.com \
    --to=edwards@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michaelgur@nvidia.com \
    --cc=stable@vger.kernel.org \
    --cc=udar@nvidia.com \
    --cc=yishaih@mellanox.com \
    --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®