Skip to content

Commit 2eaeac5

Browse files
committed
md/raid1: don't free conf on raid0_run failure
JIRA: https://issues.redhat.com/browse/RHEL-83988 commit 799af94 Author: Christoph Hellwig <[email protected]> Date: Thu Jun 13 10:48:13 2024 +0200 md/raid1: don't free conf on raid0_run failure 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]> Reviewed-by: Martin K. Petersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Nigel Croxon <[email protected]>
1 parent 0dfa065 commit 2eaeac5

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/md/raid1.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,7 +3220,6 @@ static int raid1_set_limits(struct mddev *mddev)
32203220
return queue_limits_set(mddev->gendisk->queue, &lim);
32213221
}
32223222

3223-
static void raid1_free(struct mddev *mddev, void *priv);
32243223
static int raid1_run(struct mddev *mddev)
32253224
{
32263225
struct r1conf *conf;
@@ -3254,7 +3253,7 @@ static int raid1_run(struct mddev *mddev)
32543253
if (!mddev_is_dm(mddev)) {
32553254
ret = raid1_set_limits(mddev);
32563255
if (ret)
3257-
goto abort;
3256+
return ret;
32583257
}
32593258

32603259
mddev->degraded = 0;
@@ -3268,8 +3267,7 @@ static int raid1_run(struct mddev *mddev)
32683267
*/
32693268
if (conf->raid_disks - mddev->degraded < 1) {
32703269
md_unregister_thread(mddev, &conf->thread);
3271-
ret = -EINVAL;
3272-
goto abort;
3270+
return -EINVAL;
32733271
}
32743272

32753273
if (conf->raid_disks - mddev->degraded == 1)
@@ -3293,14 +3291,8 @@ static int raid1_run(struct mddev *mddev)
32933291
md_set_array_sectors(mddev, raid1_size(mddev, 0, 0));
32943292

32953293
ret = md_integrity_register(mddev);
3296-
if (ret) {
3294+
if (ret)
32973295
md_unregister_thread(mddev, &mddev->thread);
3298-
goto abort;
3299-
}
3300-
return 0;
3301-
3302-
abort:
3303-
raid1_free(mddev, conf);
33043296
return ret;
33053297
}
33063298

0 commit comments

Comments
 (0)