Skip to content

Commit

Permalink
pppoe: check sockaddr length in pppoe_connect()
Browse files Browse the repository at this point in the history
[ Upstream commit a49e2f5 ]

We must validate sockaddr_len, otherwise userspace can pass fewer data
than we expect and we end up accessing invalid data.

Fixes: 224cf5a ("ppp: Move the PPP drivers")
Reported-by: [email protected]
Signed-off-by: Guillaume Nault <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Guillaume Nault authored and gregkh committed Apr 29, 2018
1 parent 183f20f commit dedf29a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ppp/pppoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,10 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
lock_sock(sk);

error = -EINVAL;

if (sockaddr_len != sizeof(struct sockaddr_pppox))
goto end;

if (sp->sa_protocol != PX_PROTO_OE)
goto end;

Expand Down

0 comments on commit dedf29a

Please sign in to comment.