[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <d6a1398e719c864993213c899325c3a703eeeb77.1588313626.git.riteshh@linux.ibm.com>
Date: Fri, 1 May 2020 11:59:54 +0530
From: Ritesh Harjani <riteshh@...ux.ibm.com>
To: linux-ext4@...r.kernel.org
Cc: "Paul E . McKenney" <paulmck@...nel.org>,
linux-fsdevel@...r.kernel.org, Jan Kara <jack@...e.com>,
tytso@....edu, "Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
Ritesh Harjani <riteshh@...ux.ibm.com>
Subject: [RFC 12/20] ext4: mballoc: Fix possible NULL ptr dereference from mb_cmp_bitmaps()
Make sure to check for e4b->bd_info->bb_bitmap == NULL, in
mb_cmp_bitmaps() and return if NULL, to avoid possible NULL ptr
dereference. Similar to how we do this in other ifdef DOUBLE_CHECK
functions.
Signed-off-by: Ritesh Harjani <riteshh@...ux.ibm.com>
---
fs/ext4/mballoc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 5e59c18c89c0..e32f3675f962 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -522,6 +522,8 @@ static void mb_mark_used_double(struct ext4_buddy *e4b, int first, int count)
static void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap)
{
+ if (unlikely(e4b->bd_info->bb_bitmap == NULL))
+ return;
if (memcmp(e4b->bd_info->bb_bitmap, bitmap, e4b->bd_sb->s_blocksize)) {
unsigned char *b1, *b2;
int i;
--
2.21.0
Powered by blists - more mailing lists