mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 14:43:16 +00:00
netfilter: nat: remove unnecessary rcu_read_lock in nf_nat_redirect_ipv{4/6}
nf_nat_redirect_ipv4() and nf_nat_redirect_ipv6() are only called by netfilter hook point. so that rcu_read_lock and rcu_read_unlock() are unnecessary. Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
4430b897a2
commit
c8204cab9c
@ -52,13 +52,11 @@ nf_nat_redirect_ipv4(struct sk_buff *skb,
|
|||||||
|
|
||||||
newdst = 0;
|
newdst = 0;
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
indev = __in_dev_get_rcu(skb->dev);
|
indev = __in_dev_get_rcu(skb->dev);
|
||||||
if (indev && indev->ifa_list) {
|
if (indev && indev->ifa_list) {
|
||||||
ifa = indev->ifa_list;
|
ifa = indev->ifa_list;
|
||||||
newdst = ifa->ifa_local;
|
newdst = ifa->ifa_local;
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
if (!newdst)
|
if (!newdst)
|
||||||
return NF_DROP;
|
return NF_DROP;
|
||||||
@ -97,7 +95,6 @@ nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
|
|||||||
struct inet6_ifaddr *ifa;
|
struct inet6_ifaddr *ifa;
|
||||||
bool addr = false;
|
bool addr = false;
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
idev = __in6_dev_get(skb->dev);
|
idev = __in6_dev_get(skb->dev);
|
||||||
if (idev != NULL) {
|
if (idev != NULL) {
|
||||||
read_lock_bh(&idev->lock);
|
read_lock_bh(&idev->lock);
|
||||||
@ -108,7 +105,6 @@ nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
|
|||||||
}
|
}
|
||||||
read_unlock_bh(&idev->lock);
|
read_unlock_bh(&idev->lock);
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
if (!addr)
|
if (!addr)
|
||||||
return NF_DROP;
|
return NF_DROP;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user