net/mlx5: Fix dereference on pointer attr after null check
authorAriel Levkovich <lariel@nvidia.com>
Mon, 28 Sep 2020 16:34:10 +0000 (19:34 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 1 Oct 2020 04:26:31 +0000 (21:26 -0700)
commitfa8b8f3add0d52ed3a05b4a52c061ede0b2346e5
treedc4aafcc292f1ea2abf7e6b4ff2af78e80d35236
parent1d927808e06288232e23c6bd13736b2bf09b9ad4
net/mlx5: Fix dereference on pointer attr after null check

When removing a flow from the slow path fdb, a flow attr struct is
allocated for the rule removal process. If the allocation fails the
code prints a warning message but continues with the removal flow
which include dereferencing a pointer which could be null.
Fix this by exiting the function in case the attr allocation failed.

Fixes: a650fb5166d6 ("net/mlx5: Refactor tc flow attributes structure")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ariel Levkovich <lariel@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c