From: Shaohua Li Date: Tue, 13 Sep 2016 17:28:00 +0000 (-0700) Subject: md/bitmap: fix wrong cleanup X-Git-Tag: Ubuntu-5.10.0-12.13~11738^2~5 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f71f1cf97c781db1be8ae0190e0983e1fceac14a;p=mirror_ubuntu-hirsute-kernel.git 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 Signed-off-by: Shaohua Li --- diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 13041ee37ad6..2d826927a3bf 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -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)