提交 a1f9b1c0 编写于 作者: C Christoph Hellwig

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: NChristoph Hellwig <hch@lst.de>
上级 61a707c5
...@@ -188,19 +188,7 @@ DEFINE_LSM(integrity) = { ...@@ -188,19 +188,7 @@ DEFINE_LSM(integrity) = {
int integrity_kernel_read(struct file *file, loff_t offset, int integrity_kernel_read(struct file *file, loff_t offset,
void *addr, unsigned long count) void *addr, unsigned long count)
{ {
mm_segment_t old_fs; return __kernel_read(file, addr, count, &offset);
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;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册