[PATCH 2.5.65] md/linear oops fix

Daniel McNeil (daniel@osdl.org)
18 Mar 2003 10:45:56 -0800


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-6311-1048013222-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

This fixes an oops caused by incorrect usage of sector_div()
in which_dev() in md/linear.c. It was dereferencing an non-existent
hash table entry.

-- 
Daniel McNeil <daniel@osdl.org>

--=_courier-6311-1048013222-0001-2 Content-Type: text/x-patch; name="patch-2.5.65-linear"; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=patch-2.5.65-linear

diff -urNp -X /home/daniel/dontdiff linux-2.5.65/drivers/md/linear.c linux-2.5.65-md/drivers/md/linear.c --- linux-2.5.65/drivers/md/linear.c Mon Mar 17 13:44:04 2003 +++ linux-2.5.65-md/drivers/md/linear.c Tue Mar 18 09:34:09 2003 @@ -37,7 +37,11 @@ static inline dev_info_t *which_dev(mdde linear_conf_t *conf = mddev_to_conf(mddev); sector_t block = sector >> 1; - hash = conf->hash_table + sector_div(block, conf->smallest->size); + /* + * sector_div(a,b) returns the remainer and sets a to a/b + */ + (void)sector_div(block, conf->smallest->size); + hash = conf->hash_table + block; if ((sector>>1) >= (hash->dev0->size + hash->dev0->offset)) return hash->dev1;

--=_courier-6311-1048013222-0001-2--