Modify the check condition
PATCH 1/1 Modify the check condition
From: Yang Guang <[email protected]>
The vma may be NULL, and accessing the member of vma like "vma->vm_start" in calling follow_phys may occur segmentation fault.
So it should check vma at beginning. If vma is null, it will return. And the if condition won't execute "vm->vm_flags".
--- arch/x86/mm/pat/memtype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/pat/memtype.c +1 -1
@@ -1089,7 +1089,7 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,resource_size_t paddr;unsigned long prot; -if (vma && !(vma->vm_flags &VM_PAT )) +if (!(vma) || !(vma->vm_flags &VM_PAT ))return ;/* free the chunk starting from pfn or the whole chunk */
Signature · 1 line
2.25.1
Peter Zijlstra
maintainerQuoted 17 lines · On Sat, Sep 18, 2021 at 06:52:32AM +0000, [email protected] wrote:
From: Yang Guang <[email protected]>
The vma may be NULL, and accessing the member of vma like "
vma->vm_start" in callingfollow_physmay occur segmentation fault.
So it should check vma at beginning. If vma is null, it will return. And the if condition won't execute "vm->vm_flags".Signed-off-by Yang Guang <[email protected]>--- arch/x86/mm/pat/memtype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/mm/pat/memtype.c +0
-0
arch/x86/mm/pat/memtype.c void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, · line 1093
Quoted 6 lines
arch/x86/mm/pat/memtype.c +1
-1@@ -1089,7 +1089,7 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,resource_size_t paddr;unsigned long prot; -if (vma && !(vma->vm_flags &VM_PAT )) +if (!(vma) || !(vma->vm_flags &VM_PAT ))return ;
Yet another braindead patch that shows you don't actually understand C.