netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: David Miller <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	<netdev@vger.kernel.org>
Subject: [PATCH 7/8] xfrm: put policies when reusing pcpu xdst entry
Date: Fri, 22 Dec 2017 10:45:00 +0100	[thread overview]
Message-ID: <20171222094501.23345-8-steffen.klassert@secunet.com> (raw)
In-Reply-To: <20171222094501.23345-1-steffen.klassert@secunet.com>

From: Florian Westphal <fw@strlen.de>

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>
---
 net/xfrm/xfrm_policy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 038ec68f6901..70aa5cb0c659 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1839,6 +1839,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;
-- 
2.14.1

  parent reply	other threads:[~2017-12-22  9:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22  9:44 pull request (net): ipsec 2017-12-22 Steffen Klassert
2017-12-22  9:44 ` [PATCH 1/8] xfrm: check id proto in validate_tmpl() Steffen Klassert
2017-12-22  9:44 ` [PATCH 2/8] xfrm: fix XFRMA_OUTPUT_MARK policy entry Steffen Klassert
2017-12-22  9:44 ` [PATCH 3/8] xfrm: Fix xfrm_input() to verify state is valid when (encap_type < 0) Steffen Klassert
2017-12-22  9:44 ` [PATCH 4/8] xfrm: Fix stack-out-of-bounds read on socket policy lookup Steffen Klassert
2017-12-22  9:44 ` [PATCH 5/8] xfrm: fix xfrm_do_migrate() with AEAD e.g(AES-GCM) Steffen Klassert
2017-12-22  9:44 ` [PATCH 6/8] xfrm: Fix stack-out-of-bounds with misconfigured transport mode policies Steffen Klassert
2017-12-22  9:45 ` Steffen Klassert [this message]
2017-12-22  9:45 ` [PATCH 8/8] xfrm: Reinject transport-mode packets through tasklet Steffen Klassert
2017-12-27 16:00 ` pull request (net): ipsec 2017-12-22 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171222094501.23345-8-steffen.klassert@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).