Skip to content

Commit 43a4b60

Browse files
dsaherndavem330
authored andcommitted
ipv6: have a single rcu unlock point in __ip6_rt_update_pmtu
Simplify the unlock path in __ip6_rt_update_pmtu by using a single point where rcu_read_unlock is called. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5a0d7dc commit 43a4b60

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

net/ipv6/route.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,10 +2725,9 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
27252725

27262726
rcu_read_lock();
27272727
res.f6i = rcu_dereference(rt6->from);
2728-
if (!res.f6i) {
2729-
rcu_read_unlock();
2730-
return;
2731-
}
2728+
if (!res.f6i)
2729+
goto out_unlock;
2730+
27322731
res.fib6_flags = res.f6i->fib6_flags;
27332732
res.fib6_type = res.f6i->fib6_type;
27342733

@@ -2744,10 +2743,8 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
27442743
/* fib6_info uses a nexthop that does not have fib6_nh
27452744
* using the dst->dev + gw. Should be impossible.
27462745
*/
2747-
if (!arg.match) {
2748-
rcu_read_unlock();
2749-
return;
2750-
}
2746+
if (!arg.match)
2747+
goto out_unlock;
27512748

27522749
res.nh = arg.match;
27532750
} else {
@@ -2760,6 +2757,7 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
27602757
if (rt6_insert_exception(nrt6, &res))
27612758
dst_release_immediate(&nrt6->dst);
27622759
}
2760+
out_unlock:
27632761
rcu_read_unlock();
27642762
}
27652763
}

0 commit comments

Comments
 (0)