]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: shaper: set ret to -ENOMEM when genlmsg_new() fails in group_doit
authorJakub Kicinski <kuba@kernel.org>
Sun, 10 May 2026 19:28:59 +0000 (12:28 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 12 May 2026 14:14:59 +0000 (16:14 +0200)
genlmsg_new() alloc failure path in net_shaper_nl_group_doit() forgets
to set ret before jumping to error handling.

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

index c8960821cf236f8194f48231b89ab98c9c19877c..12e5e0c18643b946cc900a7651088b2cc1cb1b08 100644 (file)
@@ -1276,8 +1276,10 @@ int net_shaper_nl_group_doit(struct sk_buff *skb, struct genl_info *info)
         * rollback on allocation failure.
         */
        msg = genlmsg_new(net_shaper_handle_size(), GFP_KERNEL);
-       if (!msg)
+       if (!msg) {
+               ret = -ENOMEM;
                goto free_leaves;
+       }
 
        hierarchy = net_shaper_hierarchy_setup(binding);
        if (!hierarchy) {