Ido Schimmel
a1ef12540e
rtnetlink: Reject negative ifindexes in RTM_NEWLINK
...
commit 30188bd7838c16a98a520db1fe9df01ffc6ed368 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-30 16:27:26 +02:00
..
2021-09-15 09:47:31 +02:00
2023-04-20 12:07:36 +02:00
2023-01-18 11:41:37 +01:00
2023-05-30 12:44:06 +01:00
2021-04-07 14:47:41 +02:00
2023-06-09 10:28:59 +02:00
2022-04-20 09:19:40 +02:00
2023-08-30 16:27:25 +02:00
2023-08-30 16:27:11 +02:00
2023-01-18 11:41:04 +01:00
2021-07-14 16:53:33 +02:00
2023-07-27 08:37:23 +02:00
2023-03-17 08:32:51 +01:00
2023-07-27 08:37:40 +02:00
2023-08-11 11:53:58 +02:00
2023-08-30 16:27:26 +02:00
2023-08-11 11:53:57 +02:00
2023-08-30 16:27:23 +02:00
2023-06-21 15:44:10 +02:00
2020-04-23 10:36:45 +02:00
2023-07-27 08:37:24 +02:00
2023-01-18 11:41:09 +01:00
2022-11-03 23:56:54 +09:00
2023-08-30 16:27:19 +02:00
2023-08-30 16:27:16 +02:00
2023-04-20 12:07:32 +02:00
2022-11-25 17:42:21 +01:00
2023-08-30 16:27:16 +02:00
2023-04-26 11:24:05 +02:00
2022-04-27 13:50:47 +02:00
2021-02-10 09:25:28 +01:00
2023-07-27 08:37:44 +02:00
2023-04-20 12:07:33 +02:00
2022-12-14 11:30:45 +01:00
2023-02-22 12:50:41 +01:00
2023-08-30 16:27:14 +02:00
2023-08-30 16:27:19 +02:00
2022-04-15 14:18:35 +02:00
2023-07-27 08:37:12 +02:00
2023-06-09 10:28:52 +02:00
2023-07-27 08:37:11 +02:00
2023-05-30 12:44:05 +01:00
2023-02-22 12:50:25 +01:00
2023-08-16 18:19:23 +02:00
2022-01-11 15:23:33 +01:00
2021-09-03 10:08:12 +02:00
2023-03-11 16:43:41 +01:00
2020-11-24 13:29:05 +01:00
2023-02-22 12:50:34 +01:00
2023-05-17 11:35:59 +02:00
2023-08-30 16:27:24 +02:00
2023-08-30 16:27:23 +02:00
2023-03-17 08:32:51 +01:00
2021-11-17 09:48:48 +01:00
2023-07-27 08:37:35 +02:00
2021-10-27 09:54:24 +02:00
2023-06-21 15:44:12 +02:00
2023-06-09 10:29:01 +02:00
2023-08-30 16:27:19 +02:00
2023-05-30 12:44:05 +01:00
2023-07-27 08:37:42 +02:00
2023-02-22 12:50:26 +01:00
2023-07-27 08:37:23 +02:00
2023-08-30 16:27:20 +02:00
2021-06-18 09:59:00 +02:00
2023-06-21 15:44:10 +02:00
2023-06-21 15:44:10 +02:00
2023-05-30 12:44:01 +01:00