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.

net/mlx5: Fix HCA caps leak on notifier init failure

mlx5_mdev_init() allocates HCA caps via mlx5_hca_caps_alloc() before
calling mlx5_notifiers_init(). If notifier initialization fails, the
error path jumps to err_hca_caps and skips mlx5_hca_caps_free(), leaking
allocated caps.

Add a dedicated unwind label for notifier-init failure that frees HCA
caps before continuing the existing cleanup sequence.

Fixes: b6b03097f982 ("net/mlx5: Initialize events outside devlink lock")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260415005022.34764-1-prathameshdeshpande7@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Prathamesh Deshpande and committed by
Jakub Kicinski
d03fc81a cc1ff87b

+3 -1
+3 -1
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 1914 1914 1915 1915 err = mlx5_notifiers_init(dev); 1916 1916 if (err) 1917 - goto err_hca_caps; 1917 + goto err_notifiers_init; 1918 1918 1919 1919 /* The conjunction of sw_vhca_id with sw_owner_id will be a global 1920 1920 * unique id per function which uses mlx5_core. ··· 1930 1930 1931 1931 return 0; 1932 1932 1933 + err_notifiers_init: 1934 + mlx5_hca_caps_free(dev); 1933 1935 err_hca_caps: 1934 1936 mlx5_adev_cleanup(dev); 1935 1937 err_adev_init: