Browse Source

act_mirred: avoid calling tcf_hash_release() when binding

When we share an action within a filter, the bind refcnt
should increase, therefore we should not call tcf_hash_release().

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
WANG Cong 10 years ago
parent
commit
636dba8e12
1 changed files with 2 additions and 0 deletions
  1. 2 0
      net/sched/act_mirred.c

+ 2 - 0
net/sched/act_mirred.c

@@ -98,6 +98,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
 			return ret;
 			return ret;
 		ret = ACT_P_CREATED;
 		ret = ACT_P_CREATED;
 	} else {
 	} else {
+		if (bind)
+			return 0;
 		if (!ovr) {
 		if (!ovr) {
 			tcf_hash_release(a, bind);
 			tcf_hash_release(a, bind);
 			return -EEXIST;
 			return -EEXIST;