From: Jason Gunthorpe <jgg@nvidia.com>
To: Jacob Moroni <jmoroni@google.com>
Cc: tatyana.e.nikolova@intel.com, krzysztof.czurylo@intel.com,
leon@kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/irdma: Fix out-of-bounds write in irdma_copy_user_pgaddrs
Date: Mon, 25 May 2026 10:59:45 -0300 [thread overview]
Message-ID: <20260525135945.GA2440908@nvidia.com> (raw)
In-Reply-To: <20260512183852.614045-1-jmoroni@google.com>
On Tue, May 12, 2026 at 06:38:52PM +0000, Jacob Moroni wrote:
> The irdma_copy_user_pgaddrs function loops through all of the umem DMA
> blocks to populate the PBLEs and will stop when either the last DMA
> block is reached or palloc->total_cnt is reached. The issue is that
> the logic for checking palloc->total_cnt would only work for non-zero
> values.
>
> When irdma_setup_pbles is called with lvl==0, it
> calls irdma_copy_user_pgaddrs with palloc->total_cnt==0, which means
> the only way to break out of the loop is to reach the last umem DMA
> block, which means it could end up going beyond the fixed size of 4
> iwmr->pgaddrmem array that is used in the lvl==0 case.
>
> In the case of QP/CQ/SRQ rings, the value of lvl is determined by a
> separate input (for example, req.cq_pages in the case of a CQ). So,
> we must perform explicit checking to ensure we don't overflow the
> pgaddrmem array if the user provides a umem that consists of more
> blocks than their provided req.cq_pages.
>
> Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
> Signed-off-by: Jacob Moroni <jmoroni@google.com>
> ---
> drivers/infiniband/hw/irdma/verbs.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
Applied to for-next
Can you also address the unrelated bug sashiko found:
https://sashiko.dev/#/patchset/20260512183852.614045-1-jmoroni%40google.com
Thanks,
Jason
prev parent reply other threads:[~2026-05-25 13:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 18:38 [PATCH] RDMA/irdma: Fix out-of-bounds write in irdma_copy_user_pgaddrs Jacob Moroni
2026-05-25 13:59 ` Jason Gunthorpe [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=20260525135945.GA2440908@nvidia.com \
--to=jgg@nvidia.com \
--cc=jmoroni@google.com \
--cc=krzysztof.czurylo@intel.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=tatyana.e.nikolova@intel.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