From: Alexey Dobriyan Date: Fri, 7 Nov 2008 07:08:37 +0000 (-0800) Subject: af_key: mark policy as dead before destroying X-Git-Tag: v2.6.28-rc5~90^2~15 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=70e90679ffce0937deb77e2bd8bd918a24a897fd;p=linux-2.6-omap-h63xx.git af_key: mark policy as dead before destroying xfrm_policy_destroy() will oops if not dead policy is passed to it. On error path in pfkey_compile_policy() exactly this happens. Oopsable for CAP_NET_ADMIN owners. Signed-off-by: Alexey Dobriyan Signed-off-by: David S. Miller --- diff --git a/net/key/af_key.c b/net/key/af_key.c index 3440a4637f0..5b22e011653 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -3188,6 +3188,7 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt, return xp; out: + xp->walk.dead = 1; xfrm_policy_destroy(xp); return NULL; }