summaryrefslogtreecommitdiffstats
path: root/drivers/net/via-velocity.h
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-09-15 04:04:31 +0000
committerDavid S. Miller <davem@davemloft.net>2010-09-15 22:06:05 -0700
commit95ae6b228f814fc0528d0506ee9f18ac333d6851 (patch)
treed5287f3dee478e1bd5fa79e63192447c5bc91e92 /drivers/net/via-velocity.h
parent9e0064a5456fd75fd7c70f6f3692c7f732f91a65 (diff)
downloadlinux-stable-95ae6b228f814fc0528d0506ee9f18ac333d6851.tar.gz
linux-stable-95ae6b228f814fc0528d0506ee9f18ac333d6851.tar.bz2
linux-stable-95ae6b228f814fc0528d0506ee9f18ac333d6851.zip
ipv4: ip_ptr cleanups
dev->ip_ptr is protected by rtnl and rcu. Yet some places dont use appropriate primitives and/or locking rules. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/via-velocity.h')
-rw-r--r--drivers/net/via-velocity.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index f7b33ae7a703..b5e120b0074b 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -1504,22 +1504,25 @@ struct velocity_info {
* addresses on this chain then we use the first - multi-IP WOL is not
* supported.
*
- * CHECK ME: locking
*/
static inline int velocity_get_ip(struct velocity_info *vptr)
{
- struct in_device *in_dev = (struct in_device *) vptr->dev->ip_ptr;
+ struct in_device *in_dev;
struct in_ifaddr *ifa;
+ int res = -ENOENT;
+ rcu_read_lock();
+ in_dev = __in_dev_get_rcu(vptr->dev);
if (in_dev != NULL) {
ifa = (struct in_ifaddr *) in_dev->ifa_list;
if (ifa != NULL) {
memcpy(vptr->ip_addr, &ifa->ifa_address, 4);
- return 0;
+ res = 0;
}
}
- return -ENOENT;
+ rcu_read_unlock();
+ return res;
}
/**