diff options
author | Shaohua Li <shli@fb.com> | 2016-09-13 19:28:00 +0200 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-09-21 18:09:44 +0200 |
commit | f71f1cf97c781db1be8ae0190e0983e1fceac14a (patch) | |
tree | 154a1cf49bf2697d6a311f42ec871b83c50267c8 /drivers/md | |
parent | raid5: allow arbitrary max_hw_sectors (diff) | |
download | linux-f71f1cf97c781db1be8ae0190e0983e1fceac14a.tar.xz linux-f71f1cf97c781db1be8ae0190e0983e1fceac14a.zip |
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')
-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) |