From: sashiko-bot@kernel.org
To: "Siva Reddy Kallam" <siva.kallam@broadcom.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [RDMA v2 06/13] RDMA/bng_re: Add PD verbs
Date: Sat, 05 Dec 2026 16:10:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-251730@kernel.org> (raw)
In-Reply-To: <20261204155249.1002019-7-siva.kallam@broadcom.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] RDMA/bng_re: unratelimited ibdev_err() log flood in
bng_re_alloc_pd()
- [Medium] RDMA/bng_re: missing ib_no_udata_io() validation in
bng_re_dealloc_pd()
--
commit 82d94e76706f3157f51a5468de873f06e5c49ee4
Author: Suresh Rupanagudi <suresh.rupanagudi@broadcom.com>
RDMA/bng_re: Add PD verbs
This commit adds the alloc_pd and dealloc_pd verbs for bng_re using a
software IDA backed by the firmware-reported max_pd limit.
> diff --git a/drivers/infiniband/hw/bng_re/bng_verbs.c b/drivers/infiniband/hw/bng_re/bng_verbs.c
> index 59fa84040476b..95317907d6125 100644
> --- a/drivers/infiniband/hw/bng_re/bng_verbs.c
> +++ b/drivers/infiniband/hw/bng_re/bng_verbs.c
> @@ -459,3 +459,46 @@ int bng_re_del_gid(const struct ib_gid_attr *attr, void **context)
>
> return rc;
> }
> +
> +int bng_re_alloc_pd(struct ib_pd *ib_pd, struct ib_udata *udata)
> +{
> + struct bng_re_pd *pd = container_of(ib_pd, struct bng_re_pd, ib_pd);
> + struct ib_device *ibdev = ib_pd->device;
> + struct bng_re_dev *rdev = container_of(ibdev, struct bng_re_dev, ibdev);
> + int rc;
> +
> + pd->rdev = rdev;
> +
> + rc = ib_is_udata_in_empty(udata);
> + if (rc)
> + return rc;
> +
> + rc = bng_sp_alloc_pd(&rdev->bng_res, &pd->sp_pd);
> + if (rc) {
> + ibdev_err(&rdev->ibdev, "Failed to allocate PD: %d\n", rc);
> + return rc;
> + }
> +
> + if (udata) {
> + struct bng_re_pd_resp resp = {};
> +
> + resp.pdid = pd->sp_pd.id;
> + rc = ib_respond_udata(udata, resp);
> + if (rc) {
> + ibdev_err(&rdev->ibdev, "Failed to copy PD udata\n");
> + bng_sp_dealloc_pd(&rdev->bng_res, &pd->sp_pd);
> + return rc;
> + }
> + }
> +
> + return 0;
> +}
[Severity: Medium]
Can an unprivileged user flood the kernel log through these two
ibdev_err() calls?
Passing an unmapped response buffer to IB_USER_VERBS_CMD_ALLOC_PD hits
the ib_respond_udata() error path and frees the PD right away, allowing a
tight loop that consumes no PD slots. Exhausting max_pd hits the first
ibdev_err() on every further call as well.
_ib_respond_udata() uses ibdev_dbg() on EFAULT for this reason; switching
these to ibdev_dbg() or ibdev_err_ratelimited() would prevent log
flooding.
> +
> +int bng_re_dealloc_pd(struct ib_pd *ib_pd, struct ib_udata *udata)
> +{
> + struct bng_re_pd *pd = container_of(ib_pd, struct bng_re_pd, ib_pd);
> + struct bng_re_dev *rdev = pd->rdev;
> +
> + bng_sp_dealloc_pd(&rdev->bng_res, &pd->sp_pd);
> + return 0;
> +}
[Severity: Medium]
Should bng_re_dealloc_pd() call ib_no_udata_io(udata) before freeing
the PD?
When userspace invokes IB_USER_VERBS_CMD_DEALLOC_PD through
UVERBS_METHOD_INVOKE_WRITE, ib_uverbs_run_method() populates driver_udata
and forwards it via uverbs_free_pd() -> ib_dealloc_pd_user().
Ignoring udata silently accepts non-zero driver input instead of
returning -EOPNOTSUPP, and leaves any output buffer untouched even though
ib_uverbs_run_method() marks UVERBS_ATTR_UHW_OUT valid on a zero return.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204155249.1002019-1-siva.kallam@broadcom.com?part=6
next prev parent reply other threads:[~2026-12-05 16:10 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 15:47 [RDMA v2 00/13] Add BNG_RE control path verbs Siva Reddy Kallam
2026-12-04 15:47 ` [RDMA v2 01/13] bnge: Keep the RoCE MSI-X minimum for the MPC vector Siva Reddy Kallam
2026-12-04 15:47 ` [RDMA v2 02/13] RDMA/bng_re: Add MPC, XID management, doorbell infrastructure Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 03/13] RDMA/bng_re: Add support verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 04/13] RDMA/bng_re: Add ucontext/mmap verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 05/13] RDMA/bng_re: Add GID verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 06/13] RDMA/bng_re: Add PD verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot [this message]
2026-12-04 15:47 ` [RDMA v2 07/13] RDMA/bng_re: Add MR verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 08/13] RDMA/bng_re: Add CQ verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 09/13] RDMA/bng_re: Add SRQ verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 10/13] RDMA/bng_re: Add Stats verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 11/13] RDMA/bng_re: Add AH verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 12/13] RDMA/bng_re: Add QP verbs Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 13/13] RDMA/bng_re: Register with ib-core Siva Reddy Kallam
2026-12-05 16:10 ` sashiko-bot
2026-12-05 16:10 ` [RDMA v2 00/13] Add BNG_RE control path verbs 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=sashiko-outbox-251730@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=siva.kallam@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