Ido Schimmel
c8e1e17dee
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:23:14 +02:00
..
2021-09-15 09:50:34 +02:00
2023-04-20 12:10:25 +02:00
2023-01-14 10:16:18 +01:00
2023-05-30 12:57:53 +01:00
2021-04-07 15:00:08 +02:00
2023-06-09 10:30:12 +02:00
2022-06-22 14:13:17 +02:00
2023-06-21 15:45:40 +02:00
2023-08-26 15:26:45 +02:00
2023-01-14 10:15:31 +01:00
2021-07-14 16:56:29 +02:00
2023-07-27 08:44:39 +02:00
2023-03-17 08:45:11 +01:00
2023-07-27 08:44:35 +02:00
2023-08-30 16:23:11 +02:00
2023-08-30 16:23:14 +02:00
2023-08-11 11:57:50 +02:00
2023-08-30 16:23:12 +02:00
2023-06-21 15:45:38 +02:00
2023-07-27 08:44:10 +02:00
2023-01-24 07:19:55 +01:00
2023-04-05 11:23:52 +02:00
2022-11-03 23:57:51 +09:00
2023-08-26 15:26:56 +02:00
2023-08-26 15:26:52 +02:00
2023-03-22 13:30:00 +01:00
2022-11-25 17:45:56 +01:00
2023-08-26 15:26:51 +02:00
2023-04-26 11:27:41 +02:00
2022-04-27 13:53:50 +02:00
2023-07-27 08:44:40 +02:00
2023-05-30 12:57:53 +01:00
2022-12-14 11:32:01 +01:00
2023-02-22 12:55:58 +01:00
2023-04-26 11:27:41 +02:00
2023-05-17 11:48:10 +02:00
2023-08-30 16:23:13 +02:00
2022-04-13 21:01:00 +02:00
2023-07-27 08:43:43 +02:00
2023-06-09 10:30:05 +02:00
2023-07-27 08:43:43 +02:00
2023-05-30 12:57:52 +01:00
2023-02-22 12:55:57 +01:00
2023-08-16 18:21:01 +02:00
2022-01-11 15:25:01 +01:00
2021-03-07 12:34:07 +01:00
2023-04-20 12:10:26 +02:00
2023-03-11 16:39:26 +01:00
2023-02-22 12:55:53 +01:00
2023-05-17 11:48:11 +02:00
2023-08-30 16:23:13 +02:00
2023-08-30 16:23:12 +02:00
2023-06-14 11:09:39 +02:00
2021-11-18 14:04:27 +01:00
2023-08-30 16:23:09 +02:00
2023-08-11 11:57:37 +02:00
2023-05-30 12:57:46 +01:00
2023-08-26 15:26:56 +02:00
2023-05-30 12:57:52 +01:00
2023-08-11 11:57:47 +02:00
2023-02-15 17:22:15 +01:00
2023-07-27 08:44:09 +02:00
2023-08-26 15:26:52 +02:00
2021-06-18 10:00:06 +02:00
2023-06-21 15:45:38 +02:00
2023-06-21 15:45:38 +02:00
2023-07-27 08:43:37 +02:00