net: sched: fix error return code in tcf_del_walker()
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 17 Jun 2021 08:02:07 +0000 (16:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jul 2021 07:44:51 +0000 (09:44 +0200)
[ Upstream commit 55d96f72e8ddc0a294e0b9c94016edbb699537e1 ]

When nla_put_u32() fails, 'ret' could be 0, it should
return error code in tcf_del_walker().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/act_api.c

index 88e14cf..f613299 100644 (file)
@@ -333,7 +333,8 @@ static int tcf_del_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
        }
        mutex_unlock(&idrinfo->lock);
 
-       if (nla_put_u32(skb, TCA_FCNT, n_i))
+       ret = nla_put_u32(skb, TCA_FCNT, n_i);
+       if (ret)
                goto nla_put_failure;
        nla_nest_end(skb, nest);