aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-11-29 15:05:55 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-30 17:24:14 -0500
commit218fa90f072e4aeff9003d57e390857f4f35513e (patch)
tree09563123179d16ab4ba74812c741b72636268ca1 /net
parentf7e57044eeb1841847c24aa06766c8290c202583 (diff)
ipv4: fix lockdep splat in rt_cache_seq_show
After commit f2c31e32b378 (fix NULL dereferences in check_peer_redir()), dst_get_neighbour() should be guarded by rcu_read_lock() / rcu_read_unlock() section. Reported-by: Miles Lane <miles.lane@gmail.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/route.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 5c2847247f51..57e01bc60947 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -417,9 +417,13 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
417 else { 417 else {
418 struct rtable *r = v; 418 struct rtable *r = v;
419 struct neighbour *n; 419 struct neighbour *n;
420 int len; 420 int len, HHUptod;
421 421
422 rcu_read_lock();
422 n = dst_get_neighbour(&r->dst); 423 n = dst_get_neighbour(&r->dst);
424 HHUptod = (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0;
425 rcu_read_unlock();
426
423 seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t" 427 seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t"
424 "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n", 428 "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n",
425 r->dst.dev ? r->dst.dev->name : "*", 429 r->dst.dev ? r->dst.dev->name : "*",
@@ -433,7 +437,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
433 dst_metric(&r->dst, RTAX_RTTVAR)), 437 dst_metric(&r->dst, RTAX_RTTVAR)),
434 r->rt_key_tos, 438 r->rt_key_tos,
435 -1, 439 -1,
436 (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0, 440 HHUptod,
437 r->rt_spec_dst, &len); 441 r->rt_spec_dst, &len);
438 442
439 seq_printf(seq, "%*s\n", 127 - len, ""); 443 seq_printf(seq, "%*s\n", 127 - len, "");