This frees the allocated page if there is a kmalloc failure. Signed-off-by: Kees Cook <keescook@chromium.org>
@@ -507,8 +507,10 @@ static void lkdtm_do_action(enum ctype which)
break;
val = kmalloc(1024, GFP_KERNEL);
- if (!val)
+ if (!val) {
+ free_page(p);
+ }
base = (int *)p;