Christoph Paasch
503930f8e1
netlink: Correct offload_xstats size
rtnl_offload_xstats_get_size_hw_s_info_one() conditionalizes the
size-computation for IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED based on whether
or not the device has offload_xstats enabled.
However, rtnl_offload_xstats_fill_hw_s_info_one() is adding the u8 for
that field uncondtionally.
syzkaller triggered a WARNING in rtnl_stats_get due to this:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 754 at net/core/rtnetlink.c:5982 rtnl_stats_get+0x2f4/0x300
Modules linked in:
CPU: 0 PID: 754 Comm: syz-executor148 Not tainted 6.6.0-rc2-g331b78eb12af #45
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
RIP: 0010:rtnl_stats_get+0x2f4/0x300 net/core/rtnetlink.c:5982
Code: ff ff 89 ee e8 7d 72 50 ff 83 fd a6 74 17 e8 33 6e 50 ff 4c 89 ef be 02 00 00 00 e8 86 00 fa ff e9 7b fe ff ff e8 1c 6e 50 ff <0f> 0b eb e5 e8 73 79 7b 00 0f 1f 00 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc900006837c0 EFLAGS: 00010293
RAX: ffffffff81cf7f24 RBX: ffff8881015d9000 RCX: ffff888101815a00
RDX: 0000000000000000 RSI: 00000000ffffffa6 RDI: 00000000ffffffa6
RBP: 00000000ffffffa6 R08: ffffffff81cf7f03 R09: 0000000000000001
R10: ffff888101ba47b9 R11: ffff888101815a00 R12: ffff8881017dae00
R13: ffff8881017dad00 R14: ffffc90000683ab8 R15: ffffffff83c1f740
FS: 00007fbc22dbc740(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000046 CR3: 000000010264e003 CR4: 0000000000170ef0
Call Trace:
<TASK>
rtnetlink_rcv_msg+0x677/0x710 net/core/rtnetlink.c:6480
netlink_rcv_skb+0xea/0x1c0 net/netlink/af_netlink.c:2545
netlink_unicast+0x430/0x500 net/netlink/af_netlink.c:1342
netlink_sendmsg+0x4fc/0x620 net/netlink/af_netlink.c:1910
sock_sendmsg+0xa8/0xd0 net/socket.c:730
____sys_sendmsg+0x22a/0x320 net/socket.c:2541
___sys_sendmsg+0x143/0x190 net/socket.c:2595
__x64_sys_sendmsg+0xd8/0x150 net/socket.c:2624
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x47/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x6e/0xd8
RIP: 0033:0x7fbc22e8d6a9
Code: 5c c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 4f 37 0d 00 f7 d8 64 89 01 48
RSP: 002b:00007ffc4320e778 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004007d0 RCX: 00007fbc22e8d6a9
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000003
RBP: 0000000000000001 R08: 0000000000000000 R09: 00000000004007d0
R10: 0000000000000008 R11: 0000000000000246 R12: 00007ffc4320e898
R13: 00007ffc4320e8a8 R14: 00000000004004a0 R15: 00007fbc22fa5a80
</TASK>
---[ end trace 0000000000000000 ]---
Which didn't happen prior to commit bf9f1baa27 ("net: add dedicated
kmem_cache for typical/small skb->head") as the skb always was large
enough.
Fixes: 0e7788fd76 ("net: rtnetlink: Add UAPI for obtaining L3 offload xstats")
Signed-off-by: Christoph Paasch <cpaasch@apple.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Link: https://lore.kernel.org/r/20231013041448.8229-1-cpaasch@apple.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-10-16 17:32:59 -07:00
..
2023-03-29 08:22:52 +01:00
2023-08-09 15:32:43 -07:00
2023-08-18 12:44:56 -07:00
2023-06-24 15:50:13 -07:00
2023-06-24 15:50:13 -07:00
2023-09-18 12:56:58 +01:00
2023-08-24 10:51:39 -07:00
2023-09-20 11:03:11 -07:00
2023-08-30 08:36:17 +02:00
2023-05-31 13:06:57 +02:00
2023-10-01 17:14:37 +01:00
2023-06-24 15:50:13 -07:00
2023-10-06 12:54:33 +02:00
2023-08-24 11:24:37 +02:00
2023-10-16 17:32:59 -07:00
2023-08-01 21:07:46 -07:00
2023-09-18 07:10:31 +01:00
2023-10-06 15:56:46 -07:00
2023-08-09 13:08:09 -07:00
2023-10-10 19:48:15 -07:00
2023-09-20 11:54:49 +01:00
2023-09-18 08:26:19 +01:00
2023-08-29 17:39:15 -07:00
2023-10-13 16:49:32 -07:00
2023-10-03 09:49:24 +02:00
2023-03-16 17:34:40 -07:00
2023-09-14 10:43:51 +02:00
2023-08-18 12:44:56 -07:00
2023-10-01 18:19:27 +01:00
2023-08-09 15:34:28 -07:00
2023-09-26 09:12:47 +02:00
2023-06-24 15:41:46 -07:00
2023-10-10 19:43:22 -07:00
2023-08-15 15:26:18 -07:00
2023-10-13 16:49:32 -07:00
2023-09-18 07:06:05 +01:00
2023-10-12 10:28:45 +02:00
2023-08-02 12:28:22 -07:00
2023-10-04 17:32:54 -07:00
2023-08-28 06:58:46 +01:00
2023-10-12 09:32:10 +02:00
2023-06-10 00:11:41 -07:00
2023-08-18 12:44:56 -07:00
2023-10-12 09:15:15 +02:00
2023-06-24 15:50:13 -07:00
2023-07-17 09:02:30 +01:00
2023-10-01 19:31:29 +01:00
2023-09-18 09:36:57 +02:00
2023-06-24 15:50:13 -07:00
2023-06-28 16:43:10 -07:00
2023-10-06 11:43:05 +01:00
2023-10-04 17:29:58 -07:00
2023-10-16 16:37:40 -07:00
2023-09-27 15:16:40 -04:00
2023-07-21 08:54:03 +01:00
2023-10-04 13:24:12 -07:00
2023-10-13 16:49:32 -07:00
2023-09-07 18:33:07 -07:00
2023-07-31 14:41:08 -07:00
2023-09-26 09:12:27 +02:00
2023-06-24 15:50:13 -07:00
2023-10-09 16:13:29 +02:00
2023-08-29 17:39:15 -07:00
2023-04-14 11:09:27 +01:00
2023-07-19 10:07:27 -07:00
2023-04-19 18:48:48 -07:00
2023-10-01 19:31:29 +01:00
2023-08-15 15:26:17 -07:00