Skip to contentSkip to conversation

jbd2: add miss release buffer head in fc_do_one_pass()

PATCH Applied Ye Bin 3 participants 3 messages Sep 17, 2022 – Sep 30, 2022 Journalling layer for block devices (JBD2)

lore
Share & tools
lore

Ye Bin

author
#0 lore raw

PATCH 1/1 jbd2: add miss release buffer head in fc_do_one_pass()

In fc_do_one_pass() miss release buffer head after use which will lead to reference count leak.

---
 fs/jbd2/recovery.c | 1 +
 1 file changed, 1 insertion(+)
fs/jbd2/recovery.c +1 -0
index 1f878c315b03..8286a9ec122f 100644
@@ -261,6 +261,7 @@ static int fc_do_one_pass(journal_t *journal,
 		err = journal->j_fc_replay_callback(journal, bh, pass,
 					next_fc_block - journal->j_fc_first,
 					expected_commit_id);
+		brelse(bh);
 		next_fc_block++;
 		if (err < 0 || err == JBD2_FC_REPLAY_STOP)
 			break;
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Ye Bin

In fc_do_one_pass() miss release buffer head after use which will lead to reference count leak.

Indeed. Good catch! Feel free to add:

Honza

Quoted 19 lines
---
 fs/jbd2/recovery.c | 1 +
 1 file changed, 1 insertion(+)
fs/jbd2/recovery.c +1 -0
index 1f878c315b03..8286a9ec122f 100644
@@ -261,6 +261,7 @@ static int fc_do_one_pass(journal_t *journal,
 		err = journal->j_fc_replay_callback(journal, bh, pass,
 					next_fc_block - journal->j_fc_first,
 					expected_commit_id);
+		brelse(bh);
 		next_fc_block++;
 		if (err < 0 || err == JBD2_FC_REPLAY_STOP)
 			break;
Signature · 1 line
2.31.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#2 lore raw
In reply to Ye Bin
Quoted 4 lines · Ye Bin

In fc_do_one_pass() miss release buffer head after use which will lead to reference count leak.

Applied, thanks!

[1/1] jbd2: add miss release buffer head in fc_do_one_pass()

      commit: 0f04cd3834a988a9c725fd396e3f88fe334f9f29

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>