summaryrefslogtreecommitdiffstats
path: root/net/netfilter/nf_conntrack_extend.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-04 18:29:16 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-06 11:16:25 +0100
commitf199bdbaab37585ff6912dfb5524cf2a0ef06a05 (patch)
tree8f6aa15ec859e7521f31ee69797b604cf5d09d1c /net/netfilter/nf_conntrack_extend.c
parent99d6d4e0c50c6e64e3cca11dc77538cadcf3b2e2 (diff)
downloadlinux-stable-f199bdbaab37585ff6912dfb5524cf2a0ef06a05.tar.gz
linux-stable-f199bdbaab37585ff6912dfb5524cf2a0ef06a05.tar.bz2
linux-stable-f199bdbaab37585ff6912dfb5524cf2a0ef06a05.zip
Revert "netfilter: move nat hlist_head to nf_conn"
This reverts commit 7c9664351980aaa6a4b8837a314360b3a4ad382a as it is not working properly. Please move to 4.9 to get the full fix. Reported-by: Pablo Neira Ayuso <pablo@netfilter.org> Cc: Florian Westphal <fw@strlen.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/netfilter/nf_conntrack_extend.c')
-rw-r--r--net/netfilter/nf_conntrack_extend.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c
index 02bcf00c2492..1a9545965c0d 100644
--- a/net/netfilter/nf_conntrack_extend.c
+++ b/net/netfilter/nf_conntrack_extend.c
@@ -73,7 +73,7 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
size_t var_alloc_len, gfp_t gfp)
{
struct nf_ct_ext *old, *new;
- int newlen, newoff;
+ int i, newlen, newoff;
struct nf_ct_ext_type *t;
/* Conntrack must not be confirmed to avoid races on reallocation. */
@@ -99,8 +99,19 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
return NULL;
if (new != old) {
+ for (i = 0; i < NF_CT_EXT_NUM; i++) {
+ if (!__nf_ct_ext_exist(old, i))
+ continue;
+
+ rcu_read_lock();
+ t = rcu_dereference(nf_ct_ext_types[i]);
+ if (t && t->move)
+ t->move((void *)new + new->offset[i],
+ (void *)old + old->offset[i]);
+ rcu_read_unlock();
+ }
kfree_rcu(old, rcu);
- rcu_assign_pointer(ct->ext, new);
+ ct->ext = new;
}
new->offset[id] = newoff;