diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 0759f32..8760a48 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -266,11 +266,6 @@ replay: goto errout; } - spin_lock_bh(root_lock); - tp->next = *back; - *back = tp; - spin_unlock_bh(root_lock); - } else if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], tp->ops->kind)) goto errout; @@ -314,8 +309,21 @@ replay: } err = tp->ops->change(tp, cl, t->tcm_handle, tca, &fh); - if (err == 0) + if (err == 0) { + if (n->nlmsg_type == RTM_NEWTFILTER && + (n->nlmsg_flags&NLM_F_CREATE)) { + spin_lock_bh(root_lock); + tp->next = *back; + *back = tp; + spin_unlock_bh(root_lock); + } tfilter_notify(skb, n, tp, fh, RTM_NEWTFILTER); + } else { + if (n->nlmsg_type == RTM_NEWTFILTER && + (n->nlmsg_flags&NLM_F_CREATE)) { + tcf_destroy(tp); + } + } errout: if (cl)