Ido Schimmel
b15dea3de4
rtnetlink: Reject negative ifindexes in RTM_NEWLINK
[ Upstream commit 30188bd783 ]
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: 38f7b870d4 ("[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: Sasha Levin <sashal@kernel.org>
2023-08-30 16:11:04 +02:00
..
2022-06-09 21:53:28 +02:00
2023-04-20 12:35:08 +02:00
2022-12-31 13:33:02 +01:00
2023-05-24 17:32:47 +01:00
2022-04-06 13:45:26 +01:00
2023-06-09 10:34:16 +02:00
2022-08-22 17:55:50 -07:00
2023-06-14 11:15:23 +02:00
2023-08-23 17:52:27 +02:00
2023-03-17 08:50:32 +01:00
2022-02-25 09:36:06 +01:00
2023-07-27 08:50:40 +02:00
2023-03-17 08:50:24 +01:00
2023-08-30 16:11:03 +02:00
2023-08-11 12:08:19 +02:00
2023-08-30 16:11:04 +02:00
2023-08-11 12:08:17 +02:00
2023-08-30 16:11:02 +02:00
2023-08-30 16:11:00 +02:00
2021-01-27 17:04:12 -08:00
2023-07-19 16:22:06 +02:00
2022-08-25 10:33:21 +02:00
2023-05-17 11:53:37 +02:00
2023-04-06 12:10:58 +02:00
2022-10-07 09:29:17 +02:00
2021-01-27 17:04:12 -08:00
2023-08-30 16:11:02 +02:00
2023-08-23 17:52:32 +02:00
2023-03-22 13:33:50 +01:00
2022-11-15 12:42:26 +01:00
2023-08-23 17:52:32 +02:00
2023-08-11 12:08:14 +02:00
2022-04-15 14:27:24 -07:00
2021-06-08 16:31:25 -07:00
2023-07-27 08:50:45 +02:00
2023-07-19 16:21:09 +02:00
2022-12-05 09:53:08 +01:00
2023-02-06 08:06:34 +01:00
2023-02-22 12:59:53 +01:00
2023-08-16 18:27:26 +02:00
2023-07-23 13:49:51 +02:00
2023-08-30 16:11:03 +02:00
2022-08-29 12:47:15 +01:00
2023-07-19 16:21:13 +02:00
2023-06-09 10:34:01 +02:00
2023-07-19 16:21:13 +02:00
2023-05-24 17:32:45 +01:00
2023-08-23 17:52:35 +02:00
2023-08-16 18:27:26 +02:00
2022-04-12 15:00:25 +02:00
2022-08-29 12:47:15 +01:00
2023-04-20 12:35:09 +02:00
2023-03-10 09:33:02 +01:00
2022-03-18 13:09:17 +02:00
2023-02-22 12:59:42 +01:00
2023-05-17 11:53:35 +02:00
2023-08-30 16:11:03 +02:00
2023-08-30 16:11:02 +02:00
2023-08-23 17:52:18 +02:00
2022-07-08 18:38:44 -07:00
2023-08-30 16:10:57 +02:00
2022-06-09 21:52:55 -07:00
2023-08-03 10:24:02 +02:00
2023-08-16 18:27:27 +02:00
2023-08-23 17:52:42 +02:00
2023-05-24 17:32:44 +01:00
2023-08-16 18:27:20 +02:00
2023-02-09 11:28:13 +01:00
2023-08-16 18:27:27 +02:00
2023-08-23 17:52:32 +02:00
2023-02-09 11:28:04 +01:00
2021-06-11 12:55:28 -07:00
2022-08-22 14:26:30 +01:00
2022-09-20 14:23:56 -07:00
2023-08-30 16:11:00 +02:00
2023-05-24 17:32:32 +01:00
2021-11-09 10:02:50 -08:00