diff options
author | Changli Gao <xiaosuo@gmail.com> | 2009-11-04 09:09:52 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-02 09:46:40 -0500 |
commit | 2d7b204f69587095283baf90779aeecc59ff6fff (patch) | |
tree | ecf0c69449aa2fb23bd1c8cc6bf0b51542075353 /fs/read_write.c | |
parent | 890650798af784a1d7944a762b787784077ed14f (diff) |
sendfile(): check f_op.splice_write() rather than f_op.sendpage()
commit cc56f7de7f00d188c7c4da1e9861581853b9e92f upstream.
sendfile(2) was reworked with the splice infrastructure, but it still
checks f_op.sendpage() instead of f_op.splice_write() wrongly. Although
if f_op.sendpage() exists, f_op.splice_write() always exists at the same
time currently, the assumption will be broken in future silently. This
patch also brings a side effect: sendfile(2) can work with any output
file. Some security checks related to f_op are added too.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Cc: Przemyslaw Pawelczyk <przemyslaw@pawelczyk.it>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 3ac28987f22..b7f4a1f94d4 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -826,8 +826,6 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, if (!(out_file->f_mode & FMODE_WRITE)) goto fput_out; retval = -EINVAL; - if (!out_file->f_op || !out_file->f_op->sendpage) - goto fput_out; in_inode = in_file->f_path.dentry->d_inode; out_inode = out_file->f_path.dentry->d_inode; retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count); |