summaryrefslogtreecommitdiffstats
path: root/net/key
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-02-12 13:53:54 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-12 13:53:54 -0800
commit13fcfbb0675bf87da694f55dec11cada489a205c (patch)
tree2a1b81c5f7e69781f3e6ee523fd67c2b923531ca /net/key
parent9121c77706a4bd75a878573c913553ade120e9ce (diff)
downloadlinux-13fcfbb0675bf87da694f55dec11cada489a205c.tar.gz
linux-13fcfbb0675bf87da694f55dec11cada489a205c.tar.bz2
linux-13fcfbb0675bf87da694f55dec11cada489a205c.zip
[XFRM]: Fix OOPSes in xfrm_audit_log().
Make sure that this function is called correctly, and add BUG() checking to ensure the arguments are sane. Based upon a patch by Joy Latten. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/key')
-rw-r--r--net/key/af_key.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index f3a026ff9b2c..1c58204d767e 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2297,16 +2297,17 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
&sel, tmp.security, 1);
security_xfrm_policy_free(&tmp);
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSPD, (xp) ? 1 : 0, xp, NULL);
-
if (xp == NULL)
return -ENOENT;
- err = 0;
+ err = security_xfrm_policy_delete(xp);
- if ((err = security_xfrm_policy_delete(xp)))
+ xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
+ AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+
+ if (err)
goto out;
+
c.seq = hdr->sadb_msg_seq;
c.pid = hdr->sadb_msg_pid;
c.event = XFRM_MSG_DELPOLICY;