Skip to content

Commit cfc64fd

Browse files
chobitsxjamesmorris
authored andcommitted
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>
1 parent 93b9c98 commit cfc64fd

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎security/tomoyo/memory.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ void *tomoyo_commit_ok(void *data, const unsigned int size)
7575
memset(data, 0, size);
7676
return ptr;
7777
}
78+
kfree(ptr);
7879
return NULL;
7980
}
8081

0 commit comments

Comments
 (0)