Fix bug: sometimes valid entries in hash:* types of sets were evicted
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 16 Feb 2017 19:47:30 +0000 (20:47 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sun, 19 Feb 2017 18:08:32 +0000 (19:08 +0100)
Wrong index was used and therefore when shrinking a hash bucket at
deleting an entry, valid entries could be evicted as well.
Thanks to Eric Ewanco for the thorough bugreport.

Fixes netfilter bugzilla #1119

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
net/netfilter/ipset/ip_set_hash_gen.h

index 1b05d4a7d5a13e3a3eb42a56fdac186bb40451b2..f236c0bc7b3f3e171e4303dd7c5379f34011812f 100644 (file)
@@ -897,7 +897,7 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
                                        continue;
                                data = ahash_data(n, j, dsize);
                                memcpy(tmp->value + k * dsize, data, dsize);
-                               set_bit(j, tmp->used);
+                               set_bit(k, tmp->used);
                                k++;
                        }
                        tmp->pos = k;