summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2016-04-06 15:53:27 -0700
committerKees Cook <keescook@chromium.org>2016-04-06 16:22:25 -0700
commit3d085c7413d32bb6895e5b9b5ee6a7d2180159c5 (patch)
treeeb6ab087af58ec383ef8fc6286fa67b1185c00e6 /drivers/misc
parentd2e10088ce01191748857296999b8c24a9a51959 (diff)
downloadlinux-stable-3d085c7413d32bb6895e5b9b5ee6a7d2180159c5.tar.gz
linux-stable-3d085c7413d32bb6895e5b9b5ee6a7d2180159c5.tar.bz2
linux-stable-3d085c7413d32bb6895e5b9b5ee6a7d2180159c5.zip
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 <keescook@chromium.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/lkdtm.c4
1 files changed, 3 insertions, 1 deletions
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;