---------- Forwarded message ----------
Date: Wed, 16 Mar 2011 19:00:22 GMT
From: Linux Kernel Mailing List <[email protected]>
To: [email protected]
Subject: TOMOYO: Fix memory leak upon file open.

Gitweb:     http://git.kernel.org/linus/eae61f3c829439f8f9121b5cd48a14be04df451f
Commit:     eae61f3c829439f8f9121b5cd48a14be04df451f
Parent:     1adace9bb04a5f4a4dea9e642089102661bb0ceb
Author:     Tetsuo Handa <[email protected]>
AuthorDate: Wed Mar 2 16:54:24 2011 +0900
Committer:  James Morris <[email protected]>
CommitDate: Thu Mar 3 10:13:26 2011 +1100

    TOMOYO: Fix memory leak upon file open.
    
    In tomoyo_check_open_permission() since 2.6.36, TOMOYO was by error
    recalculating already calculated pathname when checking allow_rewrite
    permission. As a result, memory will leak whenever a file is opened for 
writing
    without O_APPEND flag. Also, performance will degrade because TOMOYO is
    calculating pathname regardless of profile configuration.
    This patch fixes the leak and performance degrade.
    
    Signed-off-by: Tetsuo Handa <[email protected]>
    Signed-off-by: James Morris <[email protected]>
---
 security/tomoyo/file.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c
index 9d32f18..cb09f1f 100644
--- a/security/tomoyo/file.c
+++ b/security/tomoyo/file.c
@@ -927,7 +927,7 @@ int tomoyo_check_open_permission(struct tomoyo_domain_info 
*domain,
                                 struct path *path, const int flag)
 {
        const u8 acc_mode = ACC_MODE(flag);
-       int error = -ENOMEM;
+       int error = 0;
        struct tomoyo_path_info buf;
        struct tomoyo_request_info r;
        int idx;
@@ -938,9 +938,6 @@ int tomoyo_check_open_permission(struct tomoyo_domain_info 
*domain,
        buf.name = NULL;
        r.mode = TOMOYO_CONFIG_DISABLED;
        idx = tomoyo_read_lock();
-       if (!tomoyo_get_realpath(&buf, path))
-               goto out;
-       error = 0;
        /*
         * If the filename is specified by "deny_rewrite" keyword,
         * we need to check "allow_rewrite" permission when the filename is not
--
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

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to