public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: William Lee Irwin III <wli@holomorphy.com>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: [PATCH] hugetlbfs: add NULL check in hugetlb_zero_setup()
Date: Sun, 29 Apr 2007 01:29:48 +0900	[thread overview]
Message-ID: <20070428162948.GA9717@APFDCB5C> (raw)
In-Reply-To: <20070428161856.GA9662@APFDCB5C>

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

Cc: William Irwin <wli@holomorphy.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

Index: 2.6-mm/fs/hugetlbfs/inode.c
===================================================================
--- 2.6-mm.orig/fs/hugetlbfs/inode.c
+++ 2.6-mm/fs/hugetlbfs/inode.c
@@ -740,6 +740,9 @@ struct file *hugetlb_zero_setup(size_t s
 	char buf[16];
 	static atomic_t counter;
 
+	if (!hugetlbfs_vfsmount)
+		return ERR_PTR(-ENOENT);
+
 	if (!can_do_hugetlb_shm())
 		return ERR_PTR(-EPERM);
 

  reply	other threads:[~2007-04-28 16:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-28  7:19 [PATCH] hugetlbfs: fix error path in module_init Akinobu Mita
2007-04-28  7:44 ` Alexey Dobriyan
2007-04-28 10:58   ` Akinobu Mita
2007-04-28 14:46   ` William Lee Irwin III
2007-04-28 14:50 ` William Lee Irwin III
2007-04-28 16:18   ` Akinobu Mita
2007-04-28 16:29     ` Akinobu Mita [this message]
2007-04-28 18:15       ` [PATCH] hugetlbfs: add NULL check in hugetlb_zero_setup() William Lee Irwin III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070428162948.GA9717@APFDCB5C \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox