Wei Wang
7bbfe00e02
ipv6: fix general protection fault in fib6_add()
...
In fib6_add(), pn could be NULL if fib6_add_1() failed to return a fib6
node. Checking pn != fn before accessing pn->leaf makes sure pn is not
NULL.
This fixes the following GPF reported by syzkaller:
general protection fault: 0000 [#1 ] SMP KASAN
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 3201 Comm: syzkaller001778 Not tainted 4.15.0-rc5+ #151
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:fib6_add+0x736/0x15a0 net/ipv6/ip6_fib.c:1244
RSP: 0018:ffff8801c7626a70 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000020 RCX: ffffffff84794465
RDX: 0000000000000004 RSI: ffff8801d38935f0 RDI: 0000000000000282
RBP: ffff8801c7626da0 R08: 1ffff10038ec4c35 R09: 0000000000000000
R10: ffff8801c7626c68 R11: 0000000000000000 R12: 00000000fffffffe
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000009
FS: 0000000000000000(0000) GS:ffff8801db200000(0063) knlGS:0000000009b70840
CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
CR2: 0000000020be1000 CR3: 00000001d585a006 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
__ip6_ins_rt+0x6c/0x90 net/ipv6/route.c:1006
ip6_route_multipath_add+0xd14/0x16c0 net/ipv6/route.c:3833
inet6_rtm_newroute+0xdc/0x160 net/ipv6/route.c:3957
rtnetlink_rcv_msg+0x733/0x1020 net/core/rtnetlink.c:4411
netlink_rcv_skb+0x21e/0x460 net/netlink/af_netlink.c:2408
rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4423
netlink_unicast_kernel net/netlink/af_netlink.c:1275 [inline]
netlink_unicast+0x4e8/0x6f0 net/netlink/af_netlink.c:1301
netlink_sendmsg+0xa4a/0xe60 net/netlink/af_netlink.c:1864
sock_sendmsg_nosec net/socket.c:636 [inline]
sock_sendmsg+0xca/0x110 net/socket.c:646
sock_write_iter+0x31a/0x5d0 net/socket.c:915
call_write_iter include/linux/fs.h:1772 [inline]
do_iter_readv_writev+0x525/0x7f0 fs/read_write.c:653
do_iter_write+0x154/0x540 fs/read_write.c:932
compat_writev+0x225/0x420 fs/read_write.c:1246
do_compat_writev+0x115/0x220 fs/read_write.c:1267
C_SYSC_writev fs/read_write.c:1278 [inline]
compat_SyS_writev+0x26/0x30 fs/read_write.c:1274
do_syscall_32_irqs_on arch/x86/entry/common.c:327 [inline]
do_fast_syscall_32+0x3ee/0xf9d arch/x86/entry/common.c:389
entry_SYSENTER_compat+0x54/0x63 arch/x86/entry/entry_64_compat.S:125
Reported-by: syzbot <syzkaller@googlegroups.com >
Fixes: 66f5d6ce53
("ipv6: replace rwlock with rcu and spinlock in fib6_table")
Signed-off-by: Wei Wang <weiwan@google.com >
Signed-off-by: David S. Miller <davem@davemloft.net >
2018-01-04 14:29:20 -05:00
..
2017-11-08 11:20:49 +09:00
2017-12-11 17:04:50 +01:00
2017-10-20 13:15:07 +01:00
2017-11-21 15:57:07 -08:00
2017-11-04 09:26:51 +09:00
2017-12-21 13:07:20 -05:00
2017-11-15 11:56:19 -08:00
2017-07-04 01:29:04 -07:00
2017-07-04 22:35:16 +01:00
2017-07-01 07:39:08 -07:00
2017-09-01 17:42:05 -07:00
2017-11-15 11:56:19 -08:00
2017-10-05 21:53:02 -07:00
2017-11-03 09:50:22 +09:00
2017-09-01 20:33:42 -07:00
2017-08-08 21:40:08 -07:00
2017-05-21 13:42:36 -04:00
2017-10-18 14:13:08 +01:00
2017-01-28 10:33:06 -05:00
2017-08-07 11:39:22 -07:00
2017-11-02 11:10:55 +01:00
2018-01-04 14:29:20 -05:00
2017-11-21 15:57:05 -08:00
2017-12-26 12:21:19 -05:00
2017-11-02 11:10:55 +01:00
2017-04-20 10:35:33 -04:00
2017-10-08 10:12:15 -07:00
2016-04-07 16:53:29 -04:00
2017-12-21 13:07:20 -05:00
2018-01-02 12:36:14 -05:00
2016-11-02 15:18:36 -04:00
2017-10-05 18:19:22 -07:00
2017-11-21 15:57:07 -08:00
2016-11-04 14:45:23 -04:00
2017-12-21 13:07:20 -05:00
2017-08-25 17:10:24 -07:00
2017-11-02 11:10:55 +01:00
2017-12-13 13:13:15 -05:00
2016-12-25 17:21:23 +01:00
2017-11-11 15:13:02 +09:00
2016-11-04 14:45:23 -04:00
2017-11-24 01:37:35 +09:00
2017-10-06 09:52:31 -07:00
2017-06-12 09:53:14 -04:00
2017-03-24 13:17:07 -07:00
2017-10-18 14:13:08 +01:00
2017-10-18 12:39:55 +01:00
2017-12-21 11:51:06 -05:00
2017-09-01 18:35:23 -07:00
2017-08-25 17:10:23 -07:00
2017-09-11 14:34:10 -07:00
2017-08-07 14:16:22 -07:00
2017-11-30 10:25:41 -05:00
2017-10-28 19:24:38 +09:00
2017-11-04 09:26:51 +09:00
2017-12-12 11:15:42 -05:00
2017-11-02 11:10:55 +01:00
2017-11-24 01:37:35 +09:00
2017-10-25 11:01:08 +02:00
2016-11-24 15:32:14 -05: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
2017-04-14 10:07:39 +02:00
2017-04-14 10:06:10 +02:00
2017-11-04 09:26:51 +09:00
2017-02-09 10:22:17 +01:00
2017-11-02 11:10:55 +01:00
2017-11-14 15:46:17 +09:00