do_splice_to(): cap the size before passing to ->splice_read()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 2 Apr 2016 18:56:58 +0000 (14:56 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 3 Apr 2016 23:52:59 +0000 (19:52 -0400)
pipe capacity won't exceed 2G anyway.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/splice.c

index 9947b5c696649a20cf4064883efc89ae26a81b78..a6b87b7e0745534048549d5b6c65666ffd961a02 100644 (file)
@@ -1143,6 +1143,9 @@ static long do_splice_to(struct file *in, loff_t *ppos,
        if (unlikely(ret < 0))
                return ret;
 
+       if (unlikely(len > MAX_RW_COUNT))
+               len = MAX_RW_COUNT;
+
        if (in->f_op->splice_read)
                splice_read = in->f_op->splice_read;
        else