diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2018-04-23 16:38:27 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-24 03:12:15 +0200 |
commit | a49e2f5d5fb141884452ddb428f551b123d436b5 (patch) | |
tree | ab6db419604880f6a732256c543be5adfbd2a2d9 /drivers/net/ppp | |
parent | l2tp: check sockaddr length in pppol2tp_connect() (diff) | |
download | linux-a49e2f5d5fb141884452ddb428f551b123d436b5.tar.xz linux-a49e2f5d5fb141884452ddb428f551b123d436b5.zip |
pppoe: check sockaddr length in pppoe_connect()
We must validate sockaddr_len, otherwise userspace can pass fewer data
than we expect and we end up accessing invalid data.
Fixes: 224cf5ad14c0 ("ppp: Move the PPP drivers")
Reported-by: syzbot+4f03bdf92fdf9ef5ddab@syzkaller.appspotmail.com
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ppp')
-rw-r--r-- | drivers/net/ppp/pppoe.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 1483bc7b01e1..7df07337d69c 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c @@ -620,6 +620,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; |