Skip to content

Commit

Permalink
net: avoid two atomic ops in ip_rcv_options()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and davem330 committed Jun 8, 2010
1 parent ed7865a commit 6e8b11b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/ipv4/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 6e8b11b

Please sign in to comment.