|
@@ -80,19 +80,19 @@ static int ima_kernel_read(struct file *file, loff_t offset,
|
|
{
|
|
{
|
|
mm_segment_t old_fs;
|
|
mm_segment_t old_fs;
|
|
char __user *buf = addr;
|
|
char __user *buf = addr;
|
|
- ssize_t ret;
|
|
|
|
|
|
+ ssize_t ret = -EINVAL;
|
|
|
|
|
|
if (!(file->f_mode & FMODE_READ))
|
|
if (!(file->f_mode & FMODE_READ))
|
|
return -EBADF;
|
|
return -EBADF;
|
|
- if (!file->f_op->read && !file->f_op->aio_read)
|
|
|
|
- return -EINVAL;
|
|
|
|
|
|
|
|
old_fs = get_fs();
|
|
old_fs = get_fs();
|
|
set_fs(get_ds());
|
|
set_fs(get_ds());
|
|
if (file->f_op->read)
|
|
if (file->f_op->read)
|
|
ret = file->f_op->read(file, buf, count, &offset);
|
|
ret = file->f_op->read(file, buf, count, &offset);
|
|
- else
|
|
|
|
|
|
+ else if (file->f_op->aio_read)
|
|
ret = do_sync_read(file, buf, count, &offset);
|
|
ret = do_sync_read(file, buf, count, &offset);
|
|
|
|
+ else if (file->f_op->read_iter)
|
|
|
|
+ ret = new_sync_read(file, buf, count, &offset);
|
|
set_fs(old_fs);
|
|
set_fs(old_fs);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|