summaryrefslogtreecommitdiff
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2014-11-19 13:36:07 +0300
committerJames Morris <james.l.morris@oracle.com>2014-11-19 13:36:07 +0300
commita6aacbde406eeb6f8fc218b2c6172825f5e73fcf (patch)
treeb79e1a17c38090915085f0dbb501a0970cb79b28 /fs/read_write.c
parentb10778a00d40b3d9fdaaf5891e802794781ff71c (diff)
parent6fb5032ebb1c5b852461d64ee33829081de8ca61 (diff)
downloadlinux-a6aacbde406eeb6f8fc218b2c6172825f5e73fcf.tar.xz
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity into next
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 009d8542a889..f45b2ae5d5f1 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -412,6 +412,23 @@ ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *p
EXPORT_SYMBOL(new_sync_read);
+ssize_t __vfs_read(struct file *file, char __user *buf, size_t count,
+ loff_t *pos)
+{
+ ssize_t ret;
+
+ if (file->f_op->read)
+ ret = file->f_op->read(file, buf, count, pos);
+ else if (file->f_op->aio_read)
+ ret = do_sync_read(file, buf, count, pos);
+ else if (file->f_op->read_iter)
+ ret = new_sync_read(file, buf, count, pos);
+ else
+ ret = -EINVAL;
+
+ return ret;
+}
+
ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
{
ssize_t ret;
@@ -426,12 +443,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
ret = rw_verify_area(READ, file, pos, count);
if (ret >= 0) {
count = ret;
- if (file->f_op->read)
- ret = file->f_op->read(file, buf, count, pos);
- else if (file->f_op->aio_read)
- ret = do_sync_read(file, buf, count, pos);
- else
- ret = new_sync_read(file, buf, count, pos);
+ ret = __vfs_read(file, buf, count, pos);
if (ret > 0) {
fsnotify_access(file);
add_rchar(current, ret);