aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKemeng Shi <shikemeng@huaweicloud.com>2025-01-24 00:20:48 +0800
committerTheodore Ts'o <tytso@mit.edu>2025-03-16 22:41:17 -0400
commiteb640af64db6d4702a85ab001b9cc7f4c5dd6abb (patch)
treed4ea0a921a9c00308d694ee98a8412efbfc99a3d
parentjbd2: Correct stale comment of release_buffer_page (diff)
downloadwireguard-linux-eb640af64db6d4702a85ab001b9cc7f4c5dd6abb.tar.xz
wireguard-linux-eb640af64db6d4702a85ab001b9cc7f4c5dd6abb.zip
ext4: add missing brelse() for bh2 in ext4_dx_add_entry()
Add missing brelse() for bh2 in ext4_dx_add_entry(). Fixes: ac27a0ec112a ("[PATCH] ext4: initial copy of files from ext3") Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Link: https://patch.msgid.link/20250123162050.2114499-2-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/namei.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 7ae24530a4ae..9e0aed0c7b93 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2583,8 +2583,10 @@ again:
BUFFER_TRACE(frame->bh, "get_write_access");
err = ext4_journal_get_write_access(handle, sb, frame->bh,
EXT4_JTR_NONE);
- if (err)
+ if (err) {
+ brelse(bh2);
goto journal_error;
+ }
if (!add_level) {
unsigned icount1 = icount/2, icount2 = icount - icount1;
unsigned hash2 = dx_get_hash(entries + icount1);
@@ -2595,8 +2597,10 @@ again:
err = ext4_journal_get_write_access(handle, sb,
(frame - 1)->bh,
EXT4_JTR_NONE);
- if (err)
+ if (err) {
+ brelse(bh2);
goto journal_error;
+ }
memcpy((char *) entries2, (char *) (entries + icount1),
icount2 * sizeof(struct dx_entry));
@@ -2615,8 +2619,10 @@ again:
dxtrace(dx_show_index("node",
((struct dx_node *) bh2->b_data)->entries));
err = ext4_handle_dirty_dx_node(handle, dir, bh2);
- if (err)
+ if (err) {
+ brelse(bh2);
goto journal_error;
+ }
brelse (bh2);
err = ext4_handle_dirty_dx_node(handle, dir,
(frame - 1)->bh);
@@ -2641,8 +2647,10 @@ again:
"Creating %d level index...\n",
dxroot->info.indirect_levels));
err = ext4_handle_dirty_dx_node(handle, dir, frame->bh);
- if (err)
+ if (err) {
+ brelse(bh2);
goto journal_error;
+ }
err = ext4_handle_dirty_dx_node(handle, dir, bh2);
brelse(bh2);
restart = 1;