netfilter: ipset: Fix hash:* type expiration
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sat, 7 Nov 2015 10:23:34 +0000 (11:23 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sat, 7 Nov 2015 10:23:34 +0000 (11:23 +0100)
Incorrect index was used when the data blob was shrinked at expiration,
which could lead to falsely expired entries and memory leak when
the comment extension was used too.

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

index 4ff2219..fa4f637 100644 (file)
@@ -523,7 +523,7 @@ mtype_expire(struct ip_set *set, struct htype *h, u8 nets_length, size_t dsize)
                                        continue;
                                data = ahash_data(n, j, dsize);
                                memcpy(tmp->value + d * dsize, data, dsize);
-                               set_bit(j, tmp->used);
+                               set_bit(d, tmp->used);
                                d++;
                        }
                        tmp->pos = d;