[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1431069215-31916-1-git-send-email-roy.qing.li@gmail.com>
Date: Fri, 8 May 2015 15:13:35 +0800
From: roy.qing.li@...il.com
To: netdev@...r.kernel.org
Cc: steffen.klassert@...unet.com, eparis@...hat.com
Subject: [PATCH] xfrm: fix a possible policy leak
From: "Signed-off-by: Li RongQing" <roy.qing.li@...il.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@...il.com>
Cc: Eric Paris <eparis@...hat.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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists