summaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorYotam Gigi <yotamg@mellanox.com>2017-01-31 10:33:53 +0100
committerDavid S. Miller <davem@davemloft.net>2017-02-01 20:10:03 +0100
commitcadb9c9fdbc6a624d57b5ecdfd412b5800848703 (patch)
treec7b4d560f23e9e915ef165f12321f8f4800bb9f7 /net/sched
parentMerge branch 'sh_eth-fixes-for-MagicPacket-handling' (diff)
downloadlinux-cadb9c9fdbc6a624d57b5ecdfd412b5800848703.tar.xz
linux-cadb9c9fdbc6a624d57b5ecdfd412b5800848703.zip
net/sched: act_sample: Fix error path in init
Fix error path of in sample init, by releasing the tc hash in case of failure in psample_group creation. Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action") Reported-by: Cong Wang <xiyou.wangcong@gmail.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/act_sample.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 39229756de07..02b67495829c 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -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]) {