All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: marcelo.tosatti@cyclades.com, linux-kernel@vger.kernel.org,
	mason@suse.com, reiserfs-dev@namesys.com
Subject: [PATCH] [2.4] Make reiserfs not to crash on oom during mount
Date: Wed, 12 May 2004 19:53:27 +0300	[thread overview]
Message-ID: <20040512165327.GA73000@linuxhacker.ru> (raw)

Hello!

   Thanks to Stanford guys, a case where reiserfs would try to dereference
   NULL pointer if memory allocation fail during mount process was
   identified.

   The patch is below.

Bye,
    Oleg

===== fs/reiserfs/journal.c 1.31 vs edited =====
--- 1.31/fs/reiserfs/journal.c	Tue Jun 24 10:30:22 2003
+++ edited/fs/reiserfs/journal.c	Wed May 12 19:40:48 2004
@@ -198,6 +198,9 @@
 static void cleanup_bitmap_list(struct super_block *p_s_sb,
                                 struct reiserfs_list_bitmap *jb) {
   int i;
+  if (jb->bitmaps == NULL)
+	return ;
+
   for (i = 0 ; i < SB_BMAP_NR(p_s_sb) ; i++) {
     if (jb->bitmaps[i]) {
       free_bitmap_node(p_s_sb, jb->bitmaps[i]) ;
@@ -2064,8 +2067,11 @@
     INIT_LIST_HEAD(&SB_JOURNAL(p_s_sb)->j_bitmap_nodes) ;
     INIT_LIST_HEAD (&SB_JOURNAL(p_s_sb)->j_prealloc_list);
 
-    reiserfs_allocate_list_bitmaps(p_s_sb, SB_JOURNAL(p_s_sb)->j_list_bitmap, 
-				   SB_BMAP_NR(p_s_sb)) ;
+    if (reiserfs_allocate_list_bitmaps(p_s_sb,
+				       SB_JOURNAL(p_s_sb)->j_list_bitmap, 
+				       SB_BMAP_NR(p_s_sb)))
+	goto free_and_return ;
+
     allocate_bitmap_nodes(p_s_sb) ;
 
     /* reserved for journal area support */

                 reply	other threads:[~2004-05-12 16:53 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=20040512165327.GA73000@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=mason@suse.com \
    --cc=reiserfs-dev@namesys.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 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.