Commit fe2502e4 authored by Cong Wang's avatar Cong Wang Committed by David S. Miller

net_sched: remove cls_flower idr on failure

Fixes: c15ab236 ("net/sched: Change cls_flower to use IDR")
Cc: Chris Mi <chrism@mellanox.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 21f4d5cc
...@@ -922,28 +922,28 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, ...@@ -922,28 +922,28 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
if (!tc_flags_valid(fnew->flags)) { if (!tc_flags_valid(fnew->flags)) {
err = -EINVAL; err = -EINVAL;
goto errout; goto errout_idr;
} }
} }
err = fl_set_parms(net, tp, fnew, &mask, base, tb, tca[TCA_RATE], ovr); err = fl_set_parms(net, tp, fnew, &mask, base, tb, tca[TCA_RATE], ovr);
if (err) if (err)
goto errout; goto errout_idr;
err = fl_check_assign_mask(head, &mask); err = fl_check_assign_mask(head, &mask);
if (err) if (err)
goto errout; goto errout_idr;
if (!tc_skip_sw(fnew->flags)) { if (!tc_skip_sw(fnew->flags)) {
if (!fold && fl_lookup(head, &fnew->mkey)) { if (!fold && fl_lookup(head, &fnew->mkey)) {
err = -EEXIST; err = -EEXIST;
goto errout; goto errout_idr;
} }
err = rhashtable_insert_fast(&head->ht, &fnew->ht_node, err = rhashtable_insert_fast(&head->ht, &fnew->ht_node,
head->ht_params); head->ht_params);
if (err) if (err)
goto errout; goto errout_idr;
} }
if (!tc_skip_hw(fnew->flags)) { if (!tc_skip_hw(fnew->flags)) {
...@@ -952,7 +952,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, ...@@ -952,7 +952,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
&mask.key, &mask.key,
fnew); fnew);
if (err) if (err)
goto errout; goto errout_idr;
} }
if (!tc_in_hw(fnew->flags)) if (!tc_in_hw(fnew->flags))
...@@ -981,6 +981,9 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, ...@@ -981,6 +981,9 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
kfree(tb); kfree(tb);
return 0; return 0;
errout_idr:
if (fnew->handle)
idr_remove_ext(&head->handle_idr, fnew->handle);
errout: errout:
tcf_exts_destroy(&fnew->exts); tcf_exts_destroy(&fnew->exts);
kfree(fnew); kfree(fnew);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment