From: Kees Cook Date: Wed, 6 Apr 2016 22:53:27 +0000 (-0700) Subject: lkdtm: do not leak free page on kmalloc failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3d085c7413d32bb6895e5b9b5ee6a7d2180159c5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git lkdtm: do not leak free page on kmalloc failure This frees the allocated page if there is a kmalloc failure. Signed-off-by: Kees Cook --- diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c index 5b3a63c87ec9..0a5cbbe12452 100644 --- a/drivers/misc/lkdtm.c +++ b/drivers/misc/lkdtm.c @@ -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;