Skip to contentSkip to conversation

netfilter: x_tables: ensure readers see new ->private value

PATCH In review Florian Westphal 2 participants 2 messages Oct 11, 2017

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: x_tables: ensure readers see new ->private value

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.

---
 net/netfilter/x_tables.c | 3 +++
 1 file changed, 3 insertions(+)
net/netfilter/x_tables.c +3 -0
index d8571f414208..64cf669ecd6c 100644
@@ -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
Signature · 1 line
2.13.6