Commit c60369f0 authored by Seth Jennings's avatar Seth Jennings Committed by Greg Kroah-Hartman

staging: zsmalloc: prevent mappping in interrupt context

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: default avatarSeth Jennings <sjenning@linux.vnet.ibm.com>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6539a36c
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/hardirq.h>
#include "zsmalloc.h" #include "zsmalloc.h"
#include "zsmalloc_int.h" #include "zsmalloc_int.h"
...@@ -761,6 +762,13 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, ...@@ -761,6 +762,13 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
BUG_ON(!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); obj_handle_to_location(handle, &page, &obj_idx);
get_zspage_mapping(get_first_page(page), &class_idx, &fg); get_zspage_mapping(get_first_page(page), &class_idx, &fg);
class = &pool->size_class[class_idx]; class = &pool->size_class[class_idx];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment