• Alexander Viro's avatar
    [PATCH] 32-bit dev_t: md fallout · dd7937d3
    Alexander Viro authored
    This fixes a NULL ptr dereference in md_probe() noted by Helge Hafting.
    
    It even gets the things slightly better than they used to be, but
    late-boot magic in md.c is certainly a mess.  Oh, well...
    
    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...
    dd7937d3
md.c 81.5 KB