Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/bng_re: Fix silent failure in HWRM version query

If the firmware version query fails, the driver currently ignores the
error and continues initializing. This leaves the device in a bad state.

Fix this by making bng_re_query_hwrm_version() return the error code and
update the driver to check for this error and stop the setup process
safely if it happens.

Fixes: 745065770c2d ("RDMA/bng_re: Register and get the resources from bnge driver")
Signed-off-by: Kamal Heib <kheib@redhat.com>
Link: https://patch.msgid.link/20260303043645.425724-1-kheib@redhat.com
Reviewed-by: Siva Reddy Kallam <siva.kallam@broadcom.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Kamal Heib and committed by
Leon Romanovsky
c242e92c a08aaf39

+9 -5
+9 -5
drivers/infiniband/hw/bng_re/bng_dev.c
··· 210 210 return rc; 211 211 } 212 212 213 - static void bng_re_query_hwrm_version(struct bng_re_dev *rdev) 213 + static int bng_re_query_hwrm_version(struct bng_re_dev *rdev) 214 214 { 215 215 struct bnge_auxr_dev *aux_dev = rdev->aux_dev; 216 216 struct hwrm_ver_get_output ver_get_resp = {}; ··· 230 230 if (rc) { 231 231 ibdev_err(&rdev->ibdev, "Failed to query HW version, rc = 0x%x", 232 232 rc); 233 - return; 233 + return rc; 234 234 } 235 235 236 236 cctx = rdev->chip_ctx; ··· 244 244 245 245 if (!cctx->hwrm_cmd_max_timeout) 246 246 cctx->hwrm_cmd_max_timeout = BNG_ROCE_FW_MAX_TIMEOUT; 247 + 248 + return 0; 247 249 } 248 250 249 251 static void bng_re_dev_uninit(struct bng_re_dev *rdev) ··· 308 306 goto msix_ctx_fail; 309 307 } 310 308 311 - bng_re_query_hwrm_version(rdev); 309 + rc = bng_re_query_hwrm_version(rdev); 310 + if (rc) 311 + goto destroy_chip_ctx; 312 312 313 313 rc = bng_re_alloc_fw_channel(&rdev->bng_res, &rdev->rcfw); 314 314 if (rc) { 315 315 ibdev_err(&rdev->ibdev, 316 316 "Failed to allocate RCFW Channel: %#x\n", rc); 317 - goto alloc_fw_chl_fail; 317 + goto destroy_chip_ctx; 318 318 } 319 319 320 320 /* Allocate nq record memory */ ··· 395 391 kfree(rdev->nqr); 396 392 nq_alloc_fail: 397 393 bng_re_free_rcfw_channel(&rdev->rcfw); 398 - alloc_fw_chl_fail: 394 + destroy_chip_ctx: 399 395 bng_re_destroy_chip_ctx(rdev); 400 396 msix_ctx_fail: 401 397 bnge_unregister_dev(rdev->aux_dev);