Re: my slab cache broken on sparc64

David S. Miller (davem@redhat.com)
Fri, 03 May 2002 20:07:47 -0700 (PDT)


From: "Holzrichter, Bruce" <bruce.holzrichter@monster.com>
Date: Fri, 3 May 2002 22:15:56 -0500

Your patch is buggy:

+ mm_segment_t old_fs = get_fs();
+ set_fs(KERNEL_DS);
if (__get_user(tmp,pc->name)) {
printk("SLAB: cache with size %d has lost
its name\n",
pc->objsize);
continue;
- }
+ }
+ set_fs(old_fs);

If the __get_user() fails, you will leave the kernel in the
KERNEL_DS segment.

Do it like this instead.

int fault;
mm_segment_t old_fs;

...

old_fs = get_fs();
set_fs(KERNEL_DS);
fault = __get_user(tmp, pc->name);
set_fs(old_fs);

if (fault) {
...
-
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/