]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
net: kill an RCU warning in inet_fill_link_af()
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 1 Dec 2010 06:03:06 +0000 (06:03 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 6 Dec 2010 20:59:06 +0000 (12:59 -0800)
commits 9f0f7272 (ipv4: AF_INET link address family) and cf7afbfeb8c
(rtnl: make link af-specific updates atomic) used incorrect
__in_dev_get_rcu() in RTNL protected contexts, triggering PROVE_RCU
warnings.

Switch to __in_dev_get_rtnl(), wich is more appropriate, since we hold
RTNL.

Based on a report and initial patch from Amerigo Wang.

Reported-by: Amerigo Wang <amwang@redhat.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Thomas Graf <tgraf@infradead.org>
Reviewed-by: WANG Cong <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/devinet.c

index d9f71bae45c40ddf0231c12164dea85d32c2b883..3b067704ab3852e5e51363ead5cbe9013fb5741e 100644 (file)
@@ -1258,7 +1258,7 @@ errout:
 
 static size_t inet_get_link_af_size(const struct net_device *dev)
 {
-       struct in_device *in_dev = __in_dev_get_rcu(dev);
+       struct in_device *in_dev = __in_dev_get_rtnl(dev);
 
        if (!in_dev)
                return 0;
@@ -1268,7 +1268,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_rcu(dev);
+       struct in_device *in_dev = __in_dev_get_rtnl(dev);
        struct nlattr *nla;
        int i;
 
@@ -1295,7 +1295,7 @@ static int inet_validate_link_af(const struct net_device *dev,
        struct nlattr *a, *tb[IFLA_INET_MAX+1];
        int err, rem;
 
-       if (dev && !__in_dev_get_rcu(dev))
+       if (dev && !__in_dev_get_rtnl(dev))
                return -EAFNOSUPPORT;
 
        err = nla_parse_nested(tb, IFLA_INET_MAX, nla, inet_af_policy);
@@ -1319,7 +1319,7 @@ static int inet_validate_link_af(const struct net_device *dev,
 
 static int inet_set_link_af(struct net_device *dev, const struct nlattr *nla)
 {
-       struct in_device *in_dev = __in_dev_get_rcu(dev);
+       struct in_device *in_dev = __in_dev_get_rtnl(dev);
        struct nlattr *a, *tb[IFLA_INET_MAX+1];
        int rem;