Commit 1fa88d15 authored by David S. Miller's avatar David S. Miller Committed by Linus Torvalds

[PATCH] block device oopses on shutdown in 2.5.x

The partition code registers a generic device for disks
which have a dev->driver non-NULL but whose dev->driver->remove
points into outer space.  So when reboot happens --> OOPS
in drivers/base/power.c:device_shutdown()

Ok, amusingly in my case dev->driver == &scsi_done(), hehe :-)

Two cases of uninitialized memory spotted, here is the patch.
parent d97c6cdc
......@@ -1314,6 +1314,7 @@ static int sd_attach(Scsi_Device * sdp)
p = kmalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return 1;
memset(p, 0, sizeof(*p));
gd = &p->disk;
SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n",
......
......@@ -1462,6 +1462,7 @@ sg_attach(Scsi_Device * scsidp)
}
SCSI_LOG_TIMEOUT(3, printk("sg_attach: dev=%d \n", k));
memset(sdp, 0, sizeof(*sdp));
sdp->device = scsidp;
init_waitqueue_head(&sdp->o_excl_wait);
sdp->headfp = NULL;
......
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