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)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Apr 2021 22:43:31 +0000 (15:43 -0700)
commitf20a46c3044c3f75232b3d0e2d09af9b25efaf45
treec7ca47733393efd07765b9bebf434b064382bea0
parent247ca657e20460375bf3217073d6477440f48025
tipc: fix unique bearer names sanity check

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>
net/tipc/bearer.c