[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190725013944.20661-1-navid.emamdoost@gmail.com>
Date: Wed, 24 Jul 2019 20:39:44 -0500
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: emamd001@....edu
Cc: kjlu@....edu, smccaman@....edu,
Navid Emamdoost <navid.emamdoost@...il.com>,
Mike Kravetz <mike.kravetz@...cle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] mm/hugetlb.c: check the failure case for find_vma
find_vma may fail and return NULL. The null check is added.
Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
---
mm/hugetlb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ede7e7f5d1ab..9c5e8b7a6476 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4743,6 +4743,9 @@ void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
{
struct vm_area_struct *vma = find_vma(mm, addr);
+ if (!vma)
+ return (pte_t *)pmd_alloc(mm, pud, addr);
+
struct address_space *mapping = vma->vm_file->f_mapping;
pgoff_t idx = ((addr - vma->vm_start) >> PAGE_SHIFT) +
vma->vm_pgoff;
--
2.17.1
Powered by blists - more mailing lists