mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Randy.dunlap@oracle.com, wli@holomorphy.org,
	Eric Whitney <eric.whitney@hp.com>
Subject: Re: [PATCH] 2.6.22-rc6-mm1:  hugetlbfs handle empty options string
Date: Tue, 10 Jul 2007 14:09:32 -0700	[thread overview]
Message-ID: <20070710140932.85fd9935.randy.dunlap@oracle.com> (raw)
In-Reply-To: <1184097540.5727.36.camel@localhost>

On Tue, 10 Jul 2007 15:59:00 -0400 Lee Schermerhorn wrote:

> [PATCH] 2.6.22-rc6-mm1 - hugetlbfs handle empty options string
> 
> I was seeing a null pointer deref in fs/super.c:vfs_kern_mount().
> Some file system get_sb() handler was returning NULL mnt_sb with
> a non-negative return value.  I also noticed a "hugetlbfs: Bad
> mount option:" message in the log.
> 
> Turns out that hugetlbfs_parse_options() was not checking for an
> empty option string after call to strsep().  On failure,
> hugetlbfs_parse_options() returns 1.  hugetlbfs_fill_super() just
> passed this return code back up the call stack where
> vfs_kern_mount() missed the error and proceeded with a NULL mnt_sb.
> 
> Apparently introduced by patch:
> 	hugetlbfs-use-lib-parser-fix-docs.patch
> 
> The problem was exposed by this line in my fstab:
> 
> none        /huge       hugetlbfs   defaults    0 0
> 
> It can also be demonstrated by invoking mount of hugetlbfs
> directly with no options or a bogus option.
> 
> This patch:
> 
> 1) adds the check for empty option to hugetlbfs_parse_options(),
> 2) enhances the error message to bracket any unrecognized
>    option with quotes ,
> 3) modifies hugetlbfs_parse_options() to return -EINVAL on any
>    unrecognized option,
> 4) adds a BUG_ON() to vfs_kern_mount() to catch any get_sb()
>    handler that returns a NULL mnt->mnt_sb with a return value
>    >= 0.
> 
> Signed-off-by:  Lee Schermerhorn  <lee.schermerhorn@hp.com>
> 
>  fs/hugetlbfs/inode.c |    8 +++++---
>  fs/super.c           |    1 +
>  2 files changed, 6 insertions(+), 3 deletions(-)

Argh.  Thanks.

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

      reply	other threads:[~2007-07-10 21:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10 19:59 Lee Schermerhorn
2007-07-10 21:09 ` Randy Dunlap [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=20070710140932.85fd9935.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=Lee.Schermerhorn@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=eric.whitney@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wli@holomorphy.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

Powered by JetHome