On 03/10/25 9:28 pm, Kiryl Shutsemau wrote:
From: Kiryl Shutsemau kas@kernel.org
vm_mmap_pgoff() includes a fsnotify call that allows for pre-content hooks on mmap().
The fsnotify_mmap_perm() function takes, among other arguments, an offset in the file in the form of loff_t. However, vm_mmap_pgoff() has file offset in the form of pgoff. This offset needs to be converted before being passed to fsnotify_mmap_perm().
The conversion from pgoff to loff_t is incorrect. The pgoff value needs to be shifted left by PAGE_SHIFT to obtain loff_t, not right.
This issue was identified through code inspection.
Signed-off-by: Kiryl Shutsemau kas@kernel.org Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") Cc: stable@vger.kernel.org Cc: Josef Bacik josef@toxicpanda.com Cc: Amir Goldstein amir73il@gmail.com Cc: Jan Kara jack@suse.cz
Reviewed-by: Dev Jain dev.jain@arm.com