Skip to content

Commit

Permalink
net: sched: fix unbalance in the error path of tca_action_flush()
Browse files Browse the repository at this point in the history
When tca_action_flush() calls the action walk() and gets an error,
a successful call to nla_nest_start() is not followed by a call to
nla_nest_cancel(). It's harmless, as the skb is freed in the error
path - but it's worth to fix this unbalance.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Davide Caratti authored and David S. Miller committed Feb 16, 2018
1 parent e5fe068 commit 66dede2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/sched/act_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,10 @@ static int tca_action_flush(struct net *net, struct nlattr *nla,
goto out_module_put;

err = ops->walk(net, skb, &dcb, RTM_DELACTION, ops);
if (err <= 0)
if (err <= 0) {
nla_nest_cancel(skb, nest);
goto out_module_put;
}

nla_nest_end(skb, nest);

Expand Down

0 comments on commit 66dede2

Please sign in to comment.