Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>

authored by

Florian Westphal and committed by
Steffen Klassert
d2950278 732706af

+1
+1
net/xfrm/xfrm_policy.c
··· 1839 1839 sizeof(struct xfrm_policy *) * num_pols) == 0 && 1840 1840 xfrm_xdst_can_reuse(xdst, xfrm, err)) { 1841 1841 dst_hold(&xdst->u.dst); 1842 + xfrm_pols_put(pols, num_pols); 1842 1843 while (err > 0) 1843 1844 xfrm_state_put(xfrm[--err]); 1844 1845 return xdst;