mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
l2tp: Correctly return -EBADF from pppol2tp_getname.
If 'tunnel' is NULL we should return -EBADF but the 'end_put_sess' path
unconditionally sets 'error' back to zero. Rework the error path so it
more closely matches pppol2tp_sendmsg.
Fixes: fd558d186d
("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0a91605cda
commit
4ac36a4ada
@ -866,10 +866,8 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
|
||||
|
||||
pls = l2tp_session_priv(session);
|
||||
tunnel = l2tp_sock_to_tunnel(pls->tunnel_sock);
|
||||
if (tunnel == NULL) {
|
||||
error = -EBADF;
|
||||
if (tunnel == NULL)
|
||||
goto end_put_sess;
|
||||
}
|
||||
|
||||
inet = inet_sk(tunnel->sock);
|
||||
if ((tunnel->version == 2) && (tunnel->sock->sk_family == AF_INET)) {
|
||||
@ -947,12 +945,11 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
|
||||
}
|
||||
|
||||
*usockaddr_len = len;
|
||||
error = 0;
|
||||
|
||||
sock_put(pls->tunnel_sock);
|
||||
end_put_sess:
|
||||
sock_put(sk);
|
||||
error = 0;
|
||||
|
||||
end:
|
||||
return error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user