public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: marcelo@hera.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fix copy_namespace()
Date: Mon, 25 Aug 2003 16:29:48 +0200	[thread overview]
Message-ID: <20030825142948.GA17740@lst.de> (raw)

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)

                 reply	other threads:[~2003-08-25 14:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030825142948.GA17740@lst.de \
    --to=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@hera.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox