diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2008-01-10 06:55:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-10 06:55:57 -0500 |
commit | 0bcceadceb0907094ba4e40bf9a7cd9b080f13fb (patch) | |
tree | 6cec2343354c5a22107eb53da276ab744519033a /net | |
parent | 9cd40029423701c376391da59d2c6469672b4bed (diff) |
[IPV4] ROUTE: fix rcu_dereference() uses in /proc/net/rt_cache
In rt_cache_get_next(), no need to guard seq->private by a
rcu_dereference() since seq is private to the thread running this
function. Reading seq.private once (as guaranted bu rcu_dereference())
or several time if compiler really is dumb enough wont change the
result.
But we miss real spots where rcu_dereference() are needed, both in
rt_cache_get_first() and rt_cache_get_next()
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/route.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index d3377069ce0..28484f396b0 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -283,12 +283,12 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq) | |||
283 | break; | 283 | break; |
284 | rcu_read_unlock_bh(); | 284 | rcu_read_unlock_bh(); |
285 | } | 285 | } |
286 | return r; | 286 | return rcu_dereference(r); |
287 | } | 287 | } |
288 | 288 | ||
289 | static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) | 289 | static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) |
290 | { | 290 | { |
291 | struct rt_cache_iter_state *st = rcu_dereference(seq->private); | 291 | struct rt_cache_iter_state *st = seq->private; |
292 | 292 | ||
293 | r = r->u.dst.rt_next; | 293 | r = r->u.dst.rt_next; |
294 | while (!r) { | 294 | while (!r) { |
@@ -298,7 +298,7 @@ static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) | |||
298 | rcu_read_lock_bh(); | 298 | rcu_read_lock_bh(); |
299 | r = rt_hash_table[st->bucket].chain; | 299 | r = rt_hash_table[st->bucket].chain; |
300 | } | 300 | } |
301 | return r; | 301 | return rcu_dereference(r); |
302 | } | 302 | } |
303 | 303 | ||
304 | static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos) | 304 | static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos) |