linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [2.4] Make reiserfs not to crash on oom during mount
@ 2004-05-12 16:53 Oleg Drokin
  0 siblings, 0 replies; only message in thread
From: Oleg Drokin @ 2004-05-12 16:53 UTC (permalink / raw)
  To: marcelo.tosatti, linux-kernel, mason, reiserfs-dev

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 */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-05-12 16:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-12 16:53 [PATCH] [2.4] Make reiserfs not to crash on oom during mount Oleg Drokin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).