]> www.infradead.org Git - nvme.git/commitdiff
net/mlx5: HWS, fixed double free in error flow of definer layout
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Tue, 15 Oct 2024 09:32:02 +0000 (12:32 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 17 Oct 2024 10:14:07 +0000 (12:14 +0200)
Fix error flow bug that could lead to double free of a buffer
during a failure to calculate a suitable definer layout.

Fixes: 74a778b4a63f ("net/mlx5: HWS, added definers handling")
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Itamar Gozlan <igozlan@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_definer.c

index d566d2ddf42435d2f0a93ef0cfd7017bbe69b0c3..3f4c58bada3745c1bae45980c38e0567f90bdab7 100644 (file)
@@ -1925,7 +1925,7 @@ mlx5hws_definer_calc_layout(struct mlx5hws_context *ctx,
        ret = hws_definer_conv_match_params_to_hl(ctx, mt, match_hl);
        if (ret) {
                mlx5hws_err(ctx, "Failed to convert items to header layout\n");
-               goto free_fc;
+               goto free_match_hl;
        }
 
        /* Find the match definer layout for header layout match union */
@@ -1946,7 +1946,7 @@ mlx5hws_definer_calc_layout(struct mlx5hws_context *ctx,
 
 free_fc:
        kfree(mt->fc);
-
+free_match_hl:
        kfree(match_hl);
        return ret;
 }