summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAriel Levkovich <lariel@nvidia.com>2022-08-16 23:19:11 +0300
committerSaeed Mahameed <saeedm@nvidia.com>2023-01-10 09:08:33 +0300
commite0bf81bf0d3d4747c146e0bf44774d3d881d7137 (patch)
tree37852264ace4aa38937b7336491ee7b2ae2fa38a /drivers
parent17b3222e943701c408d6e03357967829aaea0550 (diff)
downloadlinux-e0bf81bf0d3d4747c146e0bf44774d3d881d7137.tar.xz
net/mlx5: check attr pointer validity before dereferencing it
Fix attr pointer validity checks after it was already dereferenced. Fixes: cb0d54cbf948 ("net/mlx5e: Fix wrong source vport matching on tunnel rule") Signed-off-by: Ariel Levkovich <lariel@nvidia.com> Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index e455b215c708..75b77dd2392b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -143,7 +143,7 @@ mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw,
if (mlx5_esw_indir_table_decap_vport(attr))
vport = mlx5_esw_indir_table_decap_vport(attr);
- if (attr && !attr->chain && esw_attr->int_port)
+ if (!attr->chain && esw_attr && esw_attr->int_port)
metadata =
mlx5e_tc_int_port_get_metadata_for_match(esw_attr->int_port);
else