icmp: RCU conversion in icmp_address_reply()
- rcu_read_lock() already held by caller - use __in_dev_get_rcu() instead of in_dev_get() / in_dev_put() - remove goto out; Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
88e7594a97
commit
cfa087f689
|
@ -925,6 +925,7 @@ static void icmp_address(struct sk_buff *skb)
|
||||||
/*
|
/*
|
||||||
* RFC1812 (4.3.3.9). A router SHOULD listen all replies, and complain
|
* RFC1812 (4.3.3.9). A router SHOULD listen all replies, and complain
|
||||||
* loudly if an inconsistency is found.
|
* loudly if an inconsistency is found.
|
||||||
|
* called with rcu_read_lock()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void icmp_address_reply(struct sk_buff *skb)
|
static void icmp_address_reply(struct sk_buff *skb)
|
||||||
|
@ -935,12 +936,12 @@ static void icmp_address_reply(struct sk_buff *skb)
|
||||||
struct in_ifaddr *ifa;
|
struct in_ifaddr *ifa;
|
||||||
|
|
||||||
if (skb->len < 4 || !(rt->rt_flags&RTCF_DIRECTSRC))
|
if (skb->len < 4 || !(rt->rt_flags&RTCF_DIRECTSRC))
|
||||||
goto out;
|
return;
|
||||||
|
|
||||||
in_dev = in_dev_get(dev);
|
in_dev = __in_dev_get_rcu(dev);
|
||||||
if (!in_dev)
|
if (!in_dev)
|
||||||
goto out;
|
return;
|
||||||
rcu_read_lock();
|
|
||||||
if (in_dev->ifa_list &&
|
if (in_dev->ifa_list &&
|
||||||
IN_DEV_LOG_MARTIANS(in_dev) &&
|
IN_DEV_LOG_MARTIANS(in_dev) &&
|
||||||
IN_DEV_FORWARD(in_dev)) {
|
IN_DEV_FORWARD(in_dev)) {
|
||||||
|
@ -958,9 +959,6 @@ static void icmp_address_reply(struct sk_buff *skb)
|
||||||
mp, dev->name, &rt->rt_src);
|
mp, dev->name, &rt->rt_src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
|
||||||
in_dev_put(in_dev);
|
|
||||||
out:;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void icmp_discard(struct sk_buff *skb)
|
static void icmp_discard(struct sk_buff *skb)
|
||||||
|
|
Loading…
Reference in New Issue