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/mlx5: Fix ucaps init error flow

In mlx5_ib_stage_caps_init(), if mlx5_ib_init_ucaps() fails after
mlx5_ib_init_var_table() succeeds, the VAR bitmap is leaked since
the function returns without cleanup.

Thus, cleanup the var table bitmap in case of error of initializing
ucaps before exiting, preventing the leak above.

Fixes: cf7174e8982f ("RDMA/mlx5: Create UCAP char devices for supported device capabilities")
Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://patch.msgid.link/20260104-ib-core-misc-v1-3-00367f77f3a8@nvidia.com
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Maher Sanalla and committed by
Leon Romanovsky
6dc78c53 8d466b15

+5 -1
+5 -1
drivers/infiniband/hw/mlx5/main.c
··· 4598 4598 MLX5_HCA_CAP_2_GENERAL_OBJECT_TYPES_RDMA_CTRL) { 4599 4599 err = mlx5_ib_init_ucaps(dev); 4600 4600 if (err) 4601 - return err; 4601 + goto err_ucaps; 4602 4602 } 4603 4603 4604 4604 dev->ib_dev.use_cq_dim = true; 4605 4605 4606 4606 return 0; 4607 + 4608 + err_ucaps: 4609 + bitmap_free(dev->var_table.bitmap); 4610 + return err; 4607 4611 } 4608 4612 4609 4613 static const struct ib_device_ops mlx5_ib_dev_port_ops = {