All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: Namjae Jeon <linkinjeon@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH v2] ext4: fix NULL pointer dereference from orig_data in fill_super and remount.
Date: Mon, 7 Nov 2011 10:19:39 -0500	[thread overview]
Message-ID: <20111107151939.GA24234@thunk.org> (raw)
In-Reply-To: <1320674511-1980-1-git-send-email-linkinjeon@gmail.com>

On Mon, Nov 07, 2011 at 11:01:51PM +0900, Namjae Jeon wrote:
> Fix NULL pointer dereference from orig_data in fill_super and remount.
> 
> Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>

Um, did you even try to test this patch before submitting it?

#1:   kstrdup() return NULL if data is NULL

#2:  The kernel's printk and sprintf functions will translate
     sprintf(buf, "%s", NULL) by filling in the string "NULL"

#3:  The only use of orig_data is a cosmetic one, of printing out
     the mount options which are passed in.

#4:  If the user doesn't specify any mount options, data is NULL, and
     your patch would cause those mounts to fail with ENOMEM.

In summary, there is no problem here; a pendant might complain that
it's possible for data to be non-NULL, and for orig_data to be null of
the kstrdup failed, but in that case, other memory allocations done
later in ext4_fill_super() will almost have certainly failed, so in
practice won't get as far as the printk.

					- Ted

  parent reply	other threads:[~2011-11-07 15:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 14:01 [PATCH v2] ext4: fix NULL pointer dereference from orig_data in fill_super and remount Namjae Jeon
2011-11-07 15:03 ` Srivatsa S. Bhat
2011-11-07 15:19 ` Ted Ts'o [this message]
2011-11-07 23:06   ` NamJae Jeon
2011-11-07 23:06     ` NamJae Jeon
2011-11-07 23:33     ` Theodore Tso
2011-11-07 23:42       ` NamJae Jeon
2011-11-07 23:42         ` NamJae Jeon

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=20111107151939.GA24234@thunk.org \
    --to=tytso@mit.edu \
    --cc=linkinjeon@gmail.com \
    --cc=linux-ext4@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.