Commit f71f1cf9 authored by Shaohua Li's avatar Shaohua Li

md/bitmap: fix wrong cleanup

if bitmap_create fails, the bitmap is already cleaned up and the returned value
is an error number. We can't do the cleanup again.
Reported-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 1dffdddd
......@@ -1903,10 +1903,8 @@ int bitmap_copy_from_slot(struct mddev *mddev, int slot,
struct bitmap_counts *counts;
struct bitmap *bitmap = bitmap_create(mddev, slot);
if (IS_ERR(bitmap)) {
bitmap_free(bitmap);
if (IS_ERR(bitmap))
return PTR_ERR(bitmap);
}
rv = bitmap_init_from_disk(bitmap, 0);
if (rv)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment