[PATCH] fix slab corruption in namespace.c

Andries.Brouwer@cwi.nl
Sat, 19 Apr 2003 23:20:18 +0200 (MEST)


The
new_ns = kmalloc(sizeof(struct namespace *), GFP_KERNEL);
was less fortunate.

Andries

----------------------------------------------------------------
diff -u --recursive --new-file -X /linux/dontdiff a/fs/namespace.c b/fs/namespace.c
--- a/fs/namespace.c Wed Mar 5 10:47:29 2003
+++ b/fs/namespace.c Sat Apr 19 23:17:34 2003
@@ -52,7 +52,7 @@
INIT_LIST_HEAD(&mnt->mnt_list);
if (name) {
int size = strlen(name)+1;
- char * newname = kmalloc(size, GFP_KERNEL);
+ char *newname = kmalloc(size, GFP_KERNEL);
if (newname) {
memcpy(newname, name, size);
mnt->mnt_devname = newname;
@@ -774,7 +774,7 @@

get_namespace(namespace);

- if (! (flags & CLONE_NEWNS))
+ if (!(flags & CLONE_NEWNS))
return 0;

if (!capable(CAP_SYS_ADMIN)) {
@@ -782,7 +782,7 @@
return -EPERM;
}

- new_ns = kmalloc(sizeof(struct namespace *), GFP_KERNEL);
+ new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL);
if (!new_ns)
goto out;

-
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/