CVE-2024-26669
Severity CVSS v4.0:
Pending analysis
Type:
CWE-787
Out-of-bounds Write
Publication date:
02/04/2024
Last modified:
17/03/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
net/sched: flower: Fix chain template offload<br />
<br />
When a qdisc is deleted from a net device the stack instructs the<br />
underlying driver to remove its flow offload callback from the<br />
associated filter block using the &#39;FLOW_BLOCK_UNBIND&#39; command. The stack<br />
then continues to replay the removal of the filters in the block for<br />
this driver by iterating over the chains in the block and invoking the<br />
&#39;reoffload&#39; operation of the classifier being used. In turn, the<br />
classifier in its &#39;reoffload&#39; operation prepares and emits a<br />
&#39;FLOW_CLS_DESTROY&#39; command for each filter.<br />
<br />
However, the stack does not do the same for chain templates and the<br />
underlying driver never receives a &#39;FLOW_CLS_TMPLT_DESTROY&#39; command when<br />
a qdisc is deleted. This results in a memory leak [1] which can be<br />
reproduced using [2].<br />
<br />
Fix by introducing a &#39;tmplt_reoffload&#39; operation and have the stack<br />
invoke it with the appropriate arguments as part of the replay.<br />
Implement the operation in the sole classifier that supports chain<br />
templates (flower) by emitting the &#39;FLOW_CLS_TMPLT_{CREATE,DESTROY}&#39;<br />
command based on whether a flow offload callback is being bound to a<br />
filter block or being unbound from one.<br />
<br />
As far as I can tell, the issue happens since cited commit which<br />
reordered tcf_block_offload_unbind() before tcf_block_flush_all_chains()<br />
in __tcf_block_put(). The order cannot be reversed as the filter block<br />
is expected to be freed after flushing all the chains.<br />
<br />
[1]<br />
unreferenced object 0xffff888107e28800 (size 2048):<br />
comm "tc", pid 1079, jiffies 4294958525 (age 3074.287s)<br />
hex dump (first 32 bytes):<br />
b1 a6 7c 11 81 88 ff ff e0 5b b3 10 81 88 ff ff ..|......[......<br />
01 00 00 00 00 00 00 00 e0 aa b0 84 ff ff ff ff ................<br />
backtrace:<br />
[] __kmem_cache_alloc_node+0x1e8/0x320<br />
[] __kmalloc+0x4e/0x90<br />
[] mlxsw_sp_acl_ruleset_get+0x34d/0x7a0<br />
[] mlxsw_sp_flower_tmplt_create+0x145/0x180<br />
[] mlxsw_sp_flow_block_cb+0x1ea/0x280<br />
[] tc_setup_cb_call+0x183/0x340<br />
[] fl_tmplt_create+0x3da/0x4c0<br />
[] tc_ctl_chain+0xa15/0x1170<br />
[] rtnetlink_rcv_msg+0x3cc/0xed0<br />
[] netlink_rcv_skb+0x170/0x440<br />
[] netlink_unicast+0x540/0x820<br />
[] netlink_sendmsg+0x8d8/0xda0<br />
[] ____sys_sendmsg+0x30f/0xa80<br />
[] ___sys_sendmsg+0x13a/0x1e0<br />
[] __sys_sendmsg+0x11c/0x1f0<br />
[] do_syscall_64+0x40/0xe0<br />
unreferenced object 0xffff88816d2c0400 (size 1024):<br />
comm "tc", pid 1079, jiffies 4294958525 (age 3074.287s)<br />
hex dump (first 32 bytes):<br />
40 00 00 00 00 00 00 00 57 f6 38 be 00 00 00 00 @.......W.8.....<br />
10 04 2c 6d 81 88 ff ff 10 04 2c 6d 81 88 ff ff ..,m......,m....<br />
backtrace:<br />
[] __kmem_cache_alloc_node+0x1e8/0x320<br />
[] __kmalloc_node+0x51/0x90<br />
[] kvmalloc_node+0xa6/0x1f0<br />
[] bucket_table_alloc.isra.0+0x83/0x460<br />
[] rhashtable_init+0x43b/0x7c0<br />
[] mlxsw_sp_acl_ruleset_get+0x428/0x7a0<br />
[] mlxsw_sp_flower_tmplt_create+0x145/0x180<br />
[] mlxsw_sp_flow_block_cb+0x1ea/0x280<br />
[] tc_setup_cb_call+0x183/0x340<br />
[] fl_tmplt_create+0x3da/0x4c0<br />
[] tc_ctl_chain+0xa15/0x1170<br />
[] rtnetlink_rcv_msg+0x3cc/0xed0<br />
[] netlink_rcv_skb+0x170/0x440<br />
[] netlink_unicast+0x540/0x820<br />
[] netlink_sendmsg+0x8d8/0xda0<br />
[] ____sys_sendmsg+0x30f/0xa80<br />
<br />
[2]<br />
# tc qdisc add dev swp1 clsact<br />
# tc chain add dev swp1 ingress proto ip chain 1 flower dst_ip 0.0.0.0/32<br />
# tc qdisc del dev<br />
---truncated---
Impact
Base Score 3.x
7.10
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.1 (including) | 6.6.15 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.7.3 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.8:rc1:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/32f2a0afa95fae0d1ceec2ff06e0e816939964b8
- https://git.kernel.org/stable/c/9ed46144cff3598a5cf79955630e795ff9af5b97
- https://git.kernel.org/stable/c/c04709b2cc99ae31c346f79f0211752d7b74df01
- https://git.kernel.org/stable/c/32f2a0afa95fae0d1ceec2ff06e0e816939964b8
- https://git.kernel.org/stable/c/9ed46144cff3598a5cf79955630e795ff9af5b97
- https://git.kernel.org/stable/c/c04709b2cc99ae31c346f79f0211752d7b74df01



