Commit dbf57fd1 authored by Guillaume Nault's avatar Guillaume Nault Committed by Greg Kroah-Hartman

l2tp: check sockaddr length in pppol2tp_connect()

[ Upstream commit eb1c28c0 ]

Check sockaddr_len before dereferencing sp->sa_protocol, to ensure that
it actually points to valid data.

Fixes: fd558d18 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
Signed-off-by: default avatarGuillaume Nault <>
Signed-off-by: default avatarDavid S. Miller <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent c7a936b1
......@@ -591,6 +591,13 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
error = -EINVAL;
if (sockaddr_len != sizeof(struct sockaddr_pppol2tp) &&
sockaddr_len != sizeof(struct sockaddr_pppol2tpv3) &&
sockaddr_len != sizeof(struct sockaddr_pppol2tpin6) &&
sockaddr_len != sizeof(struct sockaddr_pppol2tpv3in6))
goto end;
if (sp->sa_protocol != PX_PROTO_OL2TP)
goto end;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment