[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210918083120.GM4323@worktop.programming.kicks-ass.net>
Date: Sat, 18 Sep 2021 10:31:20 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: cgel.zte@...il.com
Cc: dave.hansen@...ux.intel.com, luto@...nel.org, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, x86@...nel.org, hpa@...or.com,
jan.kiszka@...mens.com, jmoyer@...hat.com,
dan.j.williams@...el.com, neilb@...e.de, yang.guang5@....com.cn,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] Modify the check condition
On Sat, Sep 18, 2021 at 06:52:32AM +0000, cgel.zte@...il.com wrote:
> From: Yang Guang <yang.guang5@....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@....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;
Yet another braindead patch that shows you don't actually understand C.
Powered by blists - more mailing lists