[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20151103192231.GB2213@birch.djwong.org>
Date: Tue, 3 Nov 2015 11:22:31 -0800
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: "Theodore Ts'o" <tytso@....edu>
Cc: linux-ext4 <linux-ext4@...r.kernel.org>,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH] ext4: don't brelse error pointers
When we fail to read the block bitmap, we're returned an error
pointer. It is incorrect to pass this to brelse, so save the error
code and set the pointer to NULL before jumping out of the function.
This avoids brelse()ing a nonpointer.
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
fs/ext4/mballoc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 19b8104..f185c97 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2906,6 +2906,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
bitmap_bh = ext4_read_block_bitmap(sb, ac->ac_b_ex.fe_group);
if (IS_ERR(bitmap_bh)) {
err = PTR_ERR(bitmap_bh);
+ bitmap_bh = NULL;
goto out_err;
}
@@ -4774,6 +4775,7 @@ do_more:
bitmap_bh = ext4_read_block_bitmap(sb, block_group);
if (IS_ERR(bitmap_bh)) {
err = PTR_ERR(bitmap_bh);
+ bitmap_bh = NULL;
goto error_return;
}
gdp = ext4_get_group_desc(sb, block_group, &gd_bh);
@@ -4944,6 +4946,7 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
bitmap_bh = ext4_read_block_bitmap(sb, block_group);
if (IS_ERR(bitmap_bh)) {
err = PTR_ERR(bitmap_bh);
+ bitmap_bh = NULL;
goto error_return;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists