]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
md/raid1: don't free conf on raid0_run failure
authorChristoph Hellwig <hch@lst.de>
Tue, 4 Jun 2024 17:25:29 +0000 (19:25 +0200)
committerSong Liu <song@kernel.org>
Mon, 10 Jun 2024 19:18:55 +0000 (19:18 +0000)
The core md code calls the ->free method which already frees conf.

Fixes: 07f1a6850c5d ("md/raid1: fail run raid1 array when active disk less than one")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240604172607.3185916-3-hch@lst.de
drivers/md/raid1.c

index 0d80ff471c73dde3f168f35812b598fc77991257..3d54f30112a0e8fd82c66a6ba096470a939dfa83 100644 (file)
@@ -3203,7 +3203,6 @@ static int raid1_set_limits(struct mddev *mddev)
        return queue_limits_set(mddev->gendisk->queue, &lim);
 }
 
-static void raid1_free(struct mddev *mddev, void *priv);
 static int raid1_run(struct mddev *mddev)
 {
        struct r1conf *conf;
@@ -3237,7 +3236,7 @@ static int raid1_run(struct mddev *mddev)
        if (!mddev_is_dm(mddev)) {
                ret = raid1_set_limits(mddev);
                if (ret)
-                       goto abort;
+                       return ret;
        }
 
        mddev->degraded = 0;
@@ -3251,8 +3250,7 @@ static int raid1_run(struct mddev *mddev)
         */
        if (conf->raid_disks - mddev->degraded < 1) {
                md_unregister_thread(mddev, &conf->thread);
-               ret = -EINVAL;
-               goto abort;
+               return -EINVAL;
        }
 
        if (conf->raid_disks - mddev->degraded == 1)
@@ -3276,14 +3274,8 @@ static int raid1_run(struct mddev *mddev)
        md_set_array_sectors(mddev, raid1_size(mddev, 0, 0));
 
        ret = md_integrity_register(mddev);
-       if (ret) {
+       if (ret)
                md_unregister_thread(mddev, &mddev->thread);
-               goto abort;
-       }
-       return 0;
-
-abort:
-       raid1_free(mddev, conf);
        return ret;
 }