From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796487014; b=umbBFK4iRJ1wt7UdgUJag0N8DMTHTbcABktqIVFngeUJliC3rU2/qen49hEpXZnuDWJV 5TzTiW4jrzJTdHtSCEOA7Funwb8yZozYxfhadkSRZZWZWoOQMXkjYKQsRaK9LA3uA/so9 anbxQmsvNGq2mg3Laqysp6WOd1lauwlA2H4dT8oRTi34eJKh7JddXVIpTqURGurSVOvoF Uhj/WA3/F//zFPiTd0k4BB+u2AoLE9MPX7sr5l8JMqVIAgsAAz3lzhpKb1VsIcDghWept BAivsoyWobCHizVWZrpEPKOkiZbwHMRnlkfn2/oDvshJboKpVE9xAsxPjVxqmwpVfSQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796487014; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=FnFWyUkkT/vshUPJ8f+8JnjXCqfyg+BsiDwtb6PgvZw=; b=UEf1Cq/Bv52CRb3zc0nPNO6eTWcWrYW1jpJ8ONfs4TDfLpnhX0BGRcUJdt/SlY+3AvfF 7XCcjkaXpua6BslLF8XMMEv43OV5FveeBWTXmu2YrnKIh2yYZFbfbiQokfVnUaCQg2TrV l6ib0VxEqb/D59Dv3TKw+x0j38IkNmMAkDy3qK7s1yup5BLb5+lxbu22ZNcpiiJWPhwEh Q/WdssLl0hMJMLE7rBE9/ryqOE0NhPaB4lPPdowJGqNREhovwK2pz433iDRtO+dMcBAad I/3sL+BBjxPRtMIM/ypgqRwCx4MllUscG6UUzErm4ZVvSuzGPRc4FnjFA8SgX/kzmqQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eZxapYmf; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D13B3606A32F for ; Sat, 5 Dec 2026 16:10:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eZxapYmf Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A2731F00A15; Sat, 5 Dec 2026 16:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796487014; bh=FnFWyUkkT/vshUPJ8f+8JnjXCqfyg+BsiDwtb6PgvZw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=eZxapYmf1c1jNVfPW8s8Ye4K3Q0gveB3SQTYPvoh3d9ZczZfcJo4CxV8EJyUBofuk 2YgWxqnbtBXSv52JKpV6CqYVItD02pWy7Nymr3ZFuIwAUvQAAlw1ILMSFfbPysgF9S 4lmyKcWQmxBAaUortZOFF+amejAhDyV01bBlVkFCtL3zjwMOh7r64uTp5UZQ+bwelF fO8Zy/H7laMuAc3vGjN9MXJjKYcgDCh0Vfe3Ng15CJqZcEtI4RkndbVkKnHorfFU4k nU3MPajK+ylY0UATR0sVtOlECGYDqvDGkxOWrqeeo5gulLXN6avIpTi9VHpVEGLKV2 MBRAT4Ej9yaFQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RDMA v2 13/13] RDMA/bng_re: Register with ib-core Reply-To: sashiko-reviews@lists.linux.dev To: "Siva Reddy Kallam" Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261204155249.1002019-14-siva.kallam@broadcom.com> References: <20261204155249.1002019-1-siva.kallam@broadcom.com> <20261204155249.1002019-14-siva.kallam@broadcom.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 16:10:14 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 > RDMA/bng_re: Register with ib-core > > This patch registers with ib-core > > Signed-off-by: Siva Reddy Kallam > Signed-off-by: Sachin Holla [Severity: Low] Could the commit message explain the other functional changes bundled in th= is 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_STA= TS, 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; > } > =20 > +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_a= h() checks and re-reads sgid_tbl.hw_id[] without any lock: CPU0 CPU1 bng_re_create_ah() if (sgid_tbl.hw_id[idx] =3D=3D 0xFFFF) del_gid() -> bng_re_del_gid() bng_sp_del_sgid() sgid_tbl.hw_id[idx] =3D 0xFFFF; sp_ah.sgid_index =3D 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 fr= om 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->ume= m) 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 *ade= v, > struct bng_re_en_dev_info *en_info; > int rc; > =20 > + /* > + * 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 =3D 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 =3D 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 =3D bd->netdev before auxiliary_device_add() wo= uld fix the root cause without the data race or deferred probe workaround. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204155249.1002= 019-1-siva.kallam@broadcom.com?part=3D13