Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c4823bce033be74c0fcfbcae2f1be0854fdc2e18
Commit:     c4823bce033be74c0fcfbcae2f1be0854fdc2e18
Parent:     baab1087c61d4506f2c9f4cdb7da162160de16c2
Author:     Al Viro <[EMAIL PROTECTED]>
AuthorDate: Mon Mar 12 16:17:42 2007 +0000
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Mar 14 15:27:48 2007 -0700

    [PATCH] 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 <[EMAIL PROTECTED]>
    Acked-by: James Morris <[EMAIL PROTECTED]>
    Signed-off-by: Al Viro <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/auditsc.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 3599558..628c7ac 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -739,28 +739,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;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to