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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Shaohua Li <shli@fb.com>
This commit is contained in:
Shaohua Li 2016-09-13 10:28:00 -07:00
parent 1dffddddd8
commit f71f1cf97c
1 changed files with 1 additions and 3 deletions

View File

@ -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)