aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 086e172d0d3d..30eab4f063cd 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -711,8 +711,10 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
711 old_fds = old_fdt->fd; 711 old_fds = old_fdt->fd;
712 new_fds = new_fdt->fd; 712 new_fds = new_fdt->fd;
713 713
714 memcpy(new_fdt->open_fds->fds_bits, old_fdt->open_fds->fds_bits, open_files/8); 714 memcpy(new_fdt->open_fds->fds_bits,
715 memcpy(new_fdt->close_on_exec->fds_bits, old_fdt->close_on_exec->fds_bits, open_files/8); 715 old_fdt->open_fds->fds_bits, open_files/8);
716 memcpy(new_fdt->close_on_exec->fds_bits,
717 old_fdt->close_on_exec->fds_bits, open_files/8);
716 718
717 for (i = open_files; i != 0; i--) { 719 for (i = open_files; i != 0; i--) {
718 struct file *f = *old_fds++; 720 struct file *f = *old_fds++;
@@ -745,14 +747,11 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
745 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left); 747 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left);
746 } 748 }
747 749
748out:
749 return newf; 750 return newf;
750 751
751out_release: 752out_release:
752 free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset);
753 free_fdset (new_fdt->open_fds, new_fdt->max_fdset);
754 free_fd_array(new_fdt->fd, new_fdt->max_fds);
755 kmem_cache_free(files_cachep, newf); 753 kmem_cache_free(files_cachep, newf);
754out:
756 return NULL; 755 return NULL;
757} 756}
758 757