Libin 85a39b7702 mm/huge_memory.c: fix potential NULL pointer dereference
commit a8f531ebc33052642b4bd7b812eedf397108ce64 upstream.

In collapse_huge_page() there is a race window between releasing the
mmap_sem read lock and taking the mmap_sem write lock, so find_vma() may
return NULL.  So check the return value to avoid NULL pointer dereference.

collapse_huge_page
	khugepaged_alloc_page
		up_read(&mm->mmap_sem)
	down_write(&mm->mmap_sem)
	vma = find_vma(mm, address)

Signed-off-by: Libin <huawei.libin@huawei.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 16:52:48 -07:00
..
2009-04-01 08:59:13 -07:00
2011-05-26 09:20:31 -07:00
2011-03-31 11:26:23 -03:00
2011-11-11 09:36:29 -08:00
2009-09-22 07:17:35 -07:00
2011-05-26 09:20:31 -07:00
2010-03-24 16:31:21 -07:00
2011-05-25 08:39:18 -07:00
2010-05-21 18:31:21 -04:00
2013-08-20 08:21:01 -07:00
2011-03-10 08:52:27 +01:00
2011-05-20 12:50:29 -07:00
2012-02-13 11:06:11 -08:00
2011-05-25 08:39:05 -07:00
2012-08-01 12:26:54 -07:00