Skip to content

Commit

Permalink
DM RAID: Fix comparison of index and quantity for "rebuild" parameter
Browse files Browse the repository at this point in the history
DM RAID: Fix comparison of index and quantity for "rebuild" parameter

The "rebuild" parameter takes an index argument that starts counting from
zero.  The conditional used to validate the index was using '>' rather than
'>=', leaving the door open for an index value that would be 1 too large.

Reported-by: Neil Brown <neilb@suse.de>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
Jonathan Brassow authored and NeilBrown committed Oct 11, 2012
1 parent 4ec1e36 commit 7386199
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/dm-raid.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv,

/* Parameters that take a numeric value are checked here */
if (!strcasecmp(key, "rebuild")) {
if (value > rs->md.raid_disks) {
if (value >= rs->md.raid_disks) {
rs->ti->error = "Invalid rebuild index given";
return -EINVAL;
}
Expand Down

0 comments on commit 7386199

Please sign in to comment.