mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: William Irwin <wli@holomorphy.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
cfce66047f
commit
5bc98594d5
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue