Skip to content

Commit b7eea45

Browse files
committed
xfrm: Fix refcount imbalance in xfrm_lookup
xfrm_lookup must return a dst_entry with a refcount for the caller. Git commit 1a1ccc9 ("xfrm: Remove caching of xfrm_policy_sk_bundles") removed this refcount for the socket policy case accidentally. This patch restores it and sets DST_NOCACHE flag to make sure that the dst_entry is freed when the refcount becomes null. Fixes: 1a1ccc9 ("xfrm: Remove caching of xfrm_policy_sk_bundles") Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent d7933ab commit b7eea45

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎net/xfrm/xfrm_policy.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,6 +2097,8 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
20972097
goto no_transform;
20982098
}
20992099

2100+
dst_hold(&xdst->u.dst);
2101+
xdst->u.dst.flags |= DST_NOCACHE;
21002102
route = xdst->route;
21012103
}
21022104
}

0 commit comments

Comments
 (0)