aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/fork.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 195958a3a4d6..49adc0e8d47c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -625,6 +625,7 @@ out:
625/* 625/*
626 * Allocate a new files structure and copy contents from the 626 * Allocate a new files structure and copy contents from the
627 * passed in files structure. 627 * passed in files structure.
628 * errorp will be valid only when the returned files_struct is NULL.
628 */ 629 */
629static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) 630static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
630{ 631{
@@ -633,6 +634,7 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
633 int open_files, size, i, expand; 634 int open_files, size, i, expand;
634 struct fdtable *old_fdt, *new_fdt; 635 struct fdtable *old_fdt, *new_fdt;
635 636
637 *errorp = -ENOMEM;
636 newf = alloc_files(); 638 newf = alloc_files();
637 if (!newf) 639 if (!newf)
638 goto out; 640 goto out;
@@ -746,7 +748,6 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
746 * break this. 748 * break this.
747 */ 749 */
748 tsk->files = NULL; 750 tsk->files = NULL;
749 error = -ENOMEM;
750 newf = dup_fd(oldf, &error); 751 newf = dup_fd(oldf, &error);
751 if (!newf) 752 if (!newf)
752 goto out; 753 goto out;