diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2008-01-11 01:35:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-11 01:35:21 -0500 |
commit | 0d89d7944fead211422e21fb7ea70ed3b903a79e (patch) | |
tree | 78886ab5b6397fa4446e251ffdfe3f1329947792 /net/decnet/dn_route.c | |
parent | 5c5482266537fdb24d6b8462540d8f65a6007a97 (diff) |
[DECNET] ROUTE: fix rcu_dereference() uses in /proc/net/decnet_cache
In dn_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
dn_rt_cache_get_first() and dn_rt_cache_get_next()
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/dn_route.c')
-rw-r--r-- | net/decnet/dn_route.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 66663e5d7acd..0e10ff21e292 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1665,12 +1665,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq) | |||
1665 | break; | 1665 | break; |
1666 | rcu_read_unlock_bh(); | 1666 | rcu_read_unlock_bh(); |
1667 | } | 1667 | } |
1668 | return rt; | 1668 | return rcu_dereference(rt); |
1669 | } | 1669 | } |
1670 | 1670 | ||
1671 | static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) | 1671 | static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) |
1672 | { | 1672 | { |
1673 | struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private); | 1673 | struct dn_rt_cache_iter_state *s = seq->private; |
1674 | 1674 | ||
1675 | rt = rt->u.dst.dn_next; | 1675 | rt = rt->u.dst.dn_next; |
1676 | while(!rt) { | 1676 | while(!rt) { |
@@ -1680,7 +1680,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou | |||
1680 | rcu_read_lock_bh(); | 1680 | rcu_read_lock_bh(); |
1681 | rt = dn_rt_hash_table[s->bucket].chain; | 1681 | rt = dn_rt_hash_table[s->bucket].chain; |
1682 | } | 1682 | } |
1683 | return rt; | 1683 | return rcu_dereference(rt); |
1684 | } | 1684 | } |
1685 | 1685 | ||
1686 | static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos) | 1686 | static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos) |