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

ipv4: RCU changes in __mkroute_input()

Avoid two atomic ops on output device refcount
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bc10502d
...@@ -1957,22 +1957,22 @@ static void ip_handle_martian_source(struct net_device *dev, ...@@ -1957,22 +1957,22 @@ static void ip_handle_martian_source(struct net_device *dev,
#endif #endif
} }
/* called in rcu_read_lock() section */
static int __mkroute_input(struct sk_buff *skb, static int __mkroute_input(struct sk_buff *skb,
struct fib_result *res, struct fib_result *res,
struct in_device *in_dev, struct in_device *in_dev,
__be32 daddr, __be32 saddr, u32 tos, __be32 daddr, __be32 saddr, u32 tos,
struct rtable **result) struct rtable **result)
{ {
struct rtable *rth; struct rtable *rth;
int err; int err;
struct in_device *out_dev; struct in_device *out_dev;
unsigned flags = 0; unsigned int flags = 0;
__be32 spec_dst; __be32 spec_dst;
u32 itag; u32 itag;
/* get a working reference to the output device */ /* get a working reference to the output device */
out_dev = in_dev_get(FIB_RES_DEV(*res)); out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res));
if (out_dev == NULL) { if (out_dev == NULL) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_CRIT "Bug in ip_route_input" \ printk(KERN_CRIT "Bug in ip_route_input" \
...@@ -2053,8 +2053,6 @@ static int __mkroute_input(struct sk_buff *skb, ...@@ -2053,8 +2053,6 @@ static int __mkroute_input(struct sk_buff *skb,
*result = rth; *result = rth;
err = 0; err = 0;
cleanup: cleanup:
/* release the working reference to the output device */
in_dev_put(out_dev);
return err; return err;
} }
......
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