diff options
author | Josh Hunt <johunt@akamai.com> | 2013-02-19 14:35:59 -0500 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2013-02-21 11:34:47 -0500 |
commit | cf1c4a094f46ace5bf00078e2db73491ddf018fe (patch) | |
tree | 9dd485659090dfbe799b2c49264b7122bc5ef712 /include | |
parent | e29371d762df5bb35d2bc434ea266a046e5a0a75 (diff) |
netfilter: ipset: timeout values corrupted on set resize
If a resize is triggered on a set with timeouts enabled, the timeout
values will get corrupted when copying them to the new set. This occured
b/c the wrong timeout value is supplied to type_pf_elem_tadd().
This also adds simple debug statement similar to the one in type_pf_resize().
Signed-off-by: Josh Hunt <johunt@akamai.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netfilter/ipset/ip_set_ahash.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h index ef9acd3c8450..01d25e6fc792 100644 --- a/include/linux/netfilter/ipset/ip_set_ahash.h +++ b/include/linux/netfilter/ipset/ip_set_ahash.h | |||
@@ -854,6 +854,8 @@ type_pf_tresize(struct ip_set *set, bool retried) | |||
854 | retry: | 854 | retry: |
855 | ret = 0; | 855 | ret = 0; |
856 | htable_bits++; | 856 | htable_bits++; |
857 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", | ||
858 | set->name, orig->htable_bits, htable_bits, orig); | ||
857 | if (!htable_bits) { | 859 | if (!htable_bits) { |
858 | /* In case we have plenty of memory :-) */ | 860 | /* In case we have plenty of memory :-) */ |
859 | pr_warning("Cannot increase the hashsize of set %s further\n", | 861 | pr_warning("Cannot increase the hashsize of set %s further\n", |
@@ -873,7 +875,7 @@ retry: | |||
873 | data = ahash_tdata(n, j); | 875 | data = ahash_tdata(n, j); |
874 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | 876 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); |
875 | ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0, | 877 | ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0, |
876 | type_pf_data_timeout(data)); | 878 | ip_set_timeout_get(type_pf_data_timeout(data))); |
877 | if (ret < 0) { | 879 | if (ret < 0) { |
878 | read_unlock_bh(&set->lock); | 880 | read_unlock_bh(&set->lock); |
879 | ahash_destroy(t); | 881 | ahash_destroy(t); |