Skip to content

Commit

Permalink
af_key: mark policy as dead before destroying
Browse files Browse the repository at this point in the history
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 <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexey Dobriyan authored and David S. Miller committed Nov 7, 2008
1 parent 4bab0ea commit 70e9067
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/key/af_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 70e9067

Please sign in to comment.