net/mlx5: E-Switch, Fix an Oops in error handling code
authorDan Carpenter <error27@gmail.com>
Mon, 27 Feb 2023 11:16:10 +0000 (14:16 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 21 Mar 2023 21:06:32 +0000 (14:06 -0700)
The error handling dereferences "vport".  There is nothing we can do if
it is an error pointer except returning the error code.

Fixes: 133dcfc577ea ("net/mlx5: E-Switch, Alloc and free unique metadata for match")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c

index d55775627a473a698638b2b2fff4e0c7e55a195b..50d2ea32397982884bb6618d1b1da53bf7ca53d5 100644 (file)
@@ -364,8 +364,7 @@ int mlx5_esw_acl_ingress_vport_metadata_update(struct mlx5_eswitch *esw, u16 vpo
 
        if (WARN_ON_ONCE(IS_ERR(vport))) {
                esw_warn(esw->dev, "vport(%d) invalid!\n", vport_num);
-               err = PTR_ERR(vport);
-               goto out;
+               return PTR_ERR(vport);
        }
 
        esw_acl_ingress_ofld_rules_destroy(esw, vport);