Skip to content

Commit

Permalink
net/sched: act_sample: Fix error path in init
Browse files Browse the repository at this point in the history
Fix error path of in sample init, by releasing the tc hash in case of
failure in psample_group creation.

Fixes: 5c5670f ("net/sched: Introduce sample tc action")
Reported-by: Cong Wang <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Signed-off-by: Yotam Gigi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
yotamgi authored and davem330 committed Feb 1, 2017
1 parent 6107dbd commit cadb9c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/sched/act_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
s->rate = nla_get_u32(tb[TCA_SAMPLE_RATE]);
s->psample_group_num = nla_get_u32(tb[TCA_SAMPLE_PSAMPLE_GROUP]);
psample_group = psample_group_get(net, s->psample_group_num);
if (!psample_group)
if (!psample_group) {
if (ret == ACT_P_CREATED)
tcf_hash_release(*a, bind);
return -ENOMEM;
}
RCU_INIT_POINTER(s->psample_group, psample_group);

if (tb[TCA_SAMPLE_TRUNC_SIZE]) {
Expand Down

0 comments on commit cadb9c9

Please sign in to comment.