summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-08 08:54:27 +0200
committerChristoph Hellwig <hch@lst.de>2020-07-08 08:27:57 +0200
commita1f9b1c0439db47ea10418b8ee7092a0d970cc2d (patch)
tree20da49ed545d1deacca51f8dca202821b0482da2 /security
parent61a707c543e2afe3aa7e88f87267c5dafa4b5afa (diff)
downloadlinux-stable-a1f9b1c0439db47ea10418b8ee7092a0d970cc2d.tar.gz
linux-stable-a1f9b1c0439db47ea10418b8ee7092a0d970cc2d.tar.bz2
linux-stable-a1f9b1c0439db47ea10418b8ee7092a0d970cc2d.zip
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 <hch@lst.de>
Diffstat (limited to 'security')
-rw-r--r--security/integrity/iint.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/security/integrity/iint.c b/security/integrity/iint.c
index e12c4900510f..1d20003243c3 100644
--- a/security/integrity/iint.c
+++ b/security/integrity/iint.c
@@ -188,19 +188,7 @@ DEFINE_LSM(integrity) = {
int integrity_kernel_read(struct file *file, loff_t offset,
void *addr, unsigned long count)
{
- mm_segment_t old_fs;
- char __user *buf = (char __user *)addr;
- ssize_t ret;
-
- if (!(file->f_mode & FMODE_READ))
- return -EBADF;
-
- old_fs = get_fs();
- set_fs(KERNEL_DS);
- ret = __vfs_read(file, buf, count, &offset);
- set_fs(old_fs);
-
- return ret;
+ return __kernel_read(file, addr, count, &offset);
}
/*