tipc: fix unique bearer names sanity check
authorHoang Le <hoang.h.le@dektech.com.au>
Thu, 1 Apr 2021 02:30:48 +0000 (09:30 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jun 2021 11:24:05 +0000 (13:24 +0200)
commita13a42c573a496a05b528ddbe6ea32083f44e9f1
tree4ce292731111a1ce1a66b664c3ec2566c9e9343b
parent65281d6aeca781b024a3cc83df6b55b987877ae8
tipc: fix unique bearer names sanity check

[ Upstream commit f20a46c3044c3f75232b3d0e2d09af9b25efaf45 ]

When enabling a bearer by name, we don't sanity check its name with
higher slot in bearer list. This may have the effect that the name
of an already enabled bearer bypasses the check.

To fix the above issue, we just perform an extra checking with all
existing bearers.

Fixes: cb30a63384bc9 ("tipc: refactor function tipc_enable_bearer()")
Cc: stable@vger.kernel.org
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tipc/bearer.c