[2/3] zsmalloc: prevent mappping in interrupt context
diff mbox series

Message ID 1342630556-28686-2-git-send-email-sjenning@linux.vnet.ibm.com
State New, archived
Headers show
Series
  • [1/3] zsmalloc: s/firstpage/page in new copy map funcs
Related show

Commit Message

Seth Jennings July 18, 2012, 4:55 p.m. UTC
Because we use per-cpu mapping areas shared among the
pools/users, we can't allow mapping in interrupt context
because it can corrupt another users mappings.

Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
---
 drivers/staging/zsmalloc/zsmalloc-main.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Minchan Kim July 23, 2012, 12:13 a.m. UTC | #1
On Wed, Jul 18, 2012 at 11:55:55AM -0500, Seth Jennings wrote:
> Because we use per-cpu mapping areas shared among the
> pools/users, we can't allow mapping in interrupt context
> because it can corrupt another users mappings.
> 
> Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Acked-by: Minchan Kim <minchan@kernel.org>

Patch
diff mbox series

diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index 3c83c65..b86133f 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -75,6 +75,7 @@ 
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
 #include <linux/vmalloc.h>
+#include <linux/hardirq.h>
 
 #include "zsmalloc.h"
 #include "zsmalloc_int.h"
@@ -761,6 +762,13 @@  void *zs_map_object(struct zs_pool *pool, unsigned long handle,
 
 	BUG_ON(!handle);
 
+	/*
+	 * Because we use per-cpu mapping areas shared among the
+	 * pools/users, we can't allow mapping in interrupt context
+	 * because it can corrupt another users mappings.
+	 */
+	BUG_ON(in_interrupt());
+
 	obj_handle_to_location(handle, &page, &obj_idx);
 	get_zspage_mapping(get_first_page(page), &class_idx, &fg);
 	class = &pool->size_class[class_idx];