]> git.baikalelectronics.ru Git - kernel.git/commitdiff
pppoe: check sockaddr length in pppoe_connect()
authorGuillaume Nault <g.nault@alphalink.fr>
Mon, 23 Apr 2018 14:38:27 +0000 (16:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Apr 2018 01:12:15 +0000 (21:12 -0400)
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>
drivers/net/ppp/pppoe.c

index 1483bc7b01e1a019e81ea98b06804f5a4361a3af..7df07337d69c90a1f1fe1ddd6611645d3ce751ee 100644 (file)
@@ -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;