Ido Schimmel
30188bd783
rtnetlink: Reject negative ifindexes in RTM_NEWLINK
...
Negative ifindexes are illegal, but the kernel does not validate the
ifindex in the ancillary header of RTM_NEWLINK messages, resulting in
the kernel generating a warning [1] when such an ifindex is specified.
Fix by rejecting negative ifindexes.
[1]
WARNING: CPU: 0 PID: 5031 at net/core/dev.c:9593 dev_index_reserve+0x1a2/0x1c0 net/core/dev.c:9593
[...]
Call Trace:
<TASK>
register_netdevice+0x69a/0x1490 net/core/dev.c:10081
br_dev_newlink+0x27/0x110 net/bridge/br_netlink.c:1552
rtnl_newlink_create net/core/rtnetlink.c:3471 [inline]
__rtnl_newlink+0x115e/0x18c0 net/core/rtnetlink.c:3688
rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3701
rtnetlink_rcv_msg+0x439/0xd30 net/core/rtnetlink.c:6427
netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
sock_sendmsg_nosec net/socket.c:728 [inline]
sock_sendmsg+0xd9/0x180 net/socket.c:751
____sys_sendmsg+0x6ac/0x940 net/socket.c:2538
___sys_sendmsg+0x135/0x1d0 net/socket.c:2592
__sys_sendmsg+0x117/0x1e0 net/socket.c:2621
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fixes: 38f7b870d4a6 ("[RTNETLINK]: Link creation API")
Reported-by: syzbot+5ba06978f34abb058571@syzkaller.appspotmail.com
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20230823064348.2252280-1-idosch@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-08-24 09:45:52 +02:00
..
2023-07-27 10:07:56 -07:00
2023-05-10 19:06:49 -07:00
2022-10-27 02:40:14 -06:00
2022-04-07 20:32:09 -07:00
2023-04-09 15:35:49 +01:00
2023-06-22 19:55:12 -07:00
2023-02-09 17:45:55 -08:00
2023-04-20 20:20:49 -07:00
2021-11-29 19:50:45 -08:00
2023-04-21 20:26:56 -07:00
2022-12-12 15:18:25 -08:00
2021-12-16 07:18:35 -08:00
2023-08-07 19:14:41 -07:00
2023-06-12 17:01:45 -07:00
2022-11-14 11:24:16 +00:00
2022-12-25 13:38:09 -08:00
2022-10-28 20:13:54 -07:00
2022-09-28 18:57:14 -07:00
2023-06-18 18:08:35 +01:00
2023-06-10 00:11:41 -07:00
2022-11-16 09:45:00 +00:00
2022-04-22 17:45:25 +02:00
2022-10-12 10:45:51 +02:00
2023-06-10 00:11:41 -07:00
2023-03-21 21:32:18 -07:00
2023-06-05 15:28:42 -07:00
2023-03-22 12:03:52 +01:00
2023-02-20 11:22:54 +00:00
2023-07-07 09:16:52 +01:00
2022-08-31 09:40:34 +01:00
2023-05-26 10:30:14 +01:00
2023-05-26 10:30:14 +01:00
2023-02-02 20:48:23 -08:00
2021-03-28 17:56:56 -07:00
2023-06-15 08:21:11 +01:00
2021-09-13 16:35:58 -07:00
2022-11-29 10:45:53 +01:00
2023-05-23 20:25:13 -07:00
2023-05-13 19:47:56 +01:00
2022-03-07 11:31:34 +00:00
2023-08-24 09:45:52 +02:00
2023-04-14 11:09:27 +01:00
2022-07-20 10:14:49 +01:00
2021-10-24 13:59:44 +01:00
2023-07-08 10:03:26 +01:00
2023-08-09 20:29:02 -07:00
2021-10-22 12:35:51 -07:00
2022-11-21 20:36:30 -08:00
2023-08-09 20:29:02 -07:00
2022-10-25 11:35:16 +02:00
2023-08-17 11:34:36 -07:00
2023-05-10 10:03:32 +01:00
2023-04-05 13:48:04 +00:00
2022-12-12 15:04:39 -08:00
2022-11-01 21:14:39 -07:00
2023-07-11 20:04:50 -07:00