提交 6e667260 编写于 作者: P Prasanna Meda 提交者: Linus Torvalds

[PATCH] dup fd error fix

Set errorp in dup_fd, it will be used in sys_unshare also.
Signed-off-by: NPrasanna Meda <mlp@google.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 538c5902
...@@ -625,6 +625,7 @@ static struct files_struct *alloc_files(void) ...@@ -625,6 +625,7 @@ static struct files_struct *alloc_files(void)
/* /*
* Allocate a new files structure and copy contents from the * Allocate a new files structure and copy contents from the
* passed in files structure. * passed in files structure.
* errorp will be valid only when the returned files_struct is NULL.
*/ */
static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
{ {
...@@ -633,6 +634,7 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) ...@@ -633,6 +634,7 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
int open_files, size, i, expand; int open_files, size, i, expand;
struct fdtable *old_fdt, *new_fdt; struct fdtable *old_fdt, *new_fdt;
*errorp = -ENOMEM;
newf = alloc_files(); newf = alloc_files();
if (!newf) if (!newf)
goto out; goto out;
...@@ -746,7 +748,6 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk) ...@@ -746,7 +748,6 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
* break this. * break this.
*/ */
tsk->files = NULL; tsk->files = NULL;
error = -ENOMEM;
newf = dup_fd(oldf, &error); newf = dup_fd(oldf, &error);
if (!newf) if (!newf)
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册