Message ID | 1346193187.3571.21.camel@edumazet-glaptop |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Tue, 28 Aug 2012 15:33:07 -0700 > From: Eric Dumazet <edumazet@google.com> > > [PATCH] ipv4: must use rcu protection while calling fib_lookup > > Following lockdep splat was reported by Pavel Roskin : ... > Signed-off-by: Eric Dumazet <edumazet@google.com> > Reported-by: Pavel Roskin <proski@gnu.org> Applied, thanks. It looks like the redirect handlers might have the same problem? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2012-08-30 at 13:34 -0400, David Miller wrote: > From: Eric Dumazet <eric.dumazet@gmail.com> > Date: Tue, 28 Aug 2012 15:33:07 -0700 > > > From: Eric Dumazet <edumazet@google.com> > > > > [PATCH] ipv4: must use rcu protection while calling fib_lookup > > > > Following lockdep splat was reported by Pavel Roskin : > ... > > Signed-off-by: Eric Dumazet <edumazet@google.com> > > Reported-by: Pavel Roskin <proski@gnu.org> > > Applied, thanks. > > It looks like the redirect handlers might have the same problem? Hi David Correct me if I am wrong, but redirect handlers should all run under rcu_read_lock() protection already. rcu_read_lock() is done in ip_local_deliver_finish() or ip_rt_send_redirect() for the forward path. And above of them, we also have rcu_read_lock() done in __netif_receive_skb() -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Fri, 31 Aug 2012 04:50:14 -0700 > On Thu, 2012-08-30 at 13:34 -0400, David Miller wrote: >> From: Eric Dumazet <eric.dumazet@gmail.com> >> Date: Tue, 28 Aug 2012 15:33:07 -0700 >> >> > From: Eric Dumazet <edumazet@google.com> >> > >> > [PATCH] ipv4: must use rcu protection while calling fib_lookup >> > >> > Following lockdep splat was reported by Pavel Roskin : >> ... >> > Signed-off-by: Eric Dumazet <edumazet@google.com> >> > Reported-by: Pavel Roskin <proski@gnu.org> >> >> Applied, thanks. >> >> It looks like the redirect handlers might have the same problem? > > Hi David > > Correct me if I am wrong, but redirect handlers should all run under > rcu_read_lock() protection already. > > rcu_read_lock() is done in ip_local_deliver_finish() or > ip_rt_send_redirect() for the forward path. > > And above of them, we also have rcu_read_lock() done in > __netif_receive_skb() Indeed, you're right, thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 24fd4c5..82cf2a7 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -934,12 +934,14 @@ static u32 __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) if (mtu < ip_rt_min_pmtu) mtu = ip_rt_min_pmtu; + rcu_read_lock(); if (fib_lookup(dev_net(rt->dst.dev), fl4, &res) == 0) { struct fib_nh *nh = &FIB_RES_NH(res); update_or_create_fnhe(nh, fl4->daddr, 0, mtu, jiffies + ip_rt_mtu_expires); } + rcu_read_unlock(); return mtu; }