summaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorAl Viro <viro@ZenIV.linux.org.uk>2013-03-27 15:20:30 +0000
committerLinus Torvalds <torvalds@linux-foundation.org>2013-03-27 09:24:02 -0700
commit3e84f48edfd33b2e209a117c11fb9ce637cc9b67 (patch)
tree20fc0018f33a0d23140d9d549d0ffad3dac9a182 /fs/read_write.c
parentde55eb1d60d2ed0f1ba5e13226d91b3bfbe1c108 (diff)
vfs/splice: Fix missed checks in new __kernel_write() helper
Commit 06ae43f34bcc ("Don't bother with redoing rw_verify_area() from default_file_splice_from()") lost the checks to test existence of the write/aio_write methods. My apologies ;-/ Eventually, we want that in fs/splice.c side of things (no point repeating it for every buffer, after all), but for now this is the obvious minimal fix. Reported-by: Dave Jones <davej@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index f7b5a23b804..e6ddc8dceb9 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -424,6 +424,9 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t
const char __user *p;
ssize_t ret;
+ if (!file->f_op || (!file->f_op->write && !file->f_op->aio_write))
+ return -EINVAL;
+
old_fs = get_fs();
set_fs(get_ds());
p = (__force const char __user *)buf;