Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5bc98594 authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds
Browse files

hugetlbfs: add NULL check in hugetlb_zero_setup()



If hugetlbfs module_init() fails, hugetlbfs_vfsmount is not initialized and
shmget() with SHM_HUGETLB flag will cause NULL pointer dereference.

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Acked-by: default avatarWilliam Irwin <wli@holomorphy.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cfce6604
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -747,6 +747,9 @@ struct file *hugetlb_zero_setup(size_t size)
	char buf[16];
	static atomic_t counter;

	if (!hugetlbfs_vfsmount)
		return ERR_PTR(-ENOENT);

	if (!can_do_hugetlb_shm())
		return ERR_PTR(-EPERM);