TOMOYO: Remove usage counter for temporary memory.
TOMOYO was using own memory usage counter for detecting memory leak.
But as kernel 2.6.31 introduced memory leak detection mechanism
( CONFIG_DEBUG_KMEMLEAK ), we no longer need to have own counter.
We remove usage counter for memory used for permission checks, but we keep
usage counter for memory used for policy so that we can apply quota.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c
index cfcb096..24af081 100644
--- a/security/tomoyo/file.c
+++ b/security/tomoyo/file.c
@@ -150,7 +150,8 @@
static struct tomoyo_path_info *tomoyo_get_path(struct path *path)
{
int error;
- struct tomoyo_path_info_with_data *buf = tomoyo_alloc(sizeof(*buf));
+ struct tomoyo_path_info_with_data *buf = kzalloc(sizeof(*buf),
+ GFP_KERNEL);
if (!buf)
return NULL;
@@ -162,7 +163,7 @@
tomoyo_fill_path_info(&buf->head);
return &buf->head;
}
- tomoyo_free(buf);
+ kfree(buf);
return NULL;
}
@@ -1227,7 +1228,7 @@
TOMOYO_TYPE_TRUNCATE_ACL,
buf, mode);
out:
- tomoyo_free(buf);
+ kfree(buf);
tomoyo_read_unlock(idx);
if (!is_enforce)
error = 0;
@@ -1273,7 +1274,7 @@
error = tomoyo_check_single_path_permission2(domain, operation, buf,
mode);
out:
- tomoyo_free(buf);
+ kfree(buf);
tomoyo_read_unlock(idx);
if (!is_enforce)
error = 0;
@@ -1312,7 +1313,7 @@
TOMOYO_TYPE_REWRITE_ACL,
buf, mode);
out:
- tomoyo_free(buf);
+ kfree(buf);
tomoyo_read_unlock(idx);
if (!is_enforce)
error = 0;
@@ -1379,8 +1380,8 @@
false);
}
out:
- tomoyo_free(buf1);
- tomoyo_free(buf2);
+ kfree(buf1);
+ kfree(buf2);
tomoyo_read_unlock(idx);
if (!is_enforce)
error = 0;