提交 50fbd977 编写于 作者: S Sudip Mukherjee 提交者: Kees Cook

lkdtm: fix memory leak of val

This case is supposed to read from a page after after it is freed, but
it missed freeing val if we are not able to get a free page.
Signed-off-by: NSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: NKees Cook <keescook@chromium.org>
上级 c4004b02
...@@ -498,12 +498,13 @@ static void lkdtm_do_action(enum ctype which) ...@@ -498,12 +498,13 @@ static void lkdtm_do_action(enum ctype which)
} }
case CT_READ_BUDDY_AFTER_FREE: { case CT_READ_BUDDY_AFTER_FREE: {
unsigned long p = __get_free_page(GFP_KERNEL); unsigned long p = __get_free_page(GFP_KERNEL);
int saw, *val = kmalloc(1024, GFP_KERNEL); int saw, *val;
int *base; int *base;
if (!p) if (!p)
break; break;
val = kmalloc(1024, GFP_KERNEL);
if (!val) if (!val)
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册