Commit eae61f3c829439f8f9121b5cd48a14be04df451f
Committed by
James Morris
1 parent
1adace9bb0
Exists in
master
and in
7 other branches
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 <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
Showing 1 changed file with 1 additions and 4 deletions Side-by-side Diff
security/tomoyo/file.c
... | ... | @@ -927,7 +927,7 @@ |
927 | 927 | struct path *path, const int flag) |
928 | 928 | { |
929 | 929 | const u8 acc_mode = ACC_MODE(flag); |
930 | - int error = -ENOMEM; | |
930 | + int error = 0; | |
931 | 931 | struct tomoyo_path_info buf; |
932 | 932 | struct tomoyo_request_info r; |
933 | 933 | int idx; |
... | ... | @@ -938,9 +938,6 @@ |
938 | 938 | buf.name = NULL; |
939 | 939 | r.mode = TOMOYO_CONFIG_DISABLED; |
940 | 940 | idx = tomoyo_read_lock(); |
941 | - if (!tomoyo_get_realpath(&buf, path)) | |
942 | - goto out; | |
943 | - error = 0; | |
944 | 941 | /* |
945 | 942 | * If the filename is specified by "deny_rewrite" keyword, |
946 | 943 | * we need to check "allow_rewrite" permission when the filename is not |