diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2011-09-25 17:51:06 +0900 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-09-26 10:46:22 +1000 |
commit | a427fd14d3edf6396c4b9638dbc8e2972afaa05b (patch) | |
tree | 2f8fdffa989f6e18f57bfb61f5ecfc4fdcf8d729 /security/tomoyo/gc.c | |
parent | f9732ea145886786a6f8b0493bc2239e70cbacdb (diff) | |
download | blackbird-op-linux-a427fd14d3edf6396c4b9638dbc8e2972afaa05b.tar.gz blackbird-op-linux-a427fd14d3edf6396c4b9638dbc8e2972afaa05b.zip |
TOMOYO: Remove tomoyo_policy_memory_lock spinlock.
tomoyo_policy_lock mutex already protects it.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/gc.c')
-rw-r--r-- | security/tomoyo/gc.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/security/tomoyo/gc.c b/security/tomoyo/gc.c index f2295c65f1e4..c3214b32dbfb 100644 --- a/security/tomoyo/gc.c +++ b/security/tomoyo/gc.c @@ -8,6 +8,21 @@ #include <linux/kthread.h> #include <linux/slab.h> +/** + * tomoyo_memory_free - Free memory for elements. + * + * @ptr: Pointer to allocated memory. + * + * Returns nothing. + * + * Caller holds tomoyo_policy_lock mutex. + */ +static inline void tomoyo_memory_free(void *ptr) +{ + tomoyo_memory_used[TOMOYO_MEMORY_POLICY] -= ksize(ptr); + kfree(ptr); +} + /* The list for "struct tomoyo_io_buffer". */ static LIST_HEAD(tomoyo_io_buffer_list); /* Lock for protecting tomoyo_io_buffer_list. */ @@ -215,6 +230,8 @@ static void tomoyo_del_acl(struct list_head *element) * @element: Pointer to "struct list_head". * * Returns nothing. + * + * Caller holds tomoyo_policy_lock mutex. */ static inline void tomoyo_del_domain(struct list_head *element) { @@ -416,12 +433,13 @@ static void tomoyo_try_to_gc(const enum tomoyo_policy_id type, (element, typeof(struct tomoyo_domain_info), list)->users)) goto reinject; - tomoyo_del_domain(element); break; case TOMOYO_MAX_POLICY: break; } mutex_lock(&tomoyo_policy_lock); + if (type == TOMOYO_ID_DOMAIN) + tomoyo_del_domain(element); tomoyo_memory_free(element); return; reinject: |