Skip to content

Commit

Permalink
md/raid10: fix two bugs affecting RAID10 reshape.
Browse files Browse the repository at this point in the history
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.

Cc: stable@vger.kernel.org (v3.5+)
Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Jul 2, 2013
1 parent 0baac4d commit 78eaa0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -3554,7 +3554,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;
Expand Down Expand Up @@ -3713,7 +3713,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;
}

Expand Down

0 comments on commit 78eaa0d

Please sign in to comment.