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 06:53:11 +0000 (08:53 +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 716cad67731849d5ad79cd3195fe6aa81afb3d4e..17e5cd9ebd89fce097feec7493961d3315011783 100644 (file)
@@ -316,7 +316,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);