Skip to content

Commit 7286502

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum_acl: Fix mlxsw_sp_acl_tcam_group_add()'s error path
If mlxsw_sp_acl_tcam_group_id_get() fails, the mutex initialized earlier is not destroyed. Fix this by initializing the mutex after calling the function. This is symmetric to mlxsw_sp_acl_tcam_group_del(). Fixes: 5ec2ee2 ("mlxsw: spectrum_acl: Introduce a mutex to guard region list updates") Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7dbbcf4 commit 7286502

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,14 @@ mlxsw_sp_acl_tcam_group_add(struct mlxsw_sp_acl_tcam *tcam,
292292
int err;
293293

294294
group->tcam = tcam;
295-
mutex_init(&group->lock);
296295
INIT_LIST_HEAD(&group->region_list);
297296

298297
err = mlxsw_sp_acl_tcam_group_id_get(tcam, &group->id);
299298
if (err)
300299
return err;
301300

301+
mutex_init(&group->lock);
302+
302303
return 0;
303304
}
304305

0 commit comments

Comments
 (0)