diff options
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 2dba305daf3..03f31379ceb 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -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; |