Skip to content

Commit

Permalink
md-cluster: Fix potential error pointer dereference in resize_bitmaps()
Browse files Browse the repository at this point in the history
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: afd7562 ("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>
  • Loading branch information
Dan Carpenter authored and Song Liu committed Aug 6, 2020
1 parent e8efa9b commit e8abe1d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/md/md-cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e8abe1d

Please sign in to comment.