md/bitmap: ensure to load bitmap when creating via sysfs.
authorNeilBrown <neilb@suse.de>
Mon, 19 Mar 2012 01:46:37 +0000 (12:46 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 19 Mar 2012 01:46:37 +0000 (12:46 +1100)
When commit 69e51b449d383e (md/bitmap:  separate out loading a bitmap...)
created bitmap_load, it missed calling it after bitmap_create when a
bitmap is created through the sysfs interface.
So if a bitmap is added this way, we don't allocate memory properly
and can crash.

This is suitable for any -stable release since 2.6.35.
Cc: stable@vger.kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/bitmap.c

index cdf36b1e9aa6f28af6f2f1ed9042a02f3f41b8f0..239af9a9aad1d1ae4feb9e8e69f6f582007b087d 100644 (file)
@@ -1904,6 +1904,8 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
                        if (mddev->pers) {
                                mddev->pers->quiesce(mddev, 1);
                                rv = bitmap_create(mddev);
+                               if (!rv)
+                                       rv = bitmap_load(mddev);
                                if (rv) {
                                        bitmap_destroy(mddev);
                                        mddev->bitmap_info.offset = 0;