LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: patch md-linear-fix-a-division-by-zero-bug-for-very-small-arrays.patch added to 2.6.27-stable tree
       [not found] <20081111180958.4480949037@coco.kroah.org>
@ 2008-11-11 22:28 ` Stefan Lippers-Hollmann
  2008-11-11 22:46   ` NeilBrown
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Lippers-Hollmann @ 2008-11-11 22:28 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, maan, neilb, stable

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

Hi

On Dienstag, 11. November 2008, gregkh@suse.de wrote:
> 
> This is a note to let you know that we have just queued up the patch titled
> 
>     Subject: md: linear: Fix a division by zero bug for very small arrays.
> Subject: md: linear: Fix a division by zero bug for very small arrays.
> 
> to the 2.6.27-stable tree.  Its filename is
> 
>     md-linear-fix-a-division-by-zero-bug-for-very-small-arrays.patch
> 
> A git repo of this tree can be found at 
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> 
> From jejb@kernel.org  Tue Nov 11 09:47:32 2008
> From: Andre Noll <maan@systemlinux.org>
> Date: Fri, 7 Nov 2008 00:07:46 GMT
> Subject: md: linear: Fix a division by zero bug for very small arrays.
> To: stable@kernel.org
> Message-ID: <200811070007.mA707k6d006270@hera.kernel.org>
> 
> From: Andre Noll <maan@systemlinux.org>
> 
> commit f1cd14ae52985634d0389e934eba25b5ecf24565 upstream
> 
> Date: Thu, 6 Nov 2008 19:41:24 +1100
> Subject: md: linear: Fix a division by zero bug for very small arrays.
> 
> We currently oops with a divide error on starting a linear software
> raid array consisting of at least two very small (< 500K) devices.
> 
> The bug is caused by the calculation of the hash table size which
> tries to compute sector_div(sz, base) with "base" being zero due to
> the small size of the component devices of the array.
> 
> Fix this by requiring the hash spacing to be at least one which
> implies that also "base" is non-zero.
> 
> This bug has existed since about 2.6.14.
> 
> Signed-off-by: Andre Noll <maan@systemlinux.org>
> Signed-off-by: NeilBrown <neilb@suse.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> 
> ---
>  drivers/md/linear.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/drivers/md/linear.c
> +++ b/drivers/md/linear.c
> @@ -157,6 +157,8 @@ static linear_conf_t *linear_conf(mddev_
>  
>  	min_spacing = conf->array_sectors / 2;
>  	sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
> +	if (min_sectors == 0)
> +		min_sectors = 1;
>  
>  	/* min_spacing is the minimum spacing that will fit the hash
>  	 * table in one PAGE.  This may be much smaller than needed.

drivers/md/linear.c: In function 'linear_conf':
drivers/md/linear.c:160: error: 'min_sectors' undeclared (first use in this function)
drivers/md/linear.c:160: error: (Each undeclared identifier is reported only once
drivers/md/linear.c:160: error: for each function it appears in.)
make[5]: *** [drivers/md/linear.o] Error 1
make[4]: *** [drivers/md] Error 2
make[4]: *** Waiting for unfinished jobs....

This one obviously depends on:

commit 23242fbb470ff4c8c4d41f178832cf1929273d7d
Author: Andre Noll <maan@systemlinux.org>
Date:   Mon Oct 13 11:55:12 2008 +1100

    md: linear.c: Make two local variables sector-based.

which in turn depends on previous changes.

Regards
	Stefan Lippers-Hollmann

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: patch  md-linear-fix-a-division-by-zero-bug-for-very-small-arrays.patch  added to 2.6.27-stable tree
  2008-11-11 22:28 ` patch md-linear-fix-a-division-by-zero-bug-for-very-small-arrays.patch added to 2.6.27-stable tree Stefan Lippers-Hollmann
@ 2008-11-11 22:46   ` NeilBrown
  2008-11-11 23:43     ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2008-11-11 22:46 UTC (permalink / raw)
  To: Stefan Lippers-Hollmann; +Cc: gregkh, linux-kernel, maan, stable

On Wed, November 12, 2008 9:28 am, Stefan Lippers-Hollmann wrote:
> Hi
>
> On Dienstag, 11. November 2008, gregkh@suse.de wrote:

>>
>> --- a/drivers/md/linear.c
>> +++ b/drivers/md/linear.c
>> @@ -157,6 +157,8 @@ static linear_conf_t *linear_conf(mddev_
>>
>>  	min_spacing = conf->array_sectors / 2;
>>  	sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
>> +	if (min_sectors == 0)
>> +		min_sectors = 1;
>>
>>  	/* min_spacing is the minimum spacing that will fit the hash
>>  	 * table in one PAGE.  This may be much smaller than needed.
>
> drivers/md/linear.c: In function 'linear_conf':
> drivers/md/linear.c:160: error: 'min_sectors' undeclared (first use in
> this function)
> drivers/md/linear.c:160: error: (Each undeclared identifier is reported
> only once
> drivers/md/linear.c:160: error: for each function it appears in.)
> make[5]: *** [drivers/md/linear.o] Error 1
> make[4]: *** [drivers/md] Error 2
> make[4]: *** Waiting for unfinished jobs....
>
> This one obviously depends on:
>
> commit 23242fbb470ff4c8c4d41f178832cf1929273d7d
> Author: Andre Noll <maan@systemlinux.org>
> Date:   Mon Oct 13 11:55:12 2008 +1100
>
>     md: linear.c: Make two local variables sector-based.
>
> which in turn depends on previous changes.

Yes, but only syntactically, not semantically.

In 2.6.27, it needs to be
   if (min_spacing == 0)
           min_spacing = 1;

The other previous patches don't need to be backported.

Thanks for reporting this.

NeilBrown


>
> Regards
> 	Stefan Lippers-Hollmann
>


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

* Re: patch md-linear-fix-a-division-by-zero-bug-for-very-small-arrays.patch added to 2.6.27-stable tree
  2008-11-11 22:46   ` NeilBrown
@ 2008-11-11 23:43     ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2008-11-11 23:43 UTC (permalink / raw)
  To: NeilBrown; +Cc: Stefan Lippers-Hollmann, linux-kernel, maan, stable

On Wed, Nov 12, 2008 at 09:46:36AM +1100, NeilBrown wrote:
> On Wed, November 12, 2008 9:28 am, Stefan Lippers-Hollmann wrote:
> > Hi
> >
> > On Dienstag, 11. November 2008, gregkh@suse.de wrote:
> 
> >>
> >> --- a/drivers/md/linear.c
> >> +++ b/drivers/md/linear.c
> >> @@ -157,6 +157,8 @@ static linear_conf_t *linear_conf(mddev_
> >>
> >>  	min_spacing = conf->array_sectors / 2;
> >>  	sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
> >> +	if (min_sectors == 0)
> >> +		min_sectors = 1;
> >>
> >>  	/* min_spacing is the minimum spacing that will fit the hash
> >>  	 * table in one PAGE.  This may be much smaller than needed.
> >
> > drivers/md/linear.c: In function 'linear_conf':
> > drivers/md/linear.c:160: error: 'min_sectors' undeclared (first use in
> > this function)
> > drivers/md/linear.c:160: error: (Each undeclared identifier is reported
> > only once
> > drivers/md/linear.c:160: error: for each function it appears in.)
> > make[5]: *** [drivers/md/linear.o] Error 1
> > make[4]: *** [drivers/md] Error 2
> > make[4]: *** Waiting for unfinished jobs....
> >
> > This one obviously depends on:
> >
> > commit 23242fbb470ff4c8c4d41f178832cf1929273d7d
> > Author: Andre Noll <maan@systemlinux.org>
> > Date:   Mon Oct 13 11:55:12 2008 +1100
> >
> >     md: linear.c: Make two local variables sector-based.
> >
> > which in turn depends on previous changes.
> 
> Yes, but only syntactically, not semantically.
> 
> In 2.6.27, it needs to be
>    if (min_spacing == 0)
>            min_spacing = 1;

Thanks, I've adjusted the patch to look like this instead.

greg k-h

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

end of thread, other threads:[~2008-11-11 23:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20081111180958.4480949037@coco.kroah.org>
2008-11-11 22:28 ` patch md-linear-fix-a-division-by-zero-bug-for-very-small-arrays.patch added to 2.6.27-stable tree Stefan Lippers-Hollmann
2008-11-11 22:46   ` NeilBrown
2008-11-11 23:43     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).