diff mbox series

[nf] netfilter: x_tables: ensure readers see new ->private value

Message ID 20171011180324.15638-1-fw@strlen.de
State Not Applicable
Delegated to: Pablo Neira
Headers show
Series [nf] netfilter: x_tables: ensure readers see new ->private value | expand

Commit Message

Florian Westphal Oct. 11, 2017, 6:03 p.m. UTC
Eric Dumazet wrote:
 But it seems we need an extra smp_wmb() after
      smp_wmb();
      table->private = newinfo;

Otherwise we have no guarantee other cpus actually see the new
->private value.

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/x_tables.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Eric Dumazet Oct. 11, 2017, 6:04 p.m. UTC | #1
On Wed, Oct 11, 2017 at 11:03 AM, Florian Westphal <fw@strlen.de> wrote:
> Eric Dumazet wrote:
>  But it seems we need an extra smp_wmb() after
>       smp_wmb();
>       table->private = newinfo;
>
> Otherwise we have no guarantee other cpus actually see the new
> ->private value.
>
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>

I do not believe this change is needed in net (or nf) tree.
See my other reply.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index d8571f414208..64cf669ecd6c 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1182,6 +1182,9 @@  xt_replace_table(struct xt_table *table,
 	smp_wmb();
 	table->private = newinfo;
 
+	/* Ensure other cpus see the new ->private value. */
+	smp_wmb();
+
 	/*
 	 * Even though table entries have now been swapped, other CPU's
 	 * may still be using the old entries. This is okay, because