lkml.org 
[lkml]   [2021]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Modify the check condition
Date
From: Yang Guang <yang.guang5@zte.com.cn>

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".

Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
arch/x86/mm/pat/memtype.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index 4ba2a3ee4bce..b7108b37b754 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -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 */
--
2.25.1
\
 
 \ /
  Last update: 2021-09-18 08:53    [W:0.046 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site