Re: [PATCH] mm: Fix potential NULL pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 24, 2013 at 11:48:19AM +0800, Libin wrote:
>find_vma may return NULL, thus check the return
>value to avoid NULL pointer dereference.
>

Reviewed-by: Wanpeng Li <liwanp@xxxxxxxxxxxxxxxxxx>

>Signed-off-by: Libin <huawei.libin@xxxxxxxxxx>
>---
> mm/huge_memory.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>index 243e710..d4423f4 100644
>--- a/mm/huge_memory.c
>+++ b/mm/huge_memory.c
>@@ -2294,6 +2294,8 @@ static void collapse_huge_page(struct mm_struct *mm,
> 		goto out;
>
> 	vma = find_vma(mm, address);
>+	if (!vma)
>+		goto out;
> 	hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
> 	hend = vma->vm_end & HPAGE_PMD_MASK;
> 	if (address < hstart || address + HPAGE_PMD_SIZE > hend)
>-- 
>1.8.2.1
>
>
>--
>To unsubscribe, send a message with 'unsubscribe linux-mm' in
>the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
>see: http://www.linux-mm.org/ .
>Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]