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 <[email protected]>
---
 net/shaper/shaper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index a27673e5919f..2ba397fa3bfd 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -1274,8 +1274,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) {
-- 
2.54.0


Reply via email to