aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2007-07-31 03:38:48 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-31 18:39:40 -0400
commitb34bd06e485abf5b24fc13a9a988ebf4d2915dd6 (patch)
tree51121142a8c6194def341ab7a647bbd293790111
parent7be77e20d59fc3dd3fdde31641e0bc821114d26b (diff)
bpqether: fix rcu usage
The rcu_dereference() primitive needs to be applied to an l-value in order to ensure that compiler writers don't get an opportunity to apply reordering optimizations that could result in multiple fetches or in other misbehavior. This patch pulls the rcu_dereference() calls in bpq_seq_next() up to the point at which the fetched pointers are still l-values, rather than after list_entry() has transformed them into r-values. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Jeff Garzik <jeff@garzik.org> Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/net/hamradio/bpqether.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 656f2789c9ba..cc0ee93669ea 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -413,12 +413,12 @@ static void *bpq_seq_next(struct seq_file *seq, void *v, loff_t *pos)
413 ++*pos; 413 ++*pos;
414 414
415 if (v == SEQ_START_TOKEN) 415 if (v == SEQ_START_TOKEN)
416 p = bpq_devices.next; 416 p = rcu_dereference(bpq_devices.next);
417 else 417 else
418 p = ((struct bpqdev *)v)->bpq_list.next; 418 p = rcu_dereference(((struct bpqdev *)v)->bpq_list.next);
419 419
420 return (p == &bpq_devices) ? NULL 420 return (p == &bpq_devices) ? NULL
421 : rcu_dereference(list_entry(p, struct bpqdev, bpq_list)); 421 : list_entry(p, struct bpqdev, bpq_list);
422} 422}
423 423
424static void bpq_seq_stop(struct seq_file *seq, void *v) 424static void bpq_seq_stop(struct seq_file *seq, void *v)