Skip to content

Commit 38369f5

Browse files
committed
xfrm Fix potential error pointer dereference in xfrm_bundle_create.
We may derference an invalid pointer in the error path of xfrm_bundle_create(). Fix this by returning this error pointer directly instead of assigning it to xdst0. Fixes: 45b018b ("ipsec: Create and use new helpers for dst child access.") Signed-off-by: Steffen Klassert <[email protected]>
1 parent d9f9277 commit 38369f5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

net/xfrm/xfrm_policy.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,6 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
16581658
trailer_len -= xdst_prev->u.dst.xfrm->props.trailer_len;
16591659
}
16601660

1661-
out:
16621661
return &xdst0->u.dst;
16631662

16641663
put_states:
@@ -1667,8 +1666,8 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
16671666
free_dst:
16681667
if (xdst0)
16691668
dst_release_immediate(&xdst0->u.dst);
1670-
xdst0 = ERR_PTR(err);
1671-
goto out;
1669+
1670+
return ERR_PTR(err);
16721671
}
16731672

16741673
static int xfrm_expand_policies(const struct flowi *fl, u16 family,

0 commit comments

Comments
 (0)