Commit d2e10088 authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Kees Cook

lkdtm: fix memory leak of base

This case is supposed to read from a memory after it has been freed,
but we missed freeing base if the memory 'val' could not be allocated.
Signed-off-by: default avatarSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 50fbd977
...@@ -458,8 +458,10 @@ static void lkdtm_do_action(enum ctype which) ...@@ -458,8 +458,10 @@ static void lkdtm_do_action(enum ctype which)
break; break;
val = kmalloc(len, GFP_KERNEL); val = kmalloc(len, GFP_KERNEL);
if (!val) if (!val) {
kfree(base);
break; break;
}
*val = 0x12345678; *val = 0x12345678;
base[offset] = *val; base[offset] = *val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment