From: Andrew Morton <akpm@digeo.com>
To: Andries Brouwer <aebr@win.tue.nl>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Private namespaces
Date: Sat, 19 Apr 2003 14:35:19 -0700 [thread overview]
Message-ID: <20030419143519.09289af0.akpm@digeo.com> (raw)
In-Reply-To: <20030419162147.GB19740@win.tue.nl>
Andries Brouwer <aebr@win.tue.nl> wrote:
>
> Now you ask: but why ENOMEM?
> That is a tiny flaw in the kernel source.
That code's all fairly careless with its return values, isn't it?
How does this look?
kernel/fork.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff -puN kernel/fork.c~clone-retval-fix kernel/fork.c
--- 25/kernel/fork.c~clone-retval-fix 2003-04-19 14:28:05.000000000 -0700
+++ 25-akpm/kernel/fork.c 2003-04-19 14:31:26.000000000 -0700
@@ -568,7 +568,7 @@ static inline int copy_fs(unsigned long
}
tsk->fs = __copy_fs_struct(current->fs);
if (!tsk->fs)
- return -1;
+ return -ENOMEM;
return 0;
}
@@ -703,7 +703,7 @@ static inline int copy_sighand(unsigned
sig = kmem_cache_alloc(sighand_cachep, GFP_KERNEL);
tsk->sighand = sig;
if (!sig)
- return -1;
+ return -ENOMEM;
spin_lock_init(&sig->siglock);
atomic_set(&sig->count, 1);
memcpy(sig->action, current->sighand->action, sizeof(sig->action));
@@ -721,7 +721,7 @@ static inline int copy_signal(unsigned l
sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
tsk->signal = sig;
if (!sig)
- return -1;
+ return -ENOMEM;
atomic_set(&sig->count, 1);
sig->group_exit = 0;
sig->group_exit_code = 0;
@@ -866,23 +866,22 @@ static struct task_struct *copy_process(
p->security = NULL;
p->as_io_context = NULL;
- retval = -ENOMEM;
- if (security_task_alloc(p))
+ if ((retval = security_task_alloc(p)))
goto bad_fork_cleanup;
/* copy all the process information */
- if (copy_semundo(clone_flags, p))
+ if ((retval = copy_semundo(clone_flags, p)))
goto bad_fork_cleanup_security;
- if (copy_files(clone_flags, p))
+ if ((retval = copy_files(clone_flags, p)))
goto bad_fork_cleanup_semundo;
- if (copy_fs(clone_flags, p))
+ if ((retval = copy_fs(clone_flags, p)))
goto bad_fork_cleanup_files;
- if (copy_sighand(clone_flags, p))
+ if ((retval = copy_sighand(clone_flags, p)))
goto bad_fork_cleanup_fs;
- if (copy_signal(clone_flags, p))
+ if ((retval = copy_signal(clone_flags, p)))
goto bad_fork_cleanup_sighand;
- if (copy_mm(clone_flags, p))
+ if ((retval = copy_mm(clone_flags, p)))
goto bad_fork_cleanup_signal;
- if (copy_namespace(clone_flags, p))
+ if ((retval = copy_namespace(clone_flags, p)))
goto bad_fork_cleanup_mm;
retval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs);
if (retval)
_
next prev parent reply other threads:[~2003-04-19 21:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-05 13:23 Adrian Etchevarne
2003-04-16 13:23 ` Andries Brouwer
2003-04-19 14:52 ` Florin Iucha
2003-04-19 16:21 ` Andries Brouwer
2003-04-19 21:35 ` Andrew Morton [this message]
2003-04-16 13:40 ` Lee Causier
-- strict thread matches above, loose matches on Subject: below --
2003-04-19 22:18 Andries.Brouwer
2003-04-19 22:22 ` Andrew Morton
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=20030419143519.09289af0.akpm@digeo.com \
--to=akpm@digeo.com \
--cc=aebr@win.tue.nl \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®