Commit dbeada9f authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: md/linear oops fix

From: Daniel McNeil <daniel@osdl.org>

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.
parent c2dfcb95
......@@ -37,7 +37,11 @@ static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment