netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] pppoe: check sockaddr length in pppoe_connect()
@ 2018-04-23 14:38 Guillaume Nault
  2018-04-24  1:12 ` David Miller
  2018-04-27 12:23 ` Kevin Easton
  0 siblings, 2 replies; 8+ messages in thread
From: Guillaume Nault @ 2018-04-23 14:38 UTC (permalink / raw)
  To: netdev; +Cc: Michal Ostrowski

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>
---
 drivers/net/ppp/pppoe.c | 4 ++++
 1 file changed, 4 insertions(+)

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;
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-27 16:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-23 14:38 [PATCH net] pppoe: check sockaddr length in pppoe_connect() Guillaume Nault
2018-04-24  1:12 ` David Miller
2018-04-27 12:23 ` Kevin Easton
2018-04-27 15:39   ` Guillaume Nault
2018-04-27 15:51     ` Kevin Easton
2018-04-27 16:24       ` Guillaume Nault
2018-04-27 16:27         ` Guillaume Nault
2018-04-27 16:01     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).