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