All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DM RAID: Fix comparison of index and quantity for "rebuild" parameter
@ 2012-09-05 15:53 Jonathan Brassow
  2012-09-05 20:22 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Brassow @ 2012-09-05 15:53 UTC (permalink / raw)
  To: linux-raid; +Cc: neilb, jbrassow

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>

Index: linux-upstream/drivers/md/dm-raid.c
===================================================================
--- linux-upstream.orig/drivers/md/dm-raid.c
+++ linux-upstream/drivers/md/dm-raid.c
@@ -539,7 +539,7 @@ static int parse_raid_params(struct raid
 
 		/* 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;
 			}



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] DM RAID: Fix comparison of index and quantity for "rebuild" parameter
  2012-09-05 15:53 [PATCH] DM RAID: Fix comparison of index and quantity for "rebuild" parameter Jonathan Brassow
@ 2012-09-05 20:22 ` NeilBrown
  0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2012-09-05 20:22 UTC (permalink / raw)
  To: Jonathan Brassow; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]

On Wed, 05 Sep 2012 10:53:20 -0500 Jonathan Brassow <jbrassow@redhat.com>
wrote:

> 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>
> 
> Index: linux-upstream/drivers/md/dm-raid.c
> ===================================================================
> --- linux-upstream.orig/drivers/md/dm-raid.c
> +++ linux-upstream/drivers/md/dm-raid.c
> @@ -539,7 +539,7 @@ static int parse_raid_params(struct raid
>  
>  		/* 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;
>  			}
> 

Applied, thanks.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-05 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-05 15:53 [PATCH] DM RAID: Fix comparison of index and quantity for "rebuild" parameter Jonathan Brassow
2012-09-05 20:22 ` NeilBrown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.