mlx5_vdpa_rqt_prepare() allocates RQT attributes with rte_zmalloc() but
returns without freeing them when no enabled receive queue is found
(k == 0). Every steering update that hits this path leaks the
allocation.
Free attr before returning on the no-enabled-RQ path.
Fixes: 9f09b1ca15c5 ("vdpa/mlx5: recreate a virtq becoming enabled")
Cc: [email protected]
Signed-off-by: Maayan Kashani <[email protected]>
Acked-by: Dariusz Sosnowski <[email protected]>
---
drivers/vdpa/mlx5/mlx5_vdpa_steer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_steer.c
b/drivers/vdpa/mlx5/mlx5_vdpa_steer.c
index b1bca7f0f7d..5dd9ca40ebc 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_steer.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_steer.c
@@ -85,9 +85,11 @@ mlx5_vdpa_rqt_prepare(struct mlx5_vdpa_priv *priv, bool
is_dummy)
k++;
}
}
- if (k == 0)
+ if (k == 0) {
/* No enabled RQ to configure for RSS. */
+ rte_free(attr);
return 0;
+ }
num = (int)k;
for (j = 0; k != rqt_n; ++k, ++j)
attr->rq_list[k] = attr->rq_list[j];
--
2.25.1