Commit 19c9a49b432f245c6293508d164a4350f1f2c601
Committed by
Jens Axboe
1 parent
2cb4b05e76
Exists in
master
and in
4 other branches
splice: check f_mode for seekable file
check f_mode for seekable file As a seekable file is allowed without a llseek function, so the old way isn't work any more. Signed-off-by: Changli Gao <xiaosuo@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> ---- fs/splice.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Showing 1 changed file with 2 additions and 4 deletions Side-by-side Diff
fs/splice.c
... | ... | @@ -1372,8 +1372,7 @@ |
1372 | 1372 | if (off_in) |
1373 | 1373 | return -ESPIPE; |
1374 | 1374 | if (off_out) { |
1375 | - if (!out->f_op || !out->f_op->llseek || | |
1376 | - out->f_op->llseek == no_llseek) | |
1375 | + if (!(out->f_mode & FMODE_PWRITE)) | |
1377 | 1376 | return -EINVAL; |
1378 | 1377 | if (copy_from_user(&offset, off_out, sizeof(loff_t))) |
1379 | 1378 | return -EFAULT; |
... | ... | @@ -1393,8 +1392,7 @@ |
1393 | 1392 | if (off_out) |
1394 | 1393 | return -ESPIPE; |
1395 | 1394 | if (off_in) { |
1396 | - if (!in->f_op || !in->f_op->llseek || | |
1397 | - in->f_op->llseek == no_llseek) | |
1395 | + if (!(in->f_mode & FMODE_PREAD)) | |
1398 | 1396 | return -EINVAL; |
1399 | 1397 | if (copy_from_user(&offset, off_in, sizeof(loff_t))) |
1400 | 1398 | return -EFAULT; |