[PATCH] RDMA/bnxt_re: check create_singlethread_workqueue() in DCB setup

Linkai Gong posted 1 patch 1 month, 1 week ago
drivers/infiniband/hw/bnxt_re/main.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
[PATCH] RDMA/bnxt_re: check create_singlethread_workqueue() in DCB setup
Posted by Linkai Gong 1 month, 1 week ago
bnxt_re_init_dcb_wq() ignores a failed allocation. The async DCB
handler later calls queue_work() on the NULL pointer.

Fixes: 51dc5312dcd9 ("RDMA/bnxt_re: Add support to handle DCB_CONFIG_CHANGE event")
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
---
 drivers/infiniband/hw/bnxt_re/main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index d25fdc458120..c2fa83eb0da5 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -356,9 +356,13 @@ static int bnxt_re_update_qp1_tos_dscp(struct bnxt_re_dev *rdev)
 	return bnxt_qplib_modify_qp(&rdev->qplib_res, &qp->qplib_qp);
 }
 
-static void bnxt_re_init_dcb_wq(struct bnxt_re_dev *rdev)
+static int bnxt_re_init_dcb_wq(struct bnxt_re_dev *rdev)
 {
 	rdev->dcb_wq = create_singlethread_workqueue("bnxt_re_dcb_wq");
+	if (!rdev->dcb_wq)
+		return -ENOMEM;
+
+	return 0;
 }
 
 static void bnxt_re_uninit_dcb_wq(struct bnxt_re_dev *rdev)
@@ -2343,7 +2347,9 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)
 
 	bnxt_re_debugfs_add_pdev(rdev);
 
-	bnxt_re_init_dcb_wq(rdev);
+	rc = bnxt_re_init_dcb_wq(rdev);
+	if (rc)
+		goto fail;
 	bnxt_re_net_register_async_event(rdev);
 
 	if (!rdev->is_virtfn)
-- 
2.25.1
Re: [PATCH] RDMA/bnxt_re: check create_singlethread_workqueue() in DCB setup
Posted by Leon Romanovsky 3 weeks, 4 days ago
On Fri, 21 Aug 2026 17:09:08 +0800, Linkai Gong wrote:
> bnxt_re_init_dcb_wq() ignores a failed allocation. The async DCB
> handler later calls queue_work() on the NULL pointer.

Applied, thanks!

[1/1] RDMA/bnxt_re: check create_singlethread_workqueue() in DCB setup
      https://git.kernel.org/rdma/rdma/c/6c368f7baaea63

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>