Skip to contentSkip to conversation

JBD/JBD2: free j_wbuf if journal init fails.

PATCH In review Tao Ma 2 participants 2 messages Nov 10, 2009 Journalling layer for block devices (JBD2)

lore
Share & tools
lore

Tao Ma

author
#0 lore raw

PATCH 1/1 JBD/JBD2: free j_wbuf if journal init fails.

If journal init fails, we need to free j_wbuf.

Cc Andrew Morton <[email protected]>
Cc Jan Kara <[email protected]>
---
 fs/jbd/journal.c  |    2 ++
 fs/jbd2/journal.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
fs/jbd/journal.c +2 -0
index bd3c073..49d5cd6 100644
@@ -756,6 +756,7 @@ journal_t * journal_init_dev(struct block_device *bdev,
 
 	return journal;
 out_err:
+	kfree(journal->j_wbuf);
 	kfree(journal);
 	return NULL;
 }
@@ -820,6 +821,7 @@ journal_t * journal_init_inode (struct inode *inode)
 
 	return journal;
 out_err:
+	kfree(journal->j_wbuf);
 	kfree(journal);
 	return NULL;
 }
fs/jbd2/journal.c +2 -0
index b0ab521..fed8538 100644
@@ -913,6 +913,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev,
 
 	return journal;
 out_err:
+	kfree(journal->j_wbuf);
 	jbd2_stats_proc_exit(journal);
 	kfree(journal);
 	return NULL;
@@ -986,6 +987,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode)
 
 	return journal;
 out_err:
+	kfree(journal->j_wbuf);
 	jbd2_stats_proc_exit(journal);
 	kfree(journal);
 	return NULL;
Signature · 1 line
1.5.4.4
#1 lore raw
Quoted 1 line · Tao Ma

If journal init fails, we need to free j_wbuf.

Thanks, added to my tree.

Honza

Quoted 52 lines
Cc Andrew Morton <[email protected]>
Cc Jan Kara <[email protected]>
---
 fs/jbd/journal.c  |    2 ++
 fs/jbd2/journal.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
fs/jbd/journal.c +2 -0
index bd3c073..49d5cd6 100644
@@ -756,6 +756,7 @@ journal_t * journal_init_dev(struct block_device *bdev,
 
 	return journal;
 out_err:
+	kfree(journal->j_wbuf);
 	kfree(journal);
 	return NULL;
 }
@@ -820,6 +821,7 @@ journal_t * journal_init_inode (struct inode *inode)
 
 	return journal;
 out_err:
+	kfree(journal->j_wbuf);
 	kfree(journal);
 	return NULL;
 }
fs/jbd2/journal.c +2 -0
index b0ab521..fed8538 100644
@@ -913,6 +913,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev,
 
 	return journal;
 out_err:
+	kfree(journal->j_wbuf);
 	jbd2_stats_proc_exit(journal);
 	kfree(journal);
 	return NULL;
@@ -986,6 +987,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode)
 
 	return journal;
 out_err:
+	kfree(journal->j_wbuf);
 	jbd2_stats_proc_exit(journal);
 	kfree(journal);
 	return NULL;
Signature · 1 line
1.5.4.4
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR