From: sashiko-bot@kernel.org
To: "Selvin Xavier" <selvin.xavier@broadcom.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH for-rc v2 3/8] RDMA/bnxt_re: Validate num_sge in bnxt_re_post_srq_recv()
Date: Wed, 09 Sep 2026 08:50:37 +0000 [thread overview]
Message-ID: <20260909085037.BBB881F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260909135244.122747-3-selvin.xavier@broadcom.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] Unconditional error logging on fast-path enables unprivileged log spam (Denial of Service)
Pre-existing issues:
- [High] Uninitialized stack memory in hardware work queue descriptor (wqe.flags)
--
commit a50a4d21bcd2c8e40025a33fa29a7f621d05a408
Author: Selvin Xavier <selvin.xavier@broadcom.com>
RDMA/bnxt_re: Validate num_sge in bnxt_re_post_srq_recv()
This commit adds a validation check in bnxt_re_post_srq_recv() to ensure
that the number of scatter/gather elements (SGE) provided for a Shared
Receive Queue (SRQ) does not exceed the device's configured maximum.
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index e56830a669bf4..ab9d4d6bf5b02 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -2386,9 +2386,16 @@ int bnxt_re_post_srq_recv(struct ib_srq *ib_srq, const struct ib_recv_wr *wr,
> const struct ib_recv_wr **bad_wr)
> {
> struct bnxt_re_srq *srq = container_of(ib_srq, struct bnxt_re_srq,
> ib_srq);
> struct bnxt_qplib_swqe wqe;
[Severity: High]
This is a pre-existing issue, but does this allocation leave wqe.flags
uninitialized before the structure is passed to the hardware?
Any legitimate call to bnxt_re_post_srq_recv allocates the wqe structure on
the stack without zeroing it. The function sets specific fields but appears
to leave wqe.flags uninitialized before calling bnxt_qplib_post_srq_recv,
which writes the flags field into the hardware's ring buffer descriptor.
Can this result in unpredictable hardware behavior or dropped work requests
if the garbage stack data is misinterpreted by the hardware datapath?
> unsigned long flags;
> int rc = 0;
>
> spin_lock_irqsave(&srq->lock, flags);
> while (wr) {
> /* Transcribe each ib_recv_wr to qplib_swqe */
> wqe.num_sge = wr->num_sge;
> + if (wr->num_sge > srq->qplib_srq.max_sge) {
> + ibdev_err(&srq->rdev->ibdev,
> + "Limit exceeded for SRQ Receive SGEs");
[Severity: Medium]
Since this function is on a fast-path datapath reachable from unprivileged
userspace via the RDMA uverbs API, could this unconditional error log lead
to log spam?
An unprivileged userspace application could intentionally flood the kernel
ring buffer by passing a wr->num_sge that is valid for the system call but
exceeds the driver's max_sge limit.
Would it be better to rate-limit this ibdev_err call, or remove it entirely
to prevent potential denial of service through disk space exhaustion and
system performance degradation?
> + rc = -EINVAL;
> + *bad_wr = wr;
> + break;
> + }
> bnxt_re_build_sgl(wr->sg_list, wqe.sg_list, wr->num_sge);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909135244.122747-1-selvin.xavier@broadcom.com?part=3
next prev parent reply other threads:[~2026-09-09 8:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 13:52 [PATCH for-rc v2 1/8] RDMA/bnxt_re: Reject executable mappings of the DBR and toggle pages Selvin Xavier
2026-09-09 8:42 ` sashiko-bot
2026-09-09 13:52 ` [PATCH for-rc v2 2/8] RDMA/bnxt_re: Detect wrong sge_len passed for inline Selvin Xavier
2026-09-09 8:47 ` sashiko-bot
2026-09-09 13:52 ` [PATCH for-rc v2 3/8] RDMA/bnxt_re: Validate num_sge in bnxt_re_post_srq_recv() Selvin Xavier
2026-09-09 8:50 ` sashiko-bot [this message]
2026-09-09 13:52 ` [PATCH for-rc v2 4/8] RDMA/bnxt_re: Validate SRQ max_sge at create time Selvin Xavier
2026-09-09 9:00 ` sashiko-bot
2026-09-09 13:52 ` [PATCH for-rc v2 5/8] RDMA/bnxt_re: Fix rdev lifetime races in suspend/resume/shutdown Selvin Xavier
2026-09-09 8:50 ` sashiko-bot
2026-09-09 13:52 ` [PATCH for-rc v2 6/8] RDMA/bnxt_re: Fix the PD and DPI table size Selvin Xavier
2026-09-09 8:48 ` sashiko-bot
2026-09-09 13:52 ` [PATCH for-rc v2 7/8] RDMA/bnxt_re: Use bnxt_ext_stats_supported for counter count selection Selvin Xavier
2026-09-09 8:56 ` sashiko-bot
2026-09-09 13:52 ` [PATCH for-rc v2 8/8] RDMA/bnxt_re: Check is_in_used before trusting RCFW completion Selvin Xavier
2026-09-09 9:03 ` 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=20260909085037.BBB881F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=selvin.xavier@broadcom.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