From: William Lee Irwin III <wli@holomorphy.com>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] hugetlbfs: add NULL check in hugetlb_zero_setup()
Date: Sat, 28 Apr 2007 11:15:23 -0700 [thread overview]
Message-ID: <20070428181523.GX31925@holomorphy.com> (raw)
In-Reply-To: <20070428162948.GA9717@APFDCB5C>
On Sun, Apr 29, 2007 at 01:29:48AM +0900, Akinobu Mita wrote:
> 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);
Putting some thought into this, the failure to set up the vfsmount
for shm should be reported noisily, the failure to register the
filesystem should be noticed so as not to oops later in the init
function (I guess one could panic() if he wanted to), and the
attempt at kern_mount() should be conditional on SysV IPC.
I'll take this check, which should be made no matter what, and do
a patch for the init function along the lines described above if
you don't do it yourself first. I don't need the patch credits, so
feel free to grab the free patch line if you want it.
Acked-by: William Irwin <bill.irwin@oracle.com>
-- wli
prev parent reply other threads:[~2007-04-28 18:17 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 ` [PATCH] hugetlbfs: add NULL check in hugetlb_zero_setup() Akinobu Mita
2007-04-28 18:15 ` William Lee Irwin III [this message]
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=20070428181523.GX31925@holomorphy.com \
--to=wli@holomorphy.com \
--cc=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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