aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-05-06 23:42:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-08 13:46:56 -0400
commitba719baeabbff5476eeb91c223e6921ba29e1490 (patch)
treef3023d34b9ca087412839f6b5937478d49e567ec /arch/m32r
parentc1236d31a1b9fc018b85e15a3e58e3601ddc90ae (diff)
sys_pipe(): fix file descriptor leaks
Remember to close the files if copy_to_user() failed. Spotted by dm.n9107@gmail.com. Signed-off-by: Ulrich Drepper <drepper@redhat.com> Cc: DM <dm.n9107@gmail.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m32r')
-rw-r--r--arch/m32r/kernel/sys_m32r.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index 6d7a80fdad4..319c79720b8 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -90,8 +90,11 @@ sys_pipe(unsigned long r0, unsigned long r1, unsigned long r2,
90 90
91 error = do_pipe(fd); 91 error = do_pipe(fd);
92 if (!error) { 92 if (!error) {
93 if (copy_to_user((void __user *)r0, fd, 2*sizeof(int))) 93 if (copy_to_user((void __user *)r0, fd, 2*sizeof(int))) {
94 sys_close(fd[0]);
95 sys_close(fd[1]);
94 error = -EFAULT; 96 error = -EFAULT;
97 }
95 } 98 }
96 return error; 99 return error;
97} 100}