Eric Dumazet
263243d6c2
net/ipv6: Fix ip6_convert_metrics() bug
If ip6_convert_metrics() fails to allocate memory, it should not
overwrite rt->fib6_metrics or we risk a crash later as syzbot found.
BUG: KASAN: null-ptr-deref in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: null-ptr-deref in refcount_sub_and_test+0x92/0x330 lib/refcount.c:179
Read of size 4 at addr 0000000000000044 by task syzkaller832429/4487
CPU: 1 PID: 4487 Comm: syzkaller832429 Not tainted 4.16.0+ #6
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1b9/0x294 lib/dump_stack.c:113
kasan_report_error mm/kasan/report.c:352 [inline]
kasan_report.cold.7+0x6d/0x2fe 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
kasan_check_read+0x11/0x20 mm/kasan/kasan.c:272
atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
refcount_sub_and_test+0x92/0x330 lib/refcount.c:179
refcount_dec_and_test+0x1a/0x20 lib/refcount.c:212
fib6_info_destroy+0x2d0/0x3c0 net/ipv6/ip6_fib.c:206
fib6_info_release include/net/ip6_fib.h:304 [inline]
ip6_route_info_create+0x677/0x3240 net/ipv6/route.c:3020
ip6_route_add+0x23/0xb0 net/ipv6/route.c:3030
inet6_rtm_newroute+0x142/0x160 net/ipv6/route.c:4406
rtnetlink_rcv_msg+0x466/0xc10 net/core/rtnetlink.c:4648
netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2448
rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4666
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x58b/0x740 net/netlink/af_netlink.c:1336
netlink_sendmsg+0x9f0/0xfa0 net/netlink/af_netlink.c:1901
sock_sendmsg_nosec net/socket.c:629 [inline]
sock_sendmsg+0xd5/0x120 net/socket.c:639
___sys_sendmsg+0x805/0x940 net/socket.c:2117
__sys_sendmsg+0x115/0x270 net/socket.c:2155
SYSC_sendmsg net/socket.c:2164 [inline]
SyS_sendmsg+0x29/0x30 net/socket.c:2162
do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x42/0xb7
Fixes: d4ead6b34b ("net/ipv6: move metrics from dst to rt6_info")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: David Ahern <dsa@cumulusnetworks.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-04-20 11:36:15 -04:00
..
2018-03-27 13:18:09 -04:00
2018-04-04 12:04:59 -04:00
2017-10-20 13:15:07 +01:00
2018-04-19 15:40:13 -04:00
2018-03-27 13:18:09 -04:00
2018-04-17 13:19:22 -04:00
2017-11-15 11:56:19 -08:00
2018-04-19 15:40:13 -04:00
2017-07-04 22:35:16 +01:00
2018-04-04 11:31:57 -04:00
2018-02-27 10:46:01 +01:00
2018-01-17 00:10:42 -05:00
2018-02-28 11:43:28 -05:00
2018-04-17 13:39:51 -04:00
2017-09-01 20:33:42 -07:00
2018-03-27 13:18:09 -04:00
2017-05-21 13:42:36 -04:00
2018-03-27 13:18:09 -04:00
2017-01-28 10:33:06 -05:00
2017-12-03 10:18:28 -05:00
2018-02-16 15:57:42 -05:00
2018-04-19 15:40:13 -04:00
2018-03-27 13:18:09 -04:00
2018-04-05 15:16:15 -04:00
2017-11-02 11:10:55 +01:00
2018-04-17 13:39:51 -04:00
2017-10-08 10:12:15 -07:00
2018-04-17 23:41:17 -04:00
2018-04-05 15:16:15 -04:00
2018-04-05 15:16:15 -04:00
2018-03-27 13:18:09 -04:00
2018-02-28 11:43:28 -05:00
2018-03-01 13:13:23 -05:00
2017-11-02 11:10:55 +01:00
2018-03-27 13:18:09 -04:00
2016-12-25 17:21:23 +01:00
2018-04-19 15:40:12 -04:00
2018-02-25 20:51:13 +01:00
2017-11-24 01:37:35 +09:00
2018-04-04 11:31:57 -04:00
2018-03-31 23:25:39 -04:00
2017-03-24 13:17:07 -07:00
2018-03-27 13:18:09 -04:00
2018-04-18 23:19:39 -04:00
2018-04-20 11:36:15 -04:00
2017-09-01 18:35:23 -07:00
2018-03-30 14:14:33 -04:00
2018-03-04 13:04:22 -05:00
2018-03-27 13:18:09 -04:00
2018-04-05 15:16:15 -04:00
2018-03-25 20:53:54 -04:00
2018-03-27 13:18:09 -04:00
2018-03-31 23:33:04 -04:00
2018-01-22 16:01:30 -05:00
2017-11-02 11:10:55 +01:00
2018-01-22 16:01:30 -05:00
2018-04-04 11:31:57 -04:00
2018-03-27 13:18:09 -04:00
2017-12-19 08:23:21 +01:00
2017-06-16 11:48:39 -04:00
2017-06-02 13:57:27 -04:00
2017-06-02 13:57:27 -04:00
2018-03-07 10:54:29 +01:00
2018-03-04 17:49:17 -05:00
2018-04-17 23:41:18 -04:00
2017-02-09 10:22:17 +01:00
2018-02-28 11:43:28 -05:00
2018-03-27 13:18:09 -04:00