瀏覽代碼

tomoyo: fix memory leak in tomoyo_commit_ok()

When memory used for policy exceeds the quota, tomoyo_memory_ok() return false.
In this case, tomoyo_commit_ok() must call kfree() before returning NULL.
This bug exists since 2.6.35.

Signed-off-by: Xiaochen Wang <wangxiaochen0@gmail.com>
Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
Xiaochen Wang 14 年之前
父節點
當前提交
cfc64fd91f
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      security/tomoyo/memory.c

+ 1 - 0
security/tomoyo/memory.c

@@ -75,6 +75,7 @@ void *tomoyo_commit_ok(void *data, const unsigned int size)
 		memset(data, 0, size);
 		return ptr;
 	}
+	kfree(ptr);
 	return NULL;
 }