diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-06-06 23:54:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-08 00:49:51 -0400 |
commit | 6e8b11b43b0c2e901734e2cdd70c6e325a90c4ef (patch) | |
tree | 867d740b9969f749890dabaa252f78232af467b3 /net/ipv4 | |
parent | ed7865a47d4759e85bbd7bed44bee411d868eaad (diff) |
net: avoid two atomic ops in ip_rcv_options()
in_dev_get() -> __in_dev_get_rcu() in a rcu protected function.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ip_input.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index d274078b1665..08a3b121f908 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -293,18 +293,16 @@ static inline int ip_rcv_options(struct sk_buff *skb) | |||
293 | } | 293 | } |
294 | 294 | ||
295 | if (unlikely(opt->srr)) { | 295 | if (unlikely(opt->srr)) { |
296 | struct in_device *in_dev = in_dev_get(dev); | 296 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
297 | |||
297 | if (in_dev) { | 298 | if (in_dev) { |
298 | if (!IN_DEV_SOURCE_ROUTE(in_dev)) { | 299 | if (!IN_DEV_SOURCE_ROUTE(in_dev)) { |
299 | if (IN_DEV_LOG_MARTIANS(in_dev) && | 300 | if (IN_DEV_LOG_MARTIANS(in_dev) && |
300 | net_ratelimit()) | 301 | net_ratelimit()) |
301 | printk(KERN_INFO "source route option %pI4 -> %pI4\n", | 302 | printk(KERN_INFO "source route option %pI4 -> %pI4\n", |
302 | &iph->saddr, &iph->daddr); | 303 | &iph->saddr, &iph->daddr); |
303 | in_dev_put(in_dev); | ||
304 | goto drop; | 304 | goto drop; |
305 | } | 305 | } |
306 | |||
307 | in_dev_put(in_dev); | ||
308 | } | 306 | } |
309 | 307 | ||
310 | if (ip_options_rcv_srr(skb)) | 308 | if (ip_options_rcv_srr(skb)) |