linux/net/l2tp
Eric Dumazet bdb1a295ee l2tp: do not accept arbitrary sockets
[ Upstream commit 17cfe79a65 ]

syzkaller found an issue caused by lack of sufficient checks
in l2tp_tunnel_create()

RAW sockets can not be considered as UDP ones for instance.

In another patch, we shall replace all pr_err() by less intrusive
pr_debug() so that syzkaller can find other bugs faster.
Acked-by: Guillaume Nault <g.nault@alphalink.fr>
Acked-by: James Chapman <jchapman@katalix.com>

==================================================================
BUG: KASAN: slab-out-of-bounds in setup_udp_tunnel_sock+0x3ee/0x5f0 net/ipv4/udp_tunnel.c:69
dst_release: dst:00000000d53d0d0f refcnt:-1
Write of size 1 at addr ffff8801d013b798 by task syz-executor3/6242

CPU: 1 PID: 6242 Comm: syz-executor3 Not tainted 4.16.0-rc2+ #253
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x24d lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report+0x23b/0x360 mm/kasan/report.c:412
 __asan_report_store1_noabort+0x17/0x20 mm/kasan/report.c:435
 setup_udp_tunnel_sock+0x3ee/0x5f0 net/ipv4/udp_tunnel.c:69
 l2tp_tunnel_create+0x1354/0x17f0 net/l2tp/l2tp_core.c:1596
 pppol2tp_connect+0x14b1/0x1dd0 net/l2tp/l2tp_ppp.c:707
 SYSC_connect+0x213/0x4a0 net/socket.c:1640
 SyS_connect+0x24/0x30 net/socket.c:1621
 do_syscall_64+0x280/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Fixes: fd558d186d ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-31 18:12:33 +02:00
..
Kconfig l2tp: Call udp_sock_create 2014-07-14 16:12:15 -07:00
l2tp_core.c l2tp: do not accept arbitrary sockets 2018-03-31 18:12:33 +02:00
l2tp_core.h l2tp: fix race condition in l2tp_tunnel_delete 2017-10-21 17:09:03 +02:00
l2tp_debugfs.c l2tp: take reference on sessions being dumped 2017-05-02 21:19:52 -07:00
l2tp_eth.c l2tp: auto load type modules 2015-09-25 12:27:22 -07:00
l2tp_ip.c l2tp: avoid use-after-free caused by l2tp_ip_backlog_recv 2017-03-22 12:04:14 +01:00
l2tp_ip6.c l2tp: do not use udp_ioctl() 2017-02-18 16:39:28 +01:00
l2tp_netlink.c l2tp: cleanup l2tp_tunnel_delete calls 2017-12-20 10:04:59 +01:00
l2tp_ppp.c l2tp: check ps->sock before running pppol2tp_session_ioctl() 2017-11-18 11:11:05 +01:00
Makefile