aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/pipe.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/pipe.c b/fs/pipe.c
index f31e2d472984..279eef96c51c 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1215,12 +1215,13 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
1215 size = round_pipe_size(arg); 1215 size = round_pipe_size(arg);
1216 nr_pages = size >> PAGE_SHIFT; 1216 nr_pages = size >> PAGE_SHIFT;
1217 1217
1218 ret = -EINVAL;
1219 if (!nr_pages)
1220 goto out;
1221
1218 if (!capable(CAP_SYS_RESOURCE) && size > pipe_max_size) { 1222 if (!capable(CAP_SYS_RESOURCE) && size > pipe_max_size) {
1219 ret = -EPERM; 1223 ret = -EPERM;
1220 goto out; 1224 goto out;
1221 } else if (nr_pages < PAGE_SIZE) {
1222 ret = -EINVAL;
1223 goto out;
1224 } 1225 }
1225 ret = pipe_set_size(pipe, nr_pages); 1226 ret = pipe_set_size(pipe, nr_pages);
1226 break; 1227 break;