diff --git a/fs/pipe.c b/fs/pipe.c index 5ff02c4afe9f..8e0d9f26dfad 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -628,6 +628,9 @@ struct pipe_inode_info *alloc_pipe_info(void) if (pipe == NULL) goto out_free_uid; + if (pipe_bufs * PAGE_SIZE > pipe_max_size && !capable(CAP_SYS_RESOURCE)) + pipe_bufs = pipe_max_size >> PAGE_SHIFT; + user_bufs = account_pipe_buffers(user, 0, pipe_bufs); if (too_many_pipe_buffers_soft(user_bufs)) {