Skip to content

Commit 17f91ac

Browse files
Christoph Hellwigliu-song-6
authored andcommitted
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]> Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 35f20ac commit 17f91ac

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
@@ -3203,7 +3203,6 @@ static int raid1_set_limits(struct mddev *mddev)
32033203
return queue_limits_set(mddev->gendisk->queue, &lim);
32043204
}
32053205

3206-
static void raid1_free(struct mddev *mddev, void *priv);
32073206
static int raid1_run(struct mddev *mddev)
32083207
{
32093208
struct r1conf *conf;
@@ -3237,7 +3236,7 @@ static int raid1_run(struct mddev *mddev)
32373236
if (!mddev_is_dm(mddev)) {
32383237
ret = raid1_set_limits(mddev);
32393238
if (ret)
3240-
goto abort;
3239+
return ret;
32413240
}
32423241

32433242
mddev->degraded = 0;
@@ -3251,8 +3250,7 @@ static int raid1_run(struct mddev *mddev)
32513250
*/
32523251
if (conf->raid_disks - mddev->degraded < 1) {
32533252
md_unregister_thread(mddev, &conf->thread);
3254-
ret = -EINVAL;
3255-
goto abort;
3253+
return -EINVAL;
32563254
}
32573255

32583256
if (conf->raid_disks - mddev->degraded == 1)
@@ -3276,14 +3274,8 @@ static int raid1_run(struct mddev *mddev)
32763274
md_set_array_sectors(mddev, raid1_size(mddev, 0, 0));
32773275

32783276
ret = md_integrity_register(mddev);
3279-
if (ret) {
3277+
if (ret)
32803278
md_unregister_thread(mddev, &mddev->thread);
3281-
goto abort;
3282-
}
3283-
return 0;
3284-
3285-
abort:
3286-
raid1_free(mddev, conf);
32873279
return ret;
32883280
}
32893281

0 commit comments

Comments
 (0)