Skip to content

Commit

Permalink
netfilter: Remove now-redundant smp_read_barrier_depends()
Browse files Browse the repository at this point in the history
READ_ONCE() now implies smp_read_barrier_depends(), which means that
the instances in arpt_do_table(), ipt_do_table(), and ip6t_do_table()
are now redundant.  This commit removes them and adjusts the comments.

Signed-off-by: Paul E. McKenney <[email protected]>
Cc: Pablo Neira Ayuso <[email protected]>
Cc: Jozsef Kadlecsik <[email protected]>
Cc: Florian Westphal <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
paulmck committed Dec 4, 2017
1 parent 08df477 commit 4be2b04
Showing 3 changed files with 3 additions and 18 deletions.
7 changes: 1 addition & 6 deletions net/ipv4/netfilter/arp_tables.c
Original file line number Diff line number Diff line change
@@ -202,13 +202,8 @@ unsigned int arpt_do_table(struct sk_buff *skb,

local_bh_disable();
addend = xt_write_recseq_begin();
private = table->private;
private = READ_ONCE(table->private); /* Address dependency. */
cpu = smp_processor_id();
/*
* Ensure we load private-> members after we've fetched the base
* pointer.
*/
smp_read_barrier_depends();
table_base = private->entries;
jumpstack = (struct arpt_entry **)private->jumpstack[cpu];

7 changes: 1 addition & 6 deletions net/ipv4/netfilter/ip_tables.c
Original file line number Diff line number Diff line change
@@ -260,13 +260,8 @@ ipt_do_table(struct sk_buff *skb,
WARN_ON(!(table->valid_hooks & (1 << hook)));
local_bh_disable();
addend = xt_write_recseq_begin();
private = table->private;
private = READ_ONCE(table->private); /* Address dependency. */
cpu = smp_processor_id();
/*
* Ensure we load private-> members after we've fetched the base
* pointer.
*/
smp_read_barrier_depends();
table_base = private->entries;
jumpstack = (struct ipt_entry **)private->jumpstack[cpu];

7 changes: 1 addition & 6 deletions net/ipv6/netfilter/ip6_tables.c
Original file line number Diff line number Diff line change
@@ -282,12 +282,7 @@ ip6t_do_table(struct sk_buff *skb,

local_bh_disable();
addend = xt_write_recseq_begin();
private = table->private;
/*
* Ensure we load private-> members after we've fetched the base
* pointer.
*/
smp_read_barrier_depends();
private = READ_ONCE(table->private); /* Address dependency. */
cpu = smp_processor_id();
table_base = private->entries;
jumpstack = (struct ip6t_entry **)private->jumpstack[cpu];

0 comments on commit 4be2b04

Please sign in to comment.