summaryrefslogtreecommitdiffstats
path: root/fs/hugetlbfs/inode.c
diff options
context:
space:
mode:
authorAkinobu Mita2007-05-06 23:50:18 +0200
committerLinus Torvalds2007-05-07 21:12:57 +0200
commit5bc98594d59672303c4c9c07262ecc373dc374da (patch)
treebc9855b1448222819d75fb23e26fdcd09382e460 /fs/hugetlbfs/inode.c
parentSlab allocators: remove useless __GFP_NO_GROW flag (diff)
downloadkernel-qcow2-linux-5bc98594d59672303c4c9c07262ecc373dc374da.tar.gz
kernel-qcow2-linux-5bc98594d59672303c4c9c07262ecc373dc374da.tar.xz
kernel-qcow2-linux-5bc98594d59672303c4c9c07262ecc373dc374da.zip
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>
Diffstat (limited to 'fs/hugetlbfs/inode.c')
-rw-r--r--fs/hugetlbfs/inode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 842a4ed4052d..98959b87cdf8 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -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);