Skip to content

Commit

Permalink
xfrm: Fix refcount imbalance in xfrm_lookup
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
klassert committed Jun 26, 2014
1 parent d7933ab commit b7eea45
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,8 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
goto no_transform;
}

dst_hold(&xdst->u.dst);
xdst->u.dst.flags |= DST_NOCACHE;
route = xdst->route;
}
}
Expand Down

0 comments on commit b7eea45

Please sign in to comment.