|
@@ -648,9 +648,11 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe,
|
|
ret = buf->ops->confirm(pipe, buf);
|
|
ret = buf->ops->confirm(pipe, buf);
|
|
if (!ret) {
|
|
if (!ret) {
|
|
more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len;
|
|
more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len;
|
|
-
|
|
|
|
- ret = file->f_op->sendpage(file, buf->page, buf->offset,
|
|
|
|
- sd->len, &pos, more);
|
|
|
|
|
|
+ if (file->f_op && file->f_op->sendpage)
|
|
|
|
+ ret = file->f_op->sendpage(file, buf->page, buf->offset,
|
|
|
|
+ sd->len, &pos, more);
|
|
|
|
+ else
|
|
|
|
+ ret = -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
@@ -1068,8 +1070,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
|
|
if (unlikely(ret < 0))
|
|
if (unlikely(ret < 0))
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
- splice_write = out->f_op->splice_write;
|
|
|
|
- if (!splice_write)
|
|
|
|
|
|
+ if (out->f_op && out->f_op->splice_write)
|
|
|
|
+ splice_write = out->f_op->splice_write;
|
|
|
|
+ else
|
|
splice_write = default_file_splice_write;
|
|
splice_write = default_file_splice_write;
|
|
|
|
|
|
return splice_write(pipe, out, ppos, len, flags);
|
|
return splice_write(pipe, out, ppos, len, flags);
|
|
@@ -1093,8 +1096,9 @@ static long do_splice_to(struct file *in, loff_t *ppos,
|
|
if (unlikely(ret < 0))
|
|
if (unlikely(ret < 0))
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
- splice_read = in->f_op->splice_read;
|
|
|
|
- if (!splice_read)
|
|
|
|
|
|
+ if (in->f_op && in->f_op->splice_read)
|
|
|
|
+ splice_read = in->f_op->splice_read;
|
|
|
|
+ else
|
|
splice_read = default_file_splice_read;
|
|
splice_read = default_file_splice_read;
|
|
|
|
|
|
return splice_read(in, ppos, pipe, len, flags);
|
|
return splice_read(in, ppos, pipe, len, flags);
|
|
@@ -1316,7 +1320,8 @@ static long do_splice(struct file *in, loff_t __user *off_in,
|
|
if (off_in)
|
|
if (off_in)
|
|
return -ESPIPE;
|
|
return -ESPIPE;
|
|
if (off_out) {
|
|
if (off_out) {
|
|
- if (out->f_op->llseek == no_llseek)
|
|
|
|
|
|
+ if (!out->f_op || !out->f_op->llseek ||
|
|
|
|
+ out->f_op->llseek == no_llseek)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
if (copy_from_user(&offset, off_out, sizeof(loff_t)))
|
|
if (copy_from_user(&offset, off_out, sizeof(loff_t)))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
@@ -1336,7 +1341,8 @@ static long do_splice(struct file *in, loff_t __user *off_in,
|
|
if (off_out)
|
|
if (off_out)
|
|
return -ESPIPE;
|
|
return -ESPIPE;
|
|
if (off_in) {
|
|
if (off_in) {
|
|
- if (in->f_op->llseek == no_llseek)
|
|
|
|
|
|
+ if (!in->f_op || !in->f_op->llseek ||
|
|
|
|
+ in->f_op->llseek == no_llseek)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
if (copy_from_user(&offset, off_in, sizeof(loff_t)))
|
|
if (copy_from_user(&offset, off_in, sizeof(loff_t)))
|
|
return -EFAULT;
|
|
return -EFAULT;
|