Skip to content

Commit

Permalink
vfs/splice: Fix missed checks in new __kernel_write() helper
Browse files Browse the repository at this point in the history
Commit 06ae43f ("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>
  • Loading branch information
Al Viro authored and Linus Torvalds committed Mar 27, 2013
1 parent de55eb1 commit 3e84f48
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3e84f48

Please sign in to comment.