Commit b3fd6a0d authored by David S. Miller's avatar David S. Miller

SLAB: When using get_user on kernel pointers, enter KERNEL_DS.

parent 902a0b68
...@@ -839,7 +839,10 @@ kmem_cache_create (const char *name, size_t size, size_t offset, ...@@ -839,7 +839,10 @@ kmem_cache_create (const char *name, size_t size, size_t offset,
down(&cache_chain_sem); down(&cache_chain_sem);
{ {
struct list_head *p; struct list_head *p;
mm_segment_t old_fs;
old_fs = get_fs();
set_fs(KERNEL_DS);
list_for_each(p, &cache_chain) { list_for_each(p, &cache_chain) {
kmem_cache_t *pc = list_entry(p, kmem_cache_t, next); kmem_cache_t *pc = list_entry(p, kmem_cache_t, next);
char tmp; char tmp;
...@@ -857,6 +860,7 @@ kmem_cache_create (const char *name, size_t size, size_t offset, ...@@ -857,6 +860,7 @@ kmem_cache_create (const char *name, size_t size, size_t offset,
BUG(); BUG();
} }
} }
set_fs(old_fs);
} }
/* There is no reason to lock our new cache before we /* There is no reason to lock our new cache before we
...@@ -1965,8 +1969,13 @@ static int s_show(struct seq_file *m, void *p) ...@@ -1965,8 +1969,13 @@ static int s_show(struct seq_file *m, void *p)
name = cachep->name; name = cachep->name;
{ {
char tmp; char tmp;
mm_segment_t old_fs;
old_fs = get_fs();
set_fs(KERNEL_DS);
if (__get_user(tmp, name)) if (__get_user(tmp, name))
name = "broken"; name = "broken";
set_fs(old_fs);
} }
seq_printf(m, "%-17s %6lu %6lu %6u %4lu %4lu %4u", seq_printf(m, "%-17s %6lu %6lu %6u %4lu %4lu %4u",
......
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