aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/cris/kernel/sys_cris.c5
-rw-r--r--arch/m32r/kernel/sys_m32r.c5
-rw-r--r--fs/pipe.c6
3 files changed, 13 insertions, 3 deletions
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 8b9984197edc..d124066e1728 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -40,8 +40,11 @@ asmlinkage int sys_pipe(unsigned long __user * fildes)
40 error = do_pipe(fd); 40 error = do_pipe(fd);
41 unlock_kernel(); 41 unlock_kernel();
42 if (!error) { 42 if (!error) {
43 if (copy_to_user(fildes, fd, 2*sizeof(int))) 43 if (copy_to_user(fildes, fd, 2*sizeof(int))) {
44 sys_close(fd[0]);
45 sys_close(fd[1]);
44 error = -EFAULT; 46 error = -EFAULT;
47 }
45 } 48 }
46 return error; 49 return error;
47} 50}
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index 6d7a80fdad48..319c79720b8a 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}
diff --git a/fs/pipe.c b/fs/pipe.c
index 3499f9ff6316..ec228bc9f882 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -17,6 +17,7 @@
17#include <linux/highmem.h> 17#include <linux/highmem.h>
18#include <linux/pagemap.h> 18#include <linux/pagemap.h>
19#include <linux/audit.h> 19#include <linux/audit.h>
20#include <linux/syscalls.h>
20 21
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
22#include <asm/ioctls.h> 23#include <asm/ioctls.h>
@@ -1086,8 +1087,11 @@ asmlinkage long __weak sys_pipe(int __user *fildes)
1086 1087
1087 error = do_pipe(fd); 1088 error = do_pipe(fd);
1088 if (!error) { 1089 if (!error) {
1089 if (copy_to_user(fildes, fd, sizeof(fd))) 1090 if (copy_to_user(fildes, fd, sizeof(fd))) {
1091 sys_close(fd[0]);
1092 sys_close(fd[1]);
1090 error = -EFAULT; 1093 error = -EFAULT;
1094 }
1091 } 1095 }
1092 return error; 1096 return error;
1093} 1097}