Re: __get_user usage in mm/slab.c

Roman Zippel (zippel@linux-m68k.org)
Tue, 12 Mar 2002 17:32:04 +0100 (CET)


Hi,

On Tue, 12 Mar 2002, Andi Kleen wrote:

> I guess set_fs(KERNEL_DS); __*_user() will not catch exceptions on m68k
> currently, right?

It will, so the patch below is enough. Linus, could you please it?
If we only have a few users of this, I agree with David, that this is
enough. Should it become more common in generic code, it should at least
be documented somewhere.

bye, Roman

Index: mm/slab.c
===================================================================
RCS file: /home/other/cvs/linux/linux-2.5/mm/slab.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 slab.c
--- mm/slab.c 2002/03/12 13:28:52 1.1.1.5
+++ mm/slab.c 2002/03/12 15:25:00
@@ -839,6 +839,8 @@
down(&cache_chain_sem);
{
struct list_head *p;
+ mm_segment_t fs = get_fs();
+ set_fs(KERNEL_DS);

list_for_each(p, &cache_chain) {
kmem_cache_t *pc = list_entry(p, kmem_cache_t, next);
@@ -857,6 +859,7 @@
BUG();
}
}
+ set_fs(fs);
}

/* There is no reason to lock our new cache before we
@@ -1964,8 +1967,11 @@
name = cachep->name;
{
char tmp;
+ mm_segment_t fs = get_fs();
+ set_fs(KERNEL_DS);
if (__get_user(tmp, name))
name = "broken";
+ set_fs(fs);
}

seq_printf(m, "%-17s %6lu %6lu %6u %4lu %4lu %4u",

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/