diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-06-07 05:54:46 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-08 06:49:51 +0200 |
commit | 6e8b11b43b0c2e901734e2cdd70c6e325a90c4ef (patch) | |
tree | 867d740b9969f749890dabaa252f78232af467b3 /net/ipv4 | |
parent | ipv4: avoid two atomic ops in ip_rt_redirect() (diff) | |
download | linux-6e8b11b43b0c2e901734e2cdd70c6e325a90c4ef.tar.xz linux-6e8b11b43b0c2e901734e2cdd70c6e325a90c4ef.zip |
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) } if (unlikely(opt->srr)) { - struct in_device *in_dev = in_dev_get(dev); + struct in_device *in_dev = __in_dev_get_rcu(dev); + if (in_dev) { if (!IN_DEV_SOURCE_ROUTE(in_dev)) { if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) printk(KERN_INFO "source route option %pI4 -> %pI4\n", &iph->saddr, &iph->daddr); - in_dev_put(in_dev); goto drop; } - - in_dev_put(in_dev); } if (ip_options_rcv_srr(skb)) |