Skip to content

Commit e8abe1d

Browse files
Dan Carpenterliu-song-6
authored andcommitted
md-cluster: Fix potential error pointer dereference in resize_bitmaps()
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 <[email protected]> Reviewed-by: Guoqing Jiang <[email protected]> Signed-off-by: Song Liu <[email protected]>
1 parent e8efa9b commit e8abe1d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/md/md-cluster.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
11391139
bitmap = get_bitmap_from_slot(mddev, i);
11401140
if (IS_ERR(bitmap)) {
11411141
pr_err("can't get bitmap from slot %d\n", i);
1142+
bitmap = NULL;
11421143
goto out;
11431144
}
11441145
counts = &bitmap->counts;

0 commit comments

Comments
 (0)