[PATCH] [2.6] Make reiserfs not to crash on oom

From: Oleg Drokin
Date: Wed May 12 2004 - 11:55:48 EST


Hello!

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

Here's 2.6 version of patch.

Bye,
Oleg

===== fs/reiserfs/journal.c 1.91 vs edited =====
--- 1.91/fs/reiserfs/journal.c Mon May 10 14:25:42 2004
+++ edited/fs/reiserfs/journal.c Wed May 12 19:28:18 2004
@@ -2260,8 +2260,10 @@
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 */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/