Commit 6e8b11b4 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: avoid two atomic ops in ip_rcv_options()

in_dev_get() -> __in_dev_get_rcu() in a rcu protected function.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ed7865a4
...@@ -293,18 +293,16 @@ static inline int ip_rcv_options(struct sk_buff *skb) ...@@ -293,18 +293,16 @@ static inline int ip_rcv_options(struct sk_buff *skb)
} }
if (unlikely(opt->srr)) { 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) {
if (!IN_DEV_SOURCE_ROUTE(in_dev)) { if (!IN_DEV_SOURCE_ROUTE(in_dev)) {
if (IN_DEV_LOG_MARTIANS(in_dev) && if (IN_DEV_LOG_MARTIANS(in_dev) &&
net_ratelimit()) net_ratelimit())
printk(KERN_INFO "source route option %pI4 -> %pI4\n", printk(KERN_INFO "source route option %pI4 -> %pI4\n",
&iph->saddr, &iph->daddr); &iph->saddr, &iph->daddr);
in_dev_put(in_dev);
goto drop; goto drop;
} }
in_dev_put(in_dev);
} }
if (ip_options_rcv_srr(skb)) if (ip_options_rcv_srr(skb))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment