Skip to contentSkip to conversation

xfrm: put policies when reusing pcpu xdst entry

PATCH Applied Florian Westphal 2 participants 2 messages Dec 11, 2017 – Dec 13, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfrm: put policies when reusing pcpu xdst entry

We need to put the policies when re-using the pcpu xdst entry, else this leaks the reference.

Fixes ec30d78c14a813db39a647b6a348b428 ("xfrm: add xdst pcpu cache")
---
 net/xfrm/xfrm_policy.c | 1 +
 1 file changed, 1 insertion(+)
net/xfrm/xfrm_policy.c +1 -0
index 9542975eb2f9..88143a480ec9 100644
@@ -1833,6 +1833,7 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
 		   sizeof(struct xfrm_policy *) * num_pols) == 0 &&
 	    xfrm_xdst_can_reuse(xdst, xfrm, err)) {
 		dst_hold(&xdst->u.dst);
+		xfrm_pols_put(pols, num_pols);
 		while (err > 0)
 			xfrm_state_put(xfrm[--err]);
 		return xdst;
Signature · 1 line
2.13.6
maintainer Applied
#1 lore raw
Quoted 5 lines · Florian Westphal

We need to put the policies when re-using the pcpu xdst entry, else this leaks the reference.

Fixes ec30d78c14a813db39a647b6a348b428 ("xfrm: add xdst pcpu cache")

Applied, thanks Florian!