From: Gao Feng Date: Fri, 19 Aug 2016 05:36:23 +0000 (+0800) Subject: l2tp: Fix the connect status check in pppol2tp_getname X-Git-Tag: v4.8-rc5~34^2~46 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=56cff471d0c62b721a298f806e7637501debb513;p=karo-tx-linux.git 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 Tested-by: Guillaume Nault Signed-off-by: David S. Miller --- diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index d9560aa2dba3..232cb92033e8 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -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;