Эх сурвалжийг харах

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>
Kees Cook 9 жил өмнө
parent
commit
3d085c7413

+ 3 - 1
drivers/misc/lkdtm.c

@@ -507,8 +507,10 @@ static void lkdtm_do_action(enum ctype which)
 			break;
 			break;
 
 
 		val = kmalloc(1024, GFP_KERNEL);
 		val = kmalloc(1024, GFP_KERNEL);
-		if (!val)
+		if (!val) {
+			free_page(p);
 			break;
 			break;
+		}
 
 
 		base = (int *)p;
 		base = (int *)p;