Skip to content

Commit a1f9b1c

Browse files
author
Christoph Hellwig
committed
integrity/ima: switch to using __kernel_read
__kernel_read has a bunch of additional sanity checks, and this moves the set_fs out of non-core code. Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 61a707c commit a1f9b1c

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

security/integrity/iint.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,7 @@ DEFINE_LSM(integrity) = {
188188
int integrity_kernel_read(struct file *file, loff_t offset,
189189
void *addr, unsigned long count)
190190
{
191-
mm_segment_t old_fs;
192-
char __user *buf = (char __user *)addr;
193-
ssize_t ret;
194-
195-
if (!(file->f_mode & FMODE_READ))
196-
return -EBADF;
197-
198-
old_fs = get_fs();
199-
set_fs(KERNEL_DS);
200-
ret = __vfs_read(file, buf, count, &offset);
201-
set_fs(old_fs);
202-
203-
return ret;
191+
return __kernel_read(file, addr, count, &offset);
204192
}
205193

206194
/*

0 commit comments

Comments
 (0)