Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vfs: check fd has read access in kernel_read_file_from_fd()
ANBZ: torvalds#208 commit 032146c upstream. If we open a file without read access and then pass the fd to a syscall whose implementation calls kernel_read_file_from_fd(), we get a warning from __kernel_read(): if (WARN_ON_ONCE(!(file->f_mode & FMODE_READ))) This currently affects both finit_module() and kexec_file_load(), but it could affect other syscalls in the future. Link: https://lkml.kernel.org/r/[email protected] Fixes: b844f0e ("vfs: define kernel_copy_file_from_fd()") Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reported-by: Hao Sun <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Christian Brauner <[email protected]> Cc: Al Viro <[email protected]> Cc: Mimi Zohar <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: hongnanli <[email protected]> Reviewed-by: Joseph Qi <[email protected]>
- Loading branch information