aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2020-10-02 10:38:25 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-05 13:37:04 +0200
commit0fa8e084648779eeb8929ae004301b3acf3bad84 (patch)
treeebfed647c8f2a43a0967ba127c7e75df36909cba /kernel/module.c
parent34736daeecd1608bee21e3bf5170cd4c95143109 (diff)
downloadlinux-0fa8e084648779eeb8929ae004301b3acf3bad84.tar.gz
fs/kernel_file_read: Add "offset" arg for partial reads
To perform partial reads, callers of kernel_read_file*() must have a non-NULL file_size argument and a preallocated buffer. The new "offset" argument can then be used to seek to specific locations in the file to fill the buffer to, at most, "buf_size" per call. Where possible, the LSM hooks can report whether a full file has been read or not so that the contents can be reasoned about. Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20201002173828.2099543-14-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c
index adfa21dd3842ab..9c578e44abe79e 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -4054,7 +4054,7 @@ SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
|MODULE_INIT_IGNORE_VERMAGIC))
return -EINVAL;
- err = kernel_read_file_from_fd(fd, &hdr, INT_MAX, NULL,
+ err = kernel_read_file_from_fd(fd, 0, &hdr, INT_MAX, NULL,
READING_MODULE);
if (err < 0)
return err;