Skip to content

Commit

Permalink
net: fix two lockdep splats
Browse files Browse the repository at this point in the history
Commit e67f88d (net: dont hold rtnl mutex during netlink dump
callbacks) switched rtnl protection to RCU, but we forgot to adjust two
rcu_dereference() lockdep annotations :

inet_get_link_af_size() or inet_fill_link_af() might be called with
rcu_read_lock or rtnl held, so use rcu_dereference_rtnl()
instead of rtnl_dereference()

Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed May 10, 2011
1 parent 8f01cb0 commit 1fc19af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh,

static size_t inet_get_link_af_size(const struct net_device *dev)
{
struct in_device *in_dev = __in_dev_get_rtnl(dev);
struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr);

if (!in_dev)
return 0;
Expand All @@ -1379,7 +1379,7 @@ static size_t inet_get_link_af_size(const struct net_device *dev)

static int inet_fill_link_af(struct sk_buff *skb, const struct net_device *dev)
{
struct in_device *in_dev = __in_dev_get_rtnl(dev);
struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr);
struct nlattr *nla;
int i;

Expand Down

0 comments on commit 1fc19af

Please sign in to comment.