Skip to content

Commit 80b2bd7

Browse files
rleonSaeed Mahameed
authored andcommitted
net/mlx5: Don't use already freed action pointer
The call to mlx5dr_action_destroy() releases "action" memory. That pointer is set to miss_action later and generates the following smatch error: drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c:53 set_miss_action() warn: 'action' was already freed. Make sure that the pointer is always valid by setting NULL after destroy. Fixes: 6a48fae ("net/mlx5: Add direct rule fs_cmd implementation") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 09e545f commit 80b2bd7

File tree

1 file changed

+4
-5
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/steering

1 file changed

+4
-5
lines changed

drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ static int set_miss_action(struct mlx5_flow_root_namespace *ns,
4444
err = mlx5dr_table_set_miss_action(ft->fs_dr_table.dr_table, action);
4545
if (err && action) {
4646
err = mlx5dr_action_destroy(action);
47-
if (err) {
48-
action = NULL;
49-
mlx5_core_err(ns->dev, "Failed to destroy action (%d)\n",
50-
err);
51-
}
47+
if (err)
48+
mlx5_core_err(ns->dev,
49+
"Failed to destroy action (%d)\n", err);
50+
action = NULL;
5251
}
5352
ft->fs_dr_table.miss_action = action;
5453
if (old_miss_action) {

0 commit comments

Comments
 (0)