Skip to contentSkip to conversation

ipv6: have a single rcu unlock point in __ip6_rt_update_pmtu

PATCH Applied David Ahern 2 participants 2 messages Aug 1, 2019 – Aug 5, 2019

Subsystems (3)
lore
Share & tools
lore

David Ahern

author maintainer
#0 lore raw

PATCH 1/1 ipv6: have a single rcu unlock point in __ip6_rt_update_pmtu

From: David Ahern <[email protected]>

Simplify the unlock path in __ip6_rt_update_pmtu by using a single point where rcu_read_unlock is called.

---
 net/ipv6/route.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
net/ipv6/route.c +6 -8
index e49fec767a10..3c5c331b50f1 100644
@@ -2725,10 +2725,9 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
 
 		rcu_read_lock();
 		res.f6i = rcu_dereference(rt6->from);
-		if (!res.f6i) {
-			rcu_read_unlock();
-			return;
-		}
+		if (!res.f6i)
+			goto out_unlock;
+
 		res.fib6_flags = res.f6i->fib6_flags;
 		res.fib6_type = res.f6i->fib6_type;
 
@@ -2744,10 +2743,8 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
 			/* fib6_info uses a nexthop that does not have fib6_nh
 			 * using the dst->dev + gw. Should be impossible.
 			 */
-			if (!arg.match) {
-				rcu_read_unlock();
-				return;
-			}
+			if (!arg.match)
+				goto out_unlock;
 
 			res.nh = arg.match;
 		} else {
@@ -2760,6 +2757,7 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
 			if (rt6_insert_exception(nrt6, &res))
 				dst_release_immediate(&nrt6->dst);
 		}
+out_unlock:
 		rcu_read_unlock();
 	}
 }
Signature · 1 line
2.11.0