Skip to content

Commit

Permalink
net/mlx5: check attr pointer validity before dereferencing it
Browse files Browse the repository at this point in the history
[ Upstream commit e0bf81b ]

Fix attr pointer validity checks after it was already
dereferenced.

Fixes: cb0d54c ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Awik84 authored and gregkh committed Jan 18, 2023
1 parent 7697de4 commit 39124c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
Expand Up @@ -142,7 +142,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
Expand Down

0 comments on commit 39124c1

Please sign in to comment.