Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] RDMA/bnxt_re: check create_singlethread_workqueue() in DCB setup
@ 2026-08-21  9:09 Linkai Gong
  2026-09-02 13:23 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Linkai Gong @ 2026-08-21  9:09 UTC (permalink / raw)
  To: Selvin Xavier, Kalesh AP, Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, linux-kernel, gonglinkai

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] RDMA/bnxt_re: check create_singlethread_workqueue() in DCB setup
  2026-08-21  9:09 [PATCH] RDMA/bnxt_re: check create_singlethread_workqueue() in DCB setup Linkai Gong
@ 2026-09-02 13:23 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2026-09-02 13:23 UTC (permalink / raw)
  To: Selvin Xavier, Kalesh AP, Jason Gunthorpe, Linkai Gong
  Cc: linux-rdma, linux-kernel


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>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-02 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21  9:09 [PATCH] RDMA/bnxt_re: check create_singlethread_workqueue() in DCB setup Linkai Gong
2026-09-02 13:23 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox