summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-08-04 13:16:45 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-21 13:15:15 +0200
commit0b702cd4141800dfa3e75caa1ca9a79ce752453e (patch)
tree29a2901356813bb10c3ab3b28d8dcb0b269c307e
parentf4c223e3941bd0737fe019e1db85b5f298ac1163 (diff)
downloadlinux-stable-0b702cd4141800dfa3e75caa1ca9a79ce752453e.tar.gz
linux-stable-0b702cd4141800dfa3e75caa1ca9a79ce752453e.tar.bz2
linux-stable-0b702cd4141800dfa3e75caa1ca9a79ce752453e.zip
md-cluster: Fix potential error pointer dereference in resize_bitmaps()
[ Upstream commit e8abe1de43dac658dacbd04a4543e0c988a8d386 ] The error handling calls md_bitmap_free(bitmap) which checks for NULL but will Oops if we pass an error pointer. Let's set "bitmap" to NULL on this error path. Fixes: afd756286083 ("md-cluster/raid10: resize all the bitmaps before start reshape") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/md/md-cluster.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 73fd50e77975..d50737ec4039 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -1139,6 +1139,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
bitmap = get_bitmap_from_slot(mddev, i);
if (IS_ERR(bitmap)) {
pr_err("can't get bitmap from slot %d\n", i);
+ bitmap = NULL;
goto out;
}
counts = &bitmap->counts;