summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-07-02 15:58:05 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-25 14:07:28 -0700
commit4b5c14511c401edf5ea78e2592c7043456deb595 (patch)
treec73b7bf599ebae988335fab8b38af45c012073a6 /drivers/md
parent509c317d092a551f5c26de05445fc8d5b81cc23d (diff)
md/raid10: fix two bugs affecting RAID10 reshape.
commit 78eaa0d4cbcdb345992fa3dd22b3bcbb473cc064 upstream. 1/ If a RAID10 is being reshaped to a fewer number of devices and is stopped while this is ongoing, then when the array is reassembled the 'mirrors' array will be allocated too small. This will lead to an access error or memory corruption. 2/ A sanity test for a reshaping RAID10 array is restarted is slightly incorrect. Due to the first bug, this is suitable for any -stable kernel since 3.5 where this code was introduced. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid10.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index f2f4a6e4f4f4..d7bad6bc46d8 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3531,7 +3531,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
/* FIXME calc properly */
conf->mirrors = kzalloc(sizeof(struct raid10_info)*(mddev->raid_disks +
- max(0,mddev->delta_disks)),
+ max(0,-mddev->delta_disks)),
GFP_KERNEL);
if (!conf->mirrors)
goto out;
@@ -3690,7 +3690,7 @@ static int run(struct mddev *mddev)
conf->geo.far_offset == 0)
goto out_free_conf;
if (conf->prev.far_copies != 1 &&
- conf->geo.far_offset == 0)
+ conf->prev.far_offset == 0)
goto out_free_conf;
}