All of lore.kernel.org
 help / color / mirror / Atom feed
From: roy.qing.li@gmail.com
To: netdev@vger.kernel.org
Cc: steffen.klassert@secunet.com, eparis@redhat.com
Subject: [PATCH] xfrm: fix a possible policy leak
Date: Fri,  8 May 2015 15:13:35 +0800	[thread overview]
Message-ID: <1431069215-31916-1-git-send-email-roy.qing.li@gmail.com> (raw)

From: "Signed-off-by: Li RongQing" <roy.qing.li@gmail.com>

policy should be put if exit xfrm_policy_bysel_ctx() due to the
failure of calling security_xfrm_policy_delete. since policy has
been hold before

Fixes: ef41aaa0b7 [IPSEC]: xfrm_policy delete security check misplaced
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Cc: Eric Paris <eparis@redhat.com>
---
 net/xfrm/xfrm_policy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 3d264e5..66450c3 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -824,6 +824,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, u8 type,
 				*err = security_xfrm_policy_delete(
 								pol->security);
 				if (*err) {
+					xfrm_pol_put(pol);
 					write_unlock_bh(&net->xfrm.xfrm_policy_lock);
 					return pol;
 				}
@@ -863,6 +864,7 @@ struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8 type,
 				*err = security_xfrm_policy_delete(
 								pol->security);
 				if (*err) {
+					xfrm_pol_put(pol);
 					write_unlock_bh(&net->xfrm.xfrm_policy_lock);
 					return pol;
 				}
-- 
2.1.0

             reply	other threads:[~2015-05-08  7:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08  7:13 roy.qing.li [this message]
2015-05-08  9:33 ` [PATCH] xfrm: fix a possible policy leak Li RongQing
  -- strict thread matches above, loose matches on Subject: below --
2015-05-08  9:39 roy.qing.li
2015-05-11 11:03 ` Steffen Klassert

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=1431069215-31916-1-git-send-email-roy.qing.li@gmail.com \
    --to=roy.qing.li@gmail.com \
    --cc=eparis@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.