]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: shaper: reject duplicate leaves in GROUP request
authorJakub Kicinski <kuba@kernel.org>
Sun, 10 May 2026 19:28:57 +0000 (12:28 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 12 May 2026 14:14:59 +0000 (16:14 +0200)
commita9a2fa1da619f276580b0d4c5d12efac89e8642b
tree846614955192bad1fa256c499d7b35313486124f
parent235fb5376139c3419f2218349f1fa2f06f24f7ad
net: shaper: reject duplicate leaves in GROUP request

net_shaper_nl_group_doit() does not deduplicate NET_SHAPER_A_LEAVES
entries. When userspace supplies the same leaf handle twice, the same
old-parent pointer lands twice in old_nodes[]. The cleanup loop double
frees the parent. Of course the same parent may still be in old_nodes[]
twice if we are moving multiple of its leaves.

Note that this patch also implicitly fixes the fact that the
i >= leaves_count path forgets to set ret.

Fixes: 5d5d4700e75d ("net-shapers: implement NL group operation")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20260510192904.3987113-4-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/shaper/shaper.c