Skip to content

Commit

Permalink
md/raid1: don't free conf on raid0_run failure
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/2083196

[ Upstream commit 17f91ac ]

The core md code calls the ->free method which already frees conf.

Fixes: 07f1a68 ("md/raid1: fail run raid1 array when active disk less than one")
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Song Liu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Portia Stephens <[email protected]>
Signed-off-by: Roxana Nicolescu <[email protected]>
  • Loading branch information
Christoph Hellwig authored and mehmetb0 committed Nov 9, 2024
1 parent 6d21558 commit 3adea29
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -3121,7 +3121,6 @@ static struct r1conf *setup_conf(struct mddev *mddev)
return ERR_PTR(err);
}

static void raid1_free(struct mddev *mddev, void *priv);
static int raid1_run(struct mddev *mddev)
{
struct r1conf *conf;
Expand Down Expand Up @@ -3174,8 +3173,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)
Expand All @@ -3199,14 +3197,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;
}

Expand Down

0 comments on commit 3adea29

Please sign in to comment.