Nikolay Aleksandrov
eeaac3634e
net: nexthop: don't allow empty NHA_GROUP
...
Currently the nexthop code will use an empty NHA_GROUP attribute, but it
requires at least 1 entry in order to function properly. Otherwise we
end up derefencing null or random pointers all over the place due to not
having any nh_grp_entry members allocated, nexthop code relies on having at
least the first member present. Empty NHA_GROUP doesn't make any sense so
just disallow it.
Also add a WARN_ON for any future users of nexthop_create_group().
BUG: kernel NULL pointer dereference, address: 0000000000000080
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 0 P4D 0
Oops: 0000 [#1 ] SMP
CPU: 0 PID: 558 Comm: ip Not tainted 5.9.0-rc1+ #93
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014
RIP: 0010:fib_check_nexthop+0x4a/0xaa
Code: 0f 84 83 00 00 00 48 c7 02 80 03 f7 81 c3 40 80 fe fe 75 12 b8 ea ff ff ff 48 85 d2 74 6b 48 c7 02 40 03 f7 81 c3 48 8b 40 10 <48> 8b 80 80 00 00 00 eb 36 80 78 1a 00 74 12 b8 ea ff ff ff 48 85
RSP: 0018:ffff88807983ba00 EFLAGS: 00010213
RAX: 0000000000000000 RBX: ffff88807983bc00 RCX: 0000000000000000
RDX: ffff88807983bc00 RSI: 0000000000000000 RDI: ffff88807bdd0a80
RBP: ffff88807983baf8 R08: 0000000000000dc0 R09: 000000000000040a
R10: 0000000000000000 R11: ffff88807bdd0ae8 R12: 0000000000000000
R13: 0000000000000000 R14: ffff88807bea3100 R15: 0000000000000001
FS: 00007f10db393700(0000) GS:ffff88807dc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000080 CR3: 000000007bd0f004 CR4: 00000000003706f0
Call Trace:
fib_create_info+0x64d/0xaf7
fib_table_insert+0xf6/0x581
? __vma_adjust+0x3b6/0x4d4
inet_rtm_newroute+0x56/0x70
rtnetlink_rcv_msg+0x1e3/0x20d
? rtnl_calcit.isra.0+0xb8/0xb8
netlink_rcv_skb+0x5b/0xac
netlink_unicast+0xfa/0x17b
netlink_sendmsg+0x334/0x353
sock_sendmsg_nosec+0xf/0x3f
____sys_sendmsg+0x1a0/0x1fc
? copy_msghdr_from_user+0x4c/0x61
___sys_sendmsg+0x63/0x84
? handle_mm_fault+0xa39/0x11b5
? sockfd_lookup_light+0x72/0x9a
__sys_sendmsg+0x50/0x6e
do_syscall_64+0x54/0xbe
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f10dacc0bb7
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb cd 66 0f 1f 44 00 00 8b 05 9a 4b 2b 00 85 c0 75 2e 48 63 ff 48 63 d2 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 8b 15 b1 f2 2a 00 f7 d8 64 89 02 48
RSP: 002b:00007ffcbe628bf8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007ffcbe628f80 RCX: 00007f10dacc0bb7
RDX: 0000000000000000 RSI: 00007ffcbe628c60 RDI: 0000000000000003
RBP: 000000005f41099c R08: 0000000000000001 R09: 0000000000000008
R10: 00000000000005e9 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007ffcbe628d70 R15: 0000563a86c6e440
Modules linked in:
CR2: 0000000000000080
CC: David Ahern <dsahern@gmail.com>
Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
Reported-by: syzbot+a61aa19b0c14c8770bd9@syzkaller.appspotmail.com
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-08-22 12:39:55 -07:00
..
2020-08-10 12:06:44 -07:00
2020-08-05 20:13:21 -07:00
2020-07-19 18:16:40 -07:00
2020-03-12 15:55:00 -07:00
2020-03-12 15:55:00 -07:00
2020-03-30 19:52:37 -07:00
2020-07-13 17:20:39 -07:00
2019-11-01 14:57:52 -07:00
2020-05-31 17:48:46 -07:00
2020-06-20 21:33:57 -07:00
2020-02-19 13:52:32 +01:00
2020-05-26 16:06:07 -07:00
2020-03-29 22:30:57 -07:00
2019-10-04 11:10:56 -07:00
2020-07-28 17:42:31 -07:00
2020-06-18 20:21:51 -07:00
2020-08-02 01:02:12 -07:00
2020-06-20 21:33:57 -07:00
2020-03-08 21:25:37 -07:00
2020-08-03 15:29:44 -07:00
2020-07-24 17:12:41 -07:00
2020-05-20 20:31:27 -04:00
2020-08-11 15:49:08 -07:00
2020-07-09 12:38:41 -07:00
2019-08-08 15:55:10 -07:00
2020-08-11 15:49:08 -07:00
2019-05-21 10:50:45 +02:00
2019-11-07 16:15:56 -08:00
2019-09-20 18:23:33 -07:00
2019-08-08 15:55:10 -07:00
2020-05-19 15:45:11 -07:00
2020-03-30 13:45:04 -07:00
2020-07-24 15:41:54 -07:00
2020-07-11 00:46:00 -07:00
2020-07-24 17:12:41 -07:00
2020-08-12 13:26:37 -07:00
2020-06-18 20:12:34 -07:00
2020-07-30 14:39:31 -07:00
2020-07-09 12:55:37 +02:00
2020-03-02 13:11:46 -07:00
2020-06-30 12:29:39 -07:00
2019-10-04 11:10:56 -07:00
2020-07-27 11:39:55 -07:00
2020-08-18 16:02:16 -07:00
2020-07-10 13:54:00 -07:00
2019-05-21 10:50:45 +02:00
2019-01-28 11:32:58 +01:00
2019-05-21 10:50:45 +02:00
2020-08-22 12:39:55 -07:00
2020-07-07 15:26:37 -07:00
2020-07-17 12:54:30 -07:00
2019-05-30 11:26:32 -07:00
2020-03-12 22:34:48 -07:00
2020-07-24 15:41:54 -07:00
2020-08-04 13:01:45 -07:00
2020-08-01 11:46:29 -07:00
2020-08-10 12:12:35 -07:00
2020-01-21 10:45:49 +01:00
2020-03-16 18:26:54 -07:00
2020-06-12 15:10:12 -07:00
2019-05-21 10:50:45 +02:00
2020-07-09 13:07:45 -07:00
2020-06-25 16:08:47 -07:00
2019-05-30 11:26:32 -07:00
2018-10-10 22:26:00 -07:00
2020-02-27 18:50:19 -08:00
2020-08-13 20:03:11 -07:00
2020-07-06 13:23:03 -07:00
2020-07-06 13:23:03 -07:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2020-08-03 17:54:03 -07:00
2020-07-25 20:16:32 -07:00
2019-05-21 10:50:45 +02:00
2019-12-09 20:17:48 -08:00
2020-05-15 12:30:13 -07:00
2019-05-21 10:50:45 +02:00
2019-05-30 11:26:32 -07:00
2020-07-31 16:55:32 -07:00
2019-05-21 10:50:45 +02:00
2018-09-21 19:37:59 -07:00
2020-03-16 18:26:54 -07:00
2020-07-13 17:20:39 -07:00
2020-03-09 22:34:58 +01:00
2019-05-21 10:50:45 +02:00
2020-07-06 13:23:03 -07:00
2019-05-21 10:50:45 +02:00
2020-03-16 18:26:55 -07:00
2020-08-10 12:12:35 -07:00
2020-07-09 12:51:36 +02:00
2020-03-09 22:34:58 +01:00
2020-03-12 22:34:48 -07:00
2020-07-24 15:41:54 -07:00
2020-03-30 10:35:03 -07:00
2020-07-10 13:54:00 -07:00
2020-08-03 10:13:54 -07:00
2020-07-10 13:54:00 -07:00
2020-07-31 02:00:48 +02:00
2020-07-19 18:16:41 -07:00
2020-05-06 09:40:08 +02:00
2020-05-11 15:12:27 +02:00
2019-12-24 22:28:54 -08:00
2019-12-09 09:59:07 +01:00
2020-05-06 09:40:08 +02:00
2019-06-06 08:34:50 +02:00