From: sashiko-bot@kernel.org
To: "Siva Reddy Kallam" <siva.kallam@broadcom.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [RDMA v2 13/13] RDMA/bng_re: Register with ib-core
Date: Sat, 05 Dec 2026 16:10:14 +0000 [thread overview]
Message-ID: <sashiko-outbox-251737@kernel.org> (raw)
In-Reply-To: <20261204155249.1002019-14-siva.kallam@broadcom.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] RDMA/bng_re: free SRQ/MR HWQ and umem while firmware may still
own them
- [Medium] RDMA/bng_re: data race and aux init ordering bug on
auxr_dev->net
- [Medium] RDMA/bng_re: unsynchronized sgid_tbl access between GID and
AH/QP verbs
- [Low] RDMA/bng_re: commit message omits key MSI-X, probe-defer, and IB
changes
--
commit 85d6f95dd199607a39d018f9d7d07e658cf7ebeb
Author: Siva Reddy Kallam <siva.kallam@broadcom.com>
> RDMA/bng_re: Register with ib-core
>
> This patch registers with ib-core
>
> Signed-off-by: Siva Reddy Kallam <siva.kallam@broadcom.com>
> Signed-off-by: Sachin Holla <sachin.holla@broadcom.com>
[Severity: Low]
Could the commit message explain the other functional changes bundled in this
patch beyond registering with ib-core? Raising BNG_RE_MIN_MSIX from 2 to 3,
deferring probe when auxr_dev->net is NULL, calling ib_device_set_netdev()
and dma_set_max_seg_size(..., UINT_MAX), setting BNG_RE_FLAG_ISSUE_ROCE_STATS,
and enabling IB_USER_VERBS_CMD_POLL_CQ are all omitted from the changelog.
> diff --git a/drivers/infiniband/hw/bng_re/bng_dev.c b/drivers/infiniband/hw/bng_re/bng_dev.c
> index d5175943db80f..7ff5286bb4463 100644
> --- a/drivers/infiniband/hw/bng_re/bng_dev.c
> +++ b/drivers/infiniband/hw/bng_re/bng_dev.c
[ ... ]
> @@ -632,6 +635,55 @@ static int bng_re_dev_init(struct bng_re_dev *rdev)
> return rc;
> }
>
> +static int bng_re_register_ib(struct bng_re_dev *rdev)
> +{
[ ... ]
> + ib_set_device_ops(ibdev, &bng_re_dev_ops);
[Severity: Medium]
Can registering bng_re_dev_ops expose an unsynchronized race on
rdev->bng_res.sgid_tbl between GID updates and AH/QP verbs?
struct bng_re_sgid_tbl has no lock, and ib-core's del_gid() calls
bng_re_del_gid() -> bng_sp_del_sgid() while holding only table->lock without
waiting for existing sgid_attr references. On another CPU, bng_re_create_ah()
checks and re-reads sgid_tbl.hw_id[] without any lock:
CPU0 CPU1
bng_re_create_ah()
if (sgid_tbl.hw_id[idx] == 0xFFFF)
del_gid() -> bng_re_del_gid()
bng_sp_del_sgid()
sgid_tbl.hw_id[idx] = 0xFFFF;
sp_ah.sgid_index =
sgid_tbl.hw_id[idx]; <-- reads 0xFFFF
bng_sp_fill_mpc_qp_modify_parms() and bng_sp_query_qp() also read
sgid_tbl.hw_id[] and sgid_tbl.tbl[].vlan_id unlocked, so concurrent GID
deletion or slot reuse can program an invalid (0xFFFF) or wrong HW SGID
index or VLAN ID into hardware.
[ ... ]
> + return ib_register_device(ibdev, "bng_re%d", &rdev->aux_dev->pdev->dev);
> +}
[Severity: High]
Can exposing the user SRQ and MR verbs here lead to a DMA use-after-free of
HWQ PBL pages and user umem pages while firmware still owns them?
In bng_re_create_srq(), if ib_copy_to_udata() fails (for example -EFAULT from
userspace) and the rollback bng_sp_destroy_srq() fails while the device is
online (such as -EAGAIN on CMDQ exhaustion or -ETIMEDOUT), the error path
still calls bng_re_free_hwq() and falls through to ib_umem_release(srq->umem)
even though the SRQ remains live in hardware. This contrasts with
bng_re_create_user_cq() and bng_re_destroy_srq(), which keep DMA memory
pinned when destroy fails.
Similarly, bng_sp_create_srq() and bng_sp_reg_mr() do not check
bng_re_fw_may_own() before calling bng_re_free_hwq() on a posted RCFW
timeout, and callers bng_re_create_srq(), bng_re_reg_user_mr(), and
bng_re_reg_user_mr_dmabuf() unconditionally call ib_umem_release(). Freeing
coherent PBL pages or unpinning user pages while firmware can still DMA-read
them risks memory corruption or IOMMU faults.
[ ... ]
> @@ -681,6 +740,14 @@ static int bng_re_probe(struct auxiliary_device *adev,
> struct bng_re_en_dev_info *en_info;
> int rc;
>
> + /*
> + * bnge publishes the netdev only after auxiliary_device_add()
> + * returns, so a synchronous probe can run before it is set.
> + * Defer; the retry is triggered once bnge's PCI probe binds.
> + */
> + if (!aux_priv->auxr_dev->net)
> + return -EPROBE_DEFER;
[Severity: Medium]
Does this check introduce a data race on auxr_dev->net with
bnge_rdma_aux_device_add()?
bnge_rdma_aux_device_add() publishes the auxiliary device via
auxiliary_device_add() under device_lock(&pdev->dev) before assigning
bd->auxr_dev->net = bd->netdev with an unlocked plain store, while
bng_re_probe() and bng_re_dev_add() read auxr_dev->net unlocked under
device_lock(&aux_dev->dev):
CPU0 CPU1
bnge_rdma_aux_device_add()
auxiliary_device_add(aux_dev)
bng_re_probe()
bd->auxr_dev->net = bd->netdev; if (!aux_priv->auxr_dev->net)
<-- data race
This also forces an unnecessary -EPROBE_DEFER retry whenever bng_re is
already loaded before bnge probes. Since bnge_probe_one() already allocates
bd->netdev via bnge_netdev_alloc() before calling bnge_rdma_aux_device_add(),
assigning bd->auxr_dev->net = bd->netdev before auxiliary_device_add() would
fix the root cause without the data race or deferred probe workaround.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204155249.1002019-1-siva.kallam@broadcom.com?part=13
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
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 [this message]
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-251737@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.