Re: 2.6.0-test5-mm4 boot crash

viro
2003-09-24T09:57:57Z

On Wed, Sep 24, 2003 at 11:18:47AM +0200, Helge Hafting wrote:
> Unable to handle null pointer deref at virtual address 00000000
> eip c02b7d1e eip at md_probe

Oh, boy... OK, I see what happens and it's _ugly_. md_probe() is misused
there big way. The minimal fix is to revert the cleanup in md_probe() -
replace
int unit = *part;
with
int unit = MINOR(dev);

However, that is crap solution. The problem is that md_probe() is called
directly with bogus arguments - not only part is NULL (which triggers the
oops), but dev (which is supposed to be dev_t value) is actually mdidx(mddev).

Cleaner fix follows, but we really need to get the situation with gendisk
allocations into the sane shape there. Sigh...

diff -urN B5-tty_devnum-fix/drivers/md/md.c B5-current/drivers/md/md.c
--- B5-tty_devnum-fix/drivers/md/md.c Tue Sep 23 04:16:30 2003
+++ B5-current/drivers/md/md.c Wed Sep 24 05:44:27 2003
@@ -1500,6 +1500,7 @@
mdk_rdev_t *rdev;
struct gendisk *disk;
char b[BDEVNAME_SIZE];
+ int unit;

if (list_empty(&mddev->disks)) {
MD_BUG();
@@ -1591,8 +1592,9 @@
invalidate_bdev(rdev->bdev, 0);
}

- md_probe(mdidx(mddev), NULL, NULL);
- disk = disks[mdidx(mddev)];
+ unit = mdidx(mddev);
+ md_probe(0, &unit, NULL);
+ disk = disks[unit];
if (!disk)
return -ENOMEM;