diff options
author | Shaohua Li <shli@fb.com> | 2016-09-13 10:28:00 -0700 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-09-21 09:09:44 -0700 |
commit | f71f1cf97c781db1be8ae0190e0983e1fceac14a (patch) | |
tree | 154a1cf49bf2697d6a311f42ec871b83c50267c8 /drivers/md/bitmap.c | |
parent | 1dffddddd8315863f1a6d79c512b737864ef6a1a (diff) |
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>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r-- | drivers/md/bitmap.c | 4 |
1 files changed, 1 insertions, 3 deletions
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) |