ocfs2: fix NULL pointer dereference in function ocfs2_abort_trigger()
PATCH 1/1 ocfs2: fix NULL pointer dereference in function ocfs2_abort_trigger()
Function ocfs2_abort_trigger() use bh->b_assoc_map to get sb. But there's no function to set bh->b_assoc_map in ocfs2, it will trigger NULL pointer dereference while calling this function. We can get sb from bh->b_bdev->bd_super instead of b_assoc_map.
--- fs/ocfs2/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/journal.c +1 -1
@@ -573,7 +573,7 @@ static void ocfs2_abort_trigger(struct jbd2_buffer_trigger_type *triggers,/* We aren't guaranteed to have the superblock here - but if we * don't, it'll just crash. */ -ocfs2_error (bh->b_assoc_map->host->i_sb, +ocfs2_error (bh->b_bdev->bd_super,"JBD2 has aborted our journal, ocfs2 cannot continue\n" ); }
Signature · 1 line
1.8.4.3
PATCH 1/1 ocfs2: fix NULL pointer dereference in function ocfs2_abort_trigger()
Quoted 16 lines · Xue jiufei
Function
ocfs2_abort_trigger()usebh->b_assoc_mapto get sb. But there's no function to setbh->b_assoc_mapin ocfs2, it will trigger NULL pointer dereference while calling this function. We can get sb frombh->b_bdev->bd_superinstead ofb_assoc_map.Signed-off-by joyce.xue <[email protected]>--- fs/ocfs2/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ocfs2/journal.c +0
-0
fs/ocfs2/journal.c static void ocfs2_abort_trigger(struct jbd2_buffer_trigger_type *triggers, · line 575
Quoted 3 lines
fs/ocfs2/journal.c +0
-0@@ -573,7 +573,7 @@ static void ocfs2_abort_trigger(struct jbd2_buffer_trigger_type *triggers,/* We aren't guaranteed to have the superblock here - but if we * don't, it'll just crash. */
Should we delete this comments correspondingly?
Quoted 6 lines
fs/ocfs2/journal.c +1
-1-ocfs2_error (bh->b_assoc_map->host->i_sb, +ocfs2_error (bh->b_bdev->bd_super,"JBD2 has aborted our journal, ocfs2 cannot continue\n" ); }