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 <fgao@ikuai8.com>
Tested-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Gao Feng 2016-08-19 13:36:23 +08:00 committed by David S. Miller
parent 4c2f245496
commit 56cff471d0

View file

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