diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2007-03-19 11:55:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-03-23 12:49:27 -0700 |
commit | 7ac7551d5cf0d01b0a67a6653c25045e23904732 (patch) | |
tree | 73aeee3e6eafbc45fd00c0f23f117eaf3da71fc0 /kernel | |
parent | 6f09b7b3b28cd65c9a08757fcf6d9762d541ef9a (diff) |
fix deadlock in audit_log_task_context()
GFP_KERNEL allocations in non-blocking context; fixed by killing
an idiotic use of security_getprocattr().
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/auditsc.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 298897559ca4..470f845e62f3 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -734,28 +734,26 @@ static inline void audit_free_context(struct audit_context *context) void audit_log_task_context(struct audit_buffer *ab) { char *ctx = NULL; - ssize_t len = 0; + unsigned len; + int error; + u32 sid; + + selinux_get_task_sid(current, &sid); + if (!sid) + return; - len = security_getprocattr(current, "current", NULL, 0); - if (len < 0) { - if (len != -EINVAL) + error = selinux_sid_to_string(sid, &ctx, &len); + if (error) { + if (error != -EINVAL) goto error_path; return; } - ctx = kmalloc(len, GFP_KERNEL); - if (!ctx) - goto error_path; - - len = security_getprocattr(current, "current", ctx, len); - if (len < 0 ) - goto error_path; - audit_log_format(ab, " subj=%s", ctx); + kfree(ctx); return; error_path: - kfree(ctx); audit_panic("error in audit_log_task_context"); return; } |