summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuoyu Wang <ruoyuw560@gmail.com>2026-06-06 07:06:44 +0300
committerJason Gunthorpe <jgg@nvidia.com>2026-06-10 20:07:55 +0300
commit2cde8282ff6e28c5e2fa3dbed25f154bd0e1cd7f (patch)
treeb23770da39eebaf45d8fe5d748b732506721ed6d
parent20ff9350862468af21b46cae2c22d17d6ec637f9 (diff)
downloadlinux-2cde8282ff6e28c5e2fa3dbed25f154bd0e1cd7f.tar.xz
RDMA/bnxt_re: Check debugfs parameter allocation for failure
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 just stop. Link: https://patch.msgid.link/r/20260606040644.13-1-ruoyuw560@gmail.com Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-rw-r--r--drivers/infiniband/hw/bnxt_re/debugfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/bnxt_re/debugfs.c b/drivers/infiniband/hw/bnxt_re/debugfs.c
index 5fed2cf66be3..143e9bfc6b79 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)
+ return;
for (i = 0; i < BNXT_RE_CC_PARAM_GEN0; i++) {
struct bnxt_re_cc_param *tmp_params = &rdev->cc_config_params->gen0_parms[i];