l2tp: Fix the connect status check in pppol2tp_getname

The sk->sk_state is bits flag, so need use bit operation check
instead of value check.

Signed-off-by: Gao Feng <[email protected]>
Tested-by: Guillaume Nault <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Gao Feng 2016-08-19 13:36:23 +08:00 • committed by David S. Miller
commit 56cff471d0

View file

@ -856,7 +856,7 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
error = -ENOTCONN;
if (sk == NULL)
goto end;
if (sk->sk_state != PPPOX_CONNECTED)
if (!(sk->sk_state & PPPOX_CONNECTED))
goto end;
error = -EBADF;