Skip to content

Commit 3e84f48

Browse files
Al Virotorvalds
authored andcommitted
vfs/splice: Fix missed checks in new __kernel_write() helper
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 <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent de55eb1 commit 3e84f48

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/read_write.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t
424424
const char __user *p;
425425
ssize_t ret;
426426

427+
if (!file->f_op || (!file->f_op->write && !file->f_op->aio_write))
428+
return -EINVAL;
429+
427430
old_fs = get_fs();
428431
set_fs(get_ds());
429432
p = (__force const char __user *)buf;

0 commit comments

Comments
 (0)