[PATCH] fix copy_namespace()

From: Christoph Hellwig
Date: Mon Aug 25 2003 - 09:32:25 EST


Originally by aeb, in 2.5 for ages.

Fix far too small kmalloc in copy_namespace and promote errors properly.


--- linux/fs/namespace.c 2003-06-13 22:07:33.000000000 +0200
+++ linux/fs/namespace.c 2003-06-18 02:48:47.000000000 +0200
@@ -763,7 +763,7 @@ int copy_namespace(int flags, struct tas
return -EPERM;
}

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

--- linux/kernel/fork.c 2003-06-18 02:36:34.000000000 +0200
+++ linux/kernel/fork.c 2003-06-18 02:49:22.000000000 +0200
@@ -793,7 +793,8 @@ int do_fork(unsigned long clone_flags, u
goto bad_fork_cleanup_fs;
if (copy_mm(clone_flags, p))
goto bad_fork_cleanup_sighand;
- if (copy_namespace(clone_flags, p))
+ retval = copy_namespace(clone_flags, p);
+ if (retval)
goto bad_fork_cleanup_mm;
retval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs);
if (retval)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/