net: sched: cls_api: fix tc_chain_fill_node to initialize tcm_info to zero to prevent an info-leak
Subsystems (3)
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.
--- net/sched/cls_api.c | 1 + 1 file changed, 1 insertion(+)
net/sched/cls_api.c +1 -0
@@ -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
Quoted 10 lines · Yochai Eisenrich
When building netlink messages,
tc_chain_fill_node()never initializes thetcm_infofield 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_infoalongside the other fields that are already initialized.Fixes 32a4f5ecd738 ("net: sched: introduce chain object to uapi")Signed-off-by Yochai Eisenrich <[email protected]>
cheers,
jamal
Quoted 18 lines
--- net/sched/cls_api.c | 1 + 1 file changed, 1 insertion(+)net/sched/cls_api.c +1
-1@@ -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
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 thetcm_infofield 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_infoalongside 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