aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pipe.c')
-rw-r--r--fs/pipe.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/pipe.c b/fs/pipe.c
index 8912fa8f1666..db6eaaba0dd8 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1175,14 +1175,18 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
1175 1175
1176 switch (cmd) { 1176 switch (cmd) {
1177 case F_SETPIPE_SZ: 1177 case F_SETPIPE_SZ:
1178 if (!capable(CAP_SYS_ADMIN) && arg > pipe_max_pages) 1178 if (!capable(CAP_SYS_ADMIN) && arg > pipe_max_pages) {
1179 return -EINVAL; 1179 ret = -EINVAL;
1180 goto out;
1181 }
1180 /* 1182 /*
1181 * The pipe needs to be at least 2 pages large to 1183 * The pipe needs to be at least 2 pages large to
1182 * guarantee POSIX behaviour. 1184 * guarantee POSIX behaviour.
1183 */ 1185 */
1184 if (arg < 2) 1186 if (arg < 2) {
1185 return -EINVAL; 1187 ret = -EINVAL;
1188 goto out;
1189 }
1186 ret = pipe_set_size(pipe, arg); 1190 ret = pipe_set_size(pipe, arg);
1187 break; 1191 break;
1188 case F_GETPIPE_SZ: 1192 case F_GETPIPE_SZ:
@@ -1193,6 +1197,7 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
1193 break; 1197 break;
1194 } 1198 }
1195 1199
1200out:
1196 mutex_unlock(&pipe->inode->i_mutex); 1201 mutex_unlock(&pipe->inode->i_mutex);
1197 return ret; 1202 return ret;
1198} 1203}