aboutsummaryrefslogtreecommitdiffstats
path: root/security/integrity
diff options
context:
space:
mode:
authorDmitry Kasatkin <d.kasatkin@samsung.com>2014-06-23 13:32:56 -0400
committerMimi Zohar <zohar@linux.vnet.ibm.com>2014-09-02 17:03:36 -0400
commit27cd1fc3ae5374a4a86662c67033f15ef27b2461 (patch)
tree4b076267fc56dae543500db4532163eb53c9bf19 /security/integrity
parent23c19e2ca736722a9523b64b07cda7efab7b6c57 (diff)
ima: fix fallback to use new_sync_read()
3.16 commit aad4f8bb42af06371aa0e85bf0cd9d52c0494985 'switch simple generic_file_aio_read() users to ->read_iter()' replaced ->aio_read with ->read_iter in most of the file systems and introduced new_sync_read() as a replacement for do_sync_read(). Most of file systems set '->read' and ima_kernel_read is not affected. When ->read is not set, this patch adopts fallback call changes from the vfs_read. Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Cc: <stable@vger.kernel.org> 3.16+
Diffstat (limited to 'security/integrity')
-rw-r--r--security/integrity/ima/ima_crypto.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
index 1178b307d562..3b26472fbf0a 100644
--- a/security/integrity/ima/ima_crypto.c
+++ b/security/integrity/ima/ima_crypto.c
@@ -80,19 +80,19 @@ static int ima_kernel_read(struct file *file, loff_t offset,
80{ 80{
81 mm_segment_t old_fs; 81 mm_segment_t old_fs;
82 char __user *buf = addr; 82 char __user *buf = addr;
83 ssize_t ret; 83 ssize_t ret = -EINVAL;
84 84
85 if (!(file->f_mode & FMODE_READ)) 85 if (!(file->f_mode & FMODE_READ))
86 return -EBADF; 86 return -EBADF;
87 if (!file->f_op->read && !file->f_op->aio_read)
88 return -EINVAL;
89 87
90 old_fs = get_fs(); 88 old_fs = get_fs();
91 set_fs(get_ds()); 89 set_fs(get_ds());
92 if (file->f_op->read) 90 if (file->f_op->read)
93 ret = file->f_op->read(file, buf, count, &offset); 91 ret = file->f_op->read(file, buf, count, &offset);
94 else 92 else if (file->f_op->aio_read)
95 ret = do_sync_read(file, buf, count, &offset); 93 ret = do_sync_read(file, buf, count, &offset);
94 else if (file->f_op->read_iter)
95 ret = new_sync_read(file, buf, count, &offset);
96 set_fs(old_fs); 96 set_fs(old_fs);
97 return ret; 97 return ret;
98} 98}