Skip to contentSkip to conversation

net: sched: cls_api: fix tc_chain_fill_node to initialize tcm_info to zero to prevent an info-leak

PATCH Applied Yochai Eisenrich 3 participants 3 messages Mar 28 – Mar 31

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sched: cls_api: fix tc_chain_fill_node to initialize tcm_info to zero to prevent an info-leak

When building netlink messages, tc_chain_fill_node() never initializes the tcm_info field of struct tcmsg. Since the allocation is not zeroed, kernel heap memory is leaked to userspace through this 4-byte field.

The fix simply zeroes tcm_info alongside the other fields that are already initialized.

Fixes 32a4f5ecd738 ("net: sched: introduce chain object to uapi")
---
 net/sched/cls_api.c | 1 +
 1 file changed, 1 insertion(+)
net/sched/cls_api.c +1 -0
index 4829c27446e3..20f7f9ee0b35 100644
@@ -2969,6 +2969,7 @@ static int tc_chain_fill_node(const struct tcf_proto_ops *tmplt_ops,
 	tcm->tcm__pad1 = 0;
 	tcm->tcm__pad2 = 0;
 	tcm->tcm_handle = 0;
+	tcm->tcm_info = 0;
 	if (block->q) {
 		tcm->tcm_ifindex = qdisc_dev(block->q)->ifindex;
 		tcm->tcm_parent = block->q->handle;

--
2.53.0

maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Yochai Eisenrich

When building netlink messages, tc_chain_fill_node() never initializes the tcm_info field of struct tcmsg. Since the allocation is not zeroed, kernel heap memory is leaked to userspace through this 4-byte field.

The fix simply zeroes tcm_info alongside the other fields that are already initialized.

Fixes 32a4f5ecd738 ("net: sched: introduce chain object to uapi")

cheers,
jamal

Quoted 18 lines
---
 net/sched/cls_api.c | 1 +
 1 file changed, 1 insertion(+)
net/sched/cls_api.c +1 -1
index 4829c27446e3..20f7f9ee0b35 100644
@@ -2969,6 +2969,7 @@ static int tc_chain_fill_node(const struct tcf_proto_ops *tmplt_ops,
        tcm->tcm__pad1 = 0;
        tcm->tcm__pad2 = 0;
        tcm->tcm_handle = 0;
+       tcm->tcm_info = 0;
        if (block->q) {
                tcm->tcm_ifindex = qdisc_dev(block->q)->ifindex;
                tcm->tcm_parent = block->q->handle;
--

2.53.0

#2 lore raw
In reply to Yochai Eisenrich
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sun, 29 Mar 2026 00:14:36 +0300 you wrote:

When building netlink messages, tc_chain_fill_node() never initializes the tcm_info field of struct tcmsg. Since the allocation is not zeroed, kernel heap memory is leaked to userspace through this 4-byte field.

The fix simply zeroes tcm_info alongside the other fields that are already initialized.

[...]

Here is the summary with links:
- net: sched: cls_api: fix tc_chain_fill_node to initialize tcm_info to zero to prevent an info-leak

    https://git.kernel.org/netdev/net/c/e6e3eb5ee89a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html