aboutsummaryrefslogtreecommitdiffstats
path: root/security/integrity
diff options
context:
space:
mode:
authorDmitry Kasatkin <d.kasatkin@samsung.com>2014-11-05 10:01:17 -0500
committerMimi Zohar <zohar@linux.vnet.ibm.com>2014-11-17 23:14:22 -0500
commit6fb5032ebb1c5b852461d64ee33829081de8ca61 (patch)
tree1645235b1ff4461a8f67ed8fec24e0c15c64c614 /security/integrity
parentc57782c13ecd7e7aca66cbf0139ad2a72317dc81 (diff)
VFS: refactor vfs_read()
integrity_kernel_read() duplicates the file read operations code in vfs_read(). This patch refactors vfs_read() code creating a helper function __vfs_read(). It is used by both vfs_read() and integrity_kernel_read(). Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity')
-rw-r--r--security/integrity/iint.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/security/integrity/iint.c b/security/integrity/iint.c
index df45640fbac6..dbb6d141c3db 100644
--- a/security/integrity/iint.c
+++ b/security/integrity/iint.c
@@ -184,20 +184,16 @@ int integrity_kernel_read(struct file *file, loff_t offset,
184{ 184{
185 mm_segment_t old_fs; 185 mm_segment_t old_fs;
186 char __user *buf = (char __user *)addr; 186 char __user *buf = (char __user *)addr;
187 ssize_t ret = -EINVAL; 187 ssize_t ret;
188 188
189 if (!(file->f_mode & FMODE_READ)) 189 if (!(file->f_mode & FMODE_READ))
190 return -EBADF; 190 return -EBADF;
191 191
192 old_fs = get_fs(); 192 old_fs = get_fs();
193 set_fs(get_ds()); 193 set_fs(get_ds());
194 if (file->f_op->read) 194 ret = __vfs_read(file, buf, count, &offset);
195 ret = file->f_op->read(file, buf, count, &offset);
196 else if (file->f_op->aio_read)
197 ret = do_sync_read(file, buf, count, &offset);
198 else if (file->f_op->read_iter)
199 ret = new_sync_read(file, buf, count, &offset);
200 set_fs(old_fs); 195 set_fs(old_fs);
196
201 return ret; 197 return ret;
202} 198}
203 199