]> git.itanic.dy.fi Git - linux-stable/commit
net/mlx5: Fix UAF in mlx5_eswitch_cleanup()
authorShay Drory <shayd@nvidia.com>
Wed, 14 Jun 2023 13:26:07 +0000 (16:26 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Fri, 23 Jun 2023 19:27:32 +0000 (12:27 -0700)
commitda744fd1362cd8ccf71043c62825cb88cb946886
tree05d0016599a052e8cd63fc838b9557e06939e0ad
parentfaaa5fd30344f9a7b3816ae7a6b58ccd5a34998f
net/mlx5: Fix UAF in mlx5_eswitch_cleanup()

mlx5_eswitch_cleanup() is using esw right after freeing it for
releasing devlink_param.
Fix it by releasing the devlink_param before freeing the esw, and
adjust the create function accordingly.

Fixes: 3f90840305e2 ("net/mlx5: Move esw multiport devlink param to eswitch code")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Automatic Verification <verifier@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c