|
@@ -1822,11 +1822,13 @@ static int run(mddev_t *mddev)
|
|
|
return -EIO;
|
|
|
}
|
|
|
|
|
|
- mddev->private = kzalloc(sizeof (raid5_conf_t)
|
|
|
- + mddev->raid_disks * sizeof(struct disk_info),
|
|
|
- GFP_KERNEL);
|
|
|
+ mddev->private = kzalloc(sizeof (raid5_conf_t), GFP_KERNEL);
|
|
|
if ((conf = mddev->private) == NULL)
|
|
|
goto abort;
|
|
|
+ conf->disks = kzalloc(mddev->raid_disks * sizeof(struct disk_info),
|
|
|
+ GFP_KERNEL);
|
|
|
+ if (!conf->disks)
|
|
|
+ goto abort;
|
|
|
|
|
|
conf->mddev = mddev;
|
|
|
|
|
@@ -1966,6 +1968,7 @@ static int run(mddev_t *mddev)
|
|
|
abort:
|
|
|
if (conf) {
|
|
|
print_raid5_conf(conf);
|
|
|
+ kfree(conf->disks);
|
|
|
kfree(conf->stripe_hashtbl);
|
|
|
kfree(conf);
|
|
|
}
|
|
@@ -1986,6 +1989,7 @@ static int stop(mddev_t *mddev)
|
|
|
kfree(conf->stripe_hashtbl);
|
|
|
blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
|
|
|
sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
|
|
|
+ kfree(conf->disks);
|
|
|
kfree(conf);
|
|
|
mddev->private = NULL;
|
|
|
return 0;
|