From 5976889a7943fa5df471b0b0eafca954a5a660db Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Wed, 11 Mar 2015 07:39:43 +0100 Subject: [PATCH] driver: Correctly tag kmalloc allocation on behalf of user space When the provided config size if beyond kmalloc limits, it may raise a WARN_ON. Avoid this by tagging the allocation with __GFP_NOWARN. Also properly tag it as GFP_USER instead of GFP_KERNEL. Signed-off-by: Jan Kiszka --- driver/cell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/cell.c b/driver/cell.c index 07eb602..89d1141 100644 --- a/driver/cell.c +++ b/driver/cell.c @@ -161,7 +161,7 @@ int jailhouse_cmd_cell_create(struct jailhouse_cell_create __user *arg) if (copy_from_user(&cell_params, arg, sizeof(cell_params))) return -EFAULT; - config = kmalloc(cell_params.config_size, GFP_KERNEL | GFP_DMA); + config = kmalloc(cell_params.config_size, GFP_USER | __GFP_NOWARN); if (!config) return -ENOMEM; -- 2.39.2