[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230420071851.326726-1-d-tatianin@yandex-team.ru>
Date: Thu, 20 Apr 2023 10:18:51 +0300
From: Daniil Tatianin <d-tatianin@...dex-team.ru>
To: Song Liu <song@...nel.org>
Cc: Daniil Tatianin <d-tatianin@...dex-team.ru>,
linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] md/md-multipath: guard against a possible NULL dereference
mempool_alloc might fail to allocate a slot, in which case we will end
up dereferencing a NULL mp_bh pointer.
Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Daniil Tatianin <d-tatianin@...dex-team.ru>
---
drivers/md/md-multipath.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/md/md-multipath.c b/drivers/md/md-multipath.c
index 66edf5e72bd6..861c70e49bcc 100644
--- a/drivers/md/md-multipath.c
+++ b/drivers/md/md-multipath.c
@@ -108,6 +108,8 @@ static bool multipath_make_request(struct mddev *mddev, struct bio * bio)
return true;
mp_bh = mempool_alloc(&conf->pool, GFP_NOIO);
+ if (!map_bh)
+ return false;
mp_bh->master_bio = bio;
mp_bh->mddev = mddev;
--
2.25.1
Powered by blists - more mailing lists