|
@@ -122,13 +122,19 @@ static int fw_init(struct tcf_proto *tp)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void __fw_delete_filter(struct fw_filter *f)
|
|
|
|
+{
|
|
|
|
+ tcf_exts_destroy(&f->exts);
|
|
|
|
+ tcf_exts_put_net(&f->exts);
|
|
|
|
+ kfree(f);
|
|
|
|
+}
|
|
|
|
+
|
|
static void fw_delete_filter_work(struct work_struct *work)
|
|
static void fw_delete_filter_work(struct work_struct *work)
|
|
{
|
|
{
|
|
struct fw_filter *f = container_of(work, struct fw_filter, work);
|
|
struct fw_filter *f = container_of(work, struct fw_filter, work);
|
|
|
|
|
|
rtnl_lock();
|
|
rtnl_lock();
|
|
- tcf_exts_destroy(&f->exts);
|
|
|
|
- kfree(f);
|
|
|
|
|
|
+ __fw_delete_filter(f);
|
|
rtnl_unlock();
|
|
rtnl_unlock();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -154,7 +160,10 @@ static void fw_destroy(struct tcf_proto *tp)
|
|
RCU_INIT_POINTER(head->ht[h],
|
|
RCU_INIT_POINTER(head->ht[h],
|
|
rtnl_dereference(f->next));
|
|
rtnl_dereference(f->next));
|
|
tcf_unbind_filter(tp, &f->res);
|
|
tcf_unbind_filter(tp, &f->res);
|
|
- call_rcu(&f->rcu, fw_delete_filter);
|
|
|
|
|
|
+ if (tcf_exts_get_net(&f->exts))
|
|
|
|
+ call_rcu(&f->rcu, fw_delete_filter);
|
|
|
|
+ else
|
|
|
|
+ __fw_delete_filter(f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
kfree_rcu(head, rcu);
|
|
kfree_rcu(head, rcu);
|
|
@@ -179,6 +188,7 @@ static int fw_delete(struct tcf_proto *tp, void *arg, bool *last)
|
|
if (pfp == f) {
|
|
if (pfp == f) {
|
|
RCU_INIT_POINTER(*fp, rtnl_dereference(f->next));
|
|
RCU_INIT_POINTER(*fp, rtnl_dereference(f->next));
|
|
tcf_unbind_filter(tp, &f->res);
|
|
tcf_unbind_filter(tp, &f->res);
|
|
|
|
+ tcf_exts_get_net(&f->exts);
|
|
call_rcu(&f->rcu, fw_delete_filter);
|
|
call_rcu(&f->rcu, fw_delete_filter);
|
|
ret = 0;
|
|
ret = 0;
|
|
break;
|
|
break;
|
|
@@ -299,6 +309,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,
|
|
RCU_INIT_POINTER(fnew->next, rtnl_dereference(pfp->next));
|
|
RCU_INIT_POINTER(fnew->next, rtnl_dereference(pfp->next));
|
|
rcu_assign_pointer(*fp, fnew);
|
|
rcu_assign_pointer(*fp, fnew);
|
|
tcf_unbind_filter(tp, &f->res);
|
|
tcf_unbind_filter(tp, &f->res);
|
|
|
|
+ tcf_exts_get_net(&f->exts);
|
|
call_rcu(&f->rcu, fw_delete_filter);
|
|
call_rcu(&f->rcu, fw_delete_filter);
|
|
|
|
|
|
*arg = fnew;
|
|
*arg = fnew;
|