diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-09-15 00:04:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-16 01:06:05 -0400 |
commit | 95ae6b228f814fc0528d0506ee9f18ac333d6851 (patch) | |
tree | d5287f3dee478e1bd5fa79e63192447c5bc91e92 /drivers/net/plip.c | |
parent | 9e0064a5456fd75fd7c70f6f3692c7f732f91a65 (diff) |
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/plip.c')
-rw-r--r-- | drivers/net/plip.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 7e82a82422cf..ca4df7f4cf21 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -995,8 +995,10 @@ plip_tx_packet(struct sk_buff *skb, struct net_device *dev) | |||
995 | static void | 995 | static void |
996 | plip_rewrite_address(const struct net_device *dev, struct ethhdr *eth) | 996 | plip_rewrite_address(const struct net_device *dev, struct ethhdr *eth) |
997 | { | 997 | { |
998 | const struct in_device *in_dev = dev->ip_ptr; | 998 | const struct in_device *in_dev; |
999 | 999 | ||
1000 | rcu_read_lock(); | ||
1001 | in_dev = __in_dev_get_rcu(dev); | ||
1000 | if (in_dev) { | 1002 | if (in_dev) { |
1001 | /* Any address will do - we take the first */ | 1003 | /* Any address will do - we take the first */ |
1002 | const struct in_ifaddr *ifa = in_dev->ifa_list; | 1004 | const struct in_ifaddr *ifa = in_dev->ifa_list; |
@@ -1006,6 +1008,7 @@ plip_rewrite_address(const struct net_device *dev, struct ethhdr *eth) | |||
1006 | memcpy(eth->h_dest+2, &ifa->ifa_address, 4); | 1008 | memcpy(eth->h_dest+2, &ifa->ifa_address, 4); |
1007 | } | 1009 | } |
1008 | } | 1010 | } |
1011 | rcu_read_unlock(); | ||
1009 | } | 1012 | } |
1010 | 1013 | ||
1011 | static int | 1014 | static int |
@@ -1088,7 +1091,8 @@ plip_open(struct net_device *dev) | |||
1088 | when the device address isn't identical to the address of a | 1091 | when the device address isn't identical to the address of a |
1089 | received frame, the kernel incorrectly drops it). */ | 1092 | received frame, the kernel incorrectly drops it). */ |
1090 | 1093 | ||
1091 | if ((in_dev=dev->ip_ptr) != NULL) { | 1094 | in_dev=__in_dev_get_rtnl(dev); |
1095 | if (in_dev) { | ||
1092 | /* Any address will do - we take the first. We already | 1096 | /* Any address will do - we take the first. We already |
1093 | have the first two bytes filled with 0xfc, from | 1097 | have the first two bytes filled with 0xfc, from |
1094 | plip_init_dev(). */ | 1098 | plip_init_dev(). */ |