Skip to content

Commit 013cb81

Browse files
committed
xfrm: Fix infinite loop in xfrm_get_dst_nexthop with transport mode.
On transport mode we forget to fetch the child dst_entry before we continue the while loop, this leads to an infinite loop. Fix this by fetching the child dst_entry before we continue the while loop. Fixes: 0f6c480 ("xfrm: Move dst->path into struct xfrm_dst") Reported-by: [email protected] Tested-by: Florian Westphal <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 143a445 commit 013cb81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/xfrm/xfrm_policy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,14 +2732,14 @@ static const void *xfrm_get_dst_nexthop(const struct dst_entry *dst,
27322732
while (dst->xfrm) {
27332733
const struct xfrm_state *xfrm = dst->xfrm;
27342734

2735+
dst = xfrm_dst_child(dst);
2736+
27352737
if (xfrm->props.mode == XFRM_MODE_TRANSPORT)
27362738
continue;
27372739
if (xfrm->type->flags & XFRM_TYPE_REMOTE_COADDR)
27382740
daddr = xfrm->coaddr;
27392741
else if (!(xfrm->type->flags & XFRM_TYPE_LOCAL_COADDR))
27402742
daddr = &xfrm->id.daddr;
2741-
2742-
dst = xfrm_dst_child(dst);
27432743
}
27442744
return daddr;
27452745
}

0 commit comments

Comments
 (0)