Re: [PATCH v4] Fixes: null pointer dereference in pfnmap_lockdep_assert
From: Peter Xu
Date: Mon Oct 07 2024 - 09:25:17 EST
On Fri, Oct 04, 2024 at 11:12:16PM +0530, Manas via B4 Relay wrote:
> From: Manas <manas18244@xxxxxxxxxxx>
>
> syzbot has pointed to a possible null pointer dereference in
> pfnmap_lockdep_assert. vm_file member of vm_area_struct is being
> dereferenced without any checks.
>
> This fix assigns mapping only if vm_file is not NULL.
>
> Reported-by: syzbot+093d096417e7038a689b@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzkaller.appspot.com/bug?extid=093d096417e7038a689b
> ---
> This bug[1] triggers a general protection fault in follow_pfnmap_start
> function. An assertion pfnmap_lockdep_assert inside this function
> dereferences vm_file member of vm_area_struct. And panic gets triggered
> when vm_file is NULL.
>
> This patch assigns mapping only if vm_file is not NULL.
>
> [1] https://syzkaller.appspot.com/bug?extid=093d096417e7038a689b
>
> Signed-off-by: Manas <manas18244@xxxxxxxxxxx>
Reviewed-by: Peter Xu <peterx@xxxxxxxxxx>
--
Peter Xu