From: Moni Shoua <monis@mellanox.com>
Subject: net/mlx5: Release resource on error flow
Patch-mainline: v5.0-rc1
Git-commit: 698114968a22f6c0c9f42e983ba033cc36bb7217
References: git-fixes
Fix reference counting leakage when the event handler aborts due to an
unsupported event for the resource type.
Fixes: a14c2d4beee5 ("net/mlx5_core: Warn on unsupported events of QP/RQ/SQ")
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Denis Kirjanov <dkirjanov@suse.com>
---
drivers/net/ethernet/mellanox/mlx5/core/qp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
@@ -124,7 +124,7 @@ void mlx5_rsc_event(struct mlx5_core_dev
if (!is_event_type_allowed((rsn >> MLX5_USER_INDEX_LEN), event_type)) {
mlx5_core_warn(dev, "event 0x%.2x is not allowed on resource 0x%.8x\n",
event_type, rsn);
- return;
+ goto out;
}
switch (common->res) {
@@ -139,6 +139,7 @@ void mlx5_rsc_event(struct mlx5_core_dev
mlx5_core_warn(dev, "invalid resource type for 0x%x\n", rsn);
}
+out:
mlx5_core_put_rsc(common);
}