Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] RDMA/bnxt_re: check debugfs parameter allocation
@ 2026-06-06  4:06 Ruoyu Wang
  2026-06-10 17:25 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Ruoyu Wang @ 2026-06-06  4:06 UTC (permalink / raw)
  To: Selvin Xavier
  Cc: Kalesh AP, Jason Gunthorpe, Leon Romanovsky, linux-rdma,
	linux-kernel, Ruoyu Wang

bnxt_re_debugfs_add_pdev() allocates per-file private data for the CC
configuration debugfs entries. The loop that initializes those entries
uses rdev->cc_config_params immediately, so allocation failure would lead
to NULL pointer dereferences while setting up debugfs.

Debugfs is best-effort. If the CC configuration private data cannot be
allocated, skip those entries and continue with the independent CQ
coalescing debugfs setup.

Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
 drivers/infiniband/hw/bnxt_re/debugfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/bnxt_re/debugfs.c b/drivers/infiniband/hw/bnxt_re/debugfs.c
index 5fed2cf66be30..b1d6a8b32cc48 100644
--- a/drivers/infiniband/hw/bnxt_re/debugfs.c
+++ b/drivers/infiniband/hw/bnxt_re/debugfs.c
@@ -498,6 +498,8 @@ void bnxt_re_debugfs_add_pdev(struct bnxt_re_dev *rdev)
 	bnxt_re_debugfs_add_info(rdev);
 
 	rdev->cc_config_params = kzalloc_obj(*cc_params);
+	if (!rdev->cc_config_params)
+		goto init_cq_coal;
 
 	for (i = 0; i < BNXT_RE_CC_PARAM_GEN0; i++) {
 		struct bnxt_re_cc_param *tmp_params = &rdev->cc_config_params->gen0_parms[i];
@@ -510,6 +512,7 @@ void bnxt_re_debugfs_add_pdev(struct bnxt_re_dev *rdev)
 							 &bnxt_re_cc_config_ops);
 	}
 
+init_cq_coal:
 	bnxt_re_init_cq_coal_debugfs(rdev);
 }
 
-- 
2.34.1


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

end of thread, other threads:[~2026-06-10 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-06  4:06 [PATCH] RDMA/bnxt_re: check debugfs parameter allocation Ruoyu Wang
2026-06-10 17:25 ` Jason Gunthorpe

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