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-Tag: v4.14-rc1~3419^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3d085c7413d32bb6895e5b9b5ee6a7d2180159c5;p=platform%2Fkernel%2Flinux-rpi.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 5b3a63c..0a5cbbe 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;