public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>
Subject: [PATCH] panic() instead of crashing on a null pointer deref in mount_block_root()
Date: Sun, 14 May 2006 02:07:51 +0200	[thread overview]
Message-ID: <200605140207.52035.jesper.juhl@gmail.com> (raw)


If __getname() fails in mount_block_root() we are dead in the water, but
a panic() seems a little nicer than crashing due to a NULL pointer deref.


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

 init/do_mounts.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


--- linux-2.6.17-rc4-git2-orig/init/do_mounts.c	2006-05-13 21:28:53.000000000 +0200
+++ linux-2.6.17-rc4-git2/init/do_mounts.c	2006-05-14 02:05:52.000000000 +0200
@@ -286,6 +286,8 @@ void __init mount_block_root(char *name,
 	char *p;
 	char b[BDEVNAME_SIZE];
 
+	if (!fs_names)
+		panic("VFS: Failed memory allocation in mount_block_root()");
 	get_fs_names(fs_names);
 retry:
 	for (p = fs_names; *p; p += strlen(p)+1) {
@@ -425,4 +427,3 @@ out:
 	security_sb_post_mountroot();
 	mount_devfs_fs ();
 }
-





                 reply	other threads:[~2006-05-14  0:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200605140207.52035.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=akpm@osdl.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