]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mlxsw: spectrum_acl: Fix mlxsw_sp_acl_tcam_group_add()'s error path
authorIdo Schimmel <idosch@nvidia.com>
Sun, 27 Sep 2020 06:42:11 +0000 (09:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Oct 2020 09:55:54 +0000 (11:55 +0200)
commit0ea7fe7c26efc467c8e73e30ab9187c6920bf163
tree99ee0eb4c41d688c6bb08d5f813baf2dd645ad0e
parent698075baae0b9790623360657918245a6f2e77a4
mlxsw: spectrum_acl: Fix mlxsw_sp_acl_tcam_group_add()'s error path

[ Upstream commit 72865028582a678be1e05240e55d452e5c258eca ]

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: 5ec2ee28d27b ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c