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 /include/linux/inetdevice.h | |
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 'include/linux/inetdevice.h')
-rw-r--r-- | include/linux/inetdevice.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 2be1a1a2beb9..1ec09bb4a3ab 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/rcupdate.h> | 9 | #include <linux/rcupdate.h> |
10 | #include <linux/timer.h> | 10 | #include <linux/timer.h> |
11 | #include <linux/sysctl.h> | 11 | #include <linux/sysctl.h> |
12 | #include <linux/rtnetlink.h> | ||
12 | 13 | ||
13 | enum | 14 | enum |
14 | { | 15 | { |
@@ -198,14 +199,10 @@ static __inline__ int bad_mask(__be32 mask, __be32 addr) | |||
198 | 199 | ||
199 | static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) | 200 | static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) |
200 | { | 201 | { |
201 | struct in_device *in_dev = dev->ip_ptr; | 202 | return rcu_dereference(dev->ip_ptr); |
202 | if (in_dev) | ||
203 | in_dev = rcu_dereference(in_dev); | ||
204 | return in_dev; | ||
205 | } | 203 | } |
206 | 204 | ||
207 | static __inline__ struct in_device * | 205 | static inline struct in_device *in_dev_get(const struct net_device *dev) |
208 | in_dev_get(const struct net_device *dev) | ||
209 | { | 206 | { |
210 | struct in_device *in_dev; | 207 | struct in_device *in_dev; |
211 | 208 | ||
@@ -217,10 +214,9 @@ in_dev_get(const struct net_device *dev) | |||
217 | return in_dev; | 214 | return in_dev; |
218 | } | 215 | } |
219 | 216 | ||
220 | static __inline__ struct in_device * | 217 | static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev) |
221 | __in_dev_get_rtnl(const struct net_device *dev) | ||
222 | { | 218 | { |
223 | return (struct in_device*)dev->ip_ptr; | 219 | return rcu_dereference_check(dev->ip_ptr, lockdep_rtnl_is_held()); |
224 | } | 220 | } |
225 | 221 | ||
226 | extern void in_dev_finish_destroy(struct in_device *idev); | 222 | extern void in_dev_finish_destroy(struct in_device *idev); |