]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix reiserfs oom crash
authorAndrew Morton <akpm@osdl.org>
Sat, 15 May 2004 03:22:51 +0000 (20:22 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 15 May 2004 03:22:51 +0000 (20:22 -0700)
From: Oleg Drokin <green@linuxhacker.ru>

Thanks to Standford guys, a case where reiserfs can dereference NULL
pointer if memory allocation fail during mount was identified.

fs/reiserfs/journal.c

index e1f1f3bf153acbd077fa86c685ade779c305807e..52e637f8b1429a44e34833e224d3c53c23a15e9a 100644 (file)
@@ -2260,8 +2260,10 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo
     INIT_LIST_HEAD (&SB_JOURNAL(p_s_sb)->j_prealloc_list);
     INIT_LIST_HEAD(&SB_JOURNAL(p_s_sb)->j_working_list);
     INIT_LIST_HEAD(&SB_JOURNAL(p_s_sb)->j_journal_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 */