netfilter: ipt_CLUSTERIP: fix a refcount bug in clusterip_config_find_get()
[pandora-kernel.git] / net / ipv4 / netfilter / ipt_CLUSTERIP.c
index db6785c..cb21acc 100644 (file)
@@ -135,8 +135,12 @@ clusterip_config_find_get(__be32 clusterip, int entry)
        if (c) {
                if (unlikely(!atomic_inc_not_zero(&c->refcount)))
                        c = NULL;
-               else if (entry)
-                       atomic_inc(&c->entries);
+               else if (entry) {
+                       if (unlikely(!atomic_inc_not_zero(&c->entries))) {
+                               clusterip_config_put(c);
+                               c = NULL;
+                       }
+               }
        }
        rcu_read_unlock_bh();