Eric Dumazet
9cb726a212
ip_tunnel: better validate user provided tunnel names
...
Use dev_valid_name() to make sure user does not provide illegal
device name.
syzbot caught the following bug :
BUG: KASAN: stack-out-of-bounds in strlcpy include/linux/string.h:300 [inline]
BUG: KASAN: stack-out-of-bounds in __ip_tunnel_create+0xca/0x6b0 net/ipv4/ip_tunnel.c:257
Write of size 20 at addr ffff8801ac79f810 by task syzkaller268107/4482
CPU: 0 PID: 4482 Comm: syzkaller268107 Not tainted 4.16.0+ #1
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+0x1b9/0x29f lib/dump_stack.c:53
print_address_description+0x6c/0x20b mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
memcpy+0x37/0x50 mm/kasan/kasan.c:303
strlcpy include/linux/string.h:300 [inline]
__ip_tunnel_create+0xca/0x6b0 net/ipv4/ip_tunnel.c:257
ip_tunnel_create net/ipv4/ip_tunnel.c:352 [inline]
ip_tunnel_ioctl+0x818/0xd40 net/ipv4/ip_tunnel.c:861
ipip_tunnel_ioctl+0x1c5/0x420 net/ipv4/ipip.c:350
dev_ifsioc+0x43e/0xb90 net/core/dev_ioctl.c:334
dev_ioctl+0x69a/0xcc0 net/core/dev_ioctl.c:525
sock_ioctl+0x47e/0x680 net/socket.c:1015
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x1cf/0x1650 fs/ioctl.c:684
ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701
SYSC_ioctl fs/ioctl.c:708 [inline]
SyS_ioctl+0x24/0x30 fs/ioctl.c:706
do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x42/0xb7
Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-04-05 15:16:15 -04:00
..
2017-11-02 11:10:55 +01:00
2018-02-15 14:29:27 -08:00
2017-11-21 15:57:07 -08:00
2018-04-01 20:53:50 -04:00
2018-03-26 12:07:48 -04:00
2018-03-26 12:07:48 -04:00
2018-03-26 12:07:48 -04:00
2018-04-01 19:49:34 -04:00
2018-04-01 21:43:03 +03:00
2018-02-01 07:43:56 -08:00
2018-03-31 22:19:00 -04:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2018-03-26 12:07:48 -04:00
2018-04-05 15:16:15 -04:00
2018-03-27 13:18:09 -04:00
2018-03-26 12:07:48 -04:00
2018-03-26 12:07:48 -04:00
2018-03-23 11:31:58 -04:00
2017-10-25 13:00:27 +09:00
2018-04-04 12:04:59 -04:00
2017-11-01 12:19:03 +09:00
2018-04-05 15:16:15 -04:00
2018-04-04 12:04:59 -04:00
2018-03-23 11:31:58 -04:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2017-11-21 16:35:54 -08:00
2018-04-01 19:49:34 -04:00
2018-03-29 16:23:26 -04:00
2018-03-28 22:55:18 +02:00
2018-03-27 13:18:09 -04:00
2018-03-27 10:38:26 -04:00
2018-04-01 19:49:34 -04:00
2017-11-18 10:32:41 +09:00
2018-04-01 19:49:34 -04:00
2018-03-26 12:07:48 -04:00
2018-02-19 18:46:11 -05:00
2017-11-08 16:12:33 +09:00
2018-03-29 13:47:54 -04:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2017-11-01 12:19:03 +09:00
2018-03-06 01:20:46 -05:00
2018-03-27 13:18:09 -04:00
2018-02-11 14:34:03 -08:00
2018-03-26 12:07:48 -04:00
2018-04-04 11:04:08 -04:00
2018-04-01 20:53:50 -04:00
2018-03-29 14:38:27 -04:00
2018-04-01 19:49:34 -04:00
2018-03-27 11:00:18 -04:00
2018-03-27 13:18:09 -04:00
2017-11-10 13:41:40 +09:00
2018-04-04 11:54:35 -04:00
2018-03-31 23:37:32 -04:00
2018-04-04 11:13:40 -04:00
2018-02-12 14:15:04 -05:00
2017-11-02 11:10:55 +01:00
2018-03-31 23:33:04 -04:00
2018-03-26 12:07:48 -04:00
2018-04-01 19:49:34 -04:00
2018-04-02 20:15:20 +02:00
2018-02-01 09:51:57 -08:00
2017-11-28 13:55:00 +01:00
2018-04-03 14:04:18 -07:00
2018-03-27 13:18:09 -04:00