Skip to content

Commit

Permalink
lkdtm: do not leak free page on kmalloc failure
Browse files Browse the repository at this point in the history
This frees the allocated page if there is a kmalloc failure.

Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
Kees Cook committed Apr 6, 2016
1 parent d2e1008 commit 3d085c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/misc/lkdtm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
break;
}

base = (int *)p;

Expand Down

0 comments on commit 3d085c7

Please sign in to comment.