Commit 7953a508 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] copy_process return value fix

Rather than assuming that all the things which copy_process() calls want to
return -ENOMEM, correctly propagate the return values.

This turns out to be a no-op at present.
parent 7a2a7655
......@@ -380,7 +380,6 @@ static struct mm_struct * mm_init(struct mm_struct * mm)
return NULL;
}
/*
* Allocate and initialize an mm_struct.
*/
......@@ -562,7 +561,7 @@ static inline int copy_fs(unsigned long clone_flags, struct task_struct * tsk)
}
tsk->fs = __copy_fs_struct(current->fs);
if (!tsk->fs)
return -1;
return -ENOMEM;
return 0;
}
......@@ -697,7 +696,7 @@ static inline int copy_sighand(unsigned long clone_flags, struct task_struct * t
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));
......@@ -715,7 +714,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
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;
......@@ -860,23 +859,22 @@ static struct task_struct *copy_process(unsigned long clone_flags,
p->security = 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;
retval = copy_namespace(clone_flags, p);
if (retval)
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment