Please pass this to Linus as soon as practical, because this is a bugfix.

This patch was developed by Glenn Maynard for his oops back in December,
but for some reason I forgot about it and had it reimplemented when I stepped
on this problem myself. In my case, there was no oops, but a warning about
slab corruption.

Signed-off-by: Pete Zaitcev

--- linux-2.6.11-rc4/drivers/block/ub.c 2005-02-15 22:38:33.000000000 -0800
+++ linux-2.6.11-rc4-bq/drivers/block/ub.c      2005-02-20 21:46:58.000000000 
-0800
@@ -491,6 +491,11 @@
  */
 static void ub_cleanup(struct ub_dev *sc)
 {
+       request_queue_t *q;
+
+       /* I don't think queue can be NULL. But... Stolen from sx8.c */
+       if ((q = sc->disk->queue) != NULL)
+               blk_cleanup_queue(q);
 
        /*
         * If we zero disk->private_data BEFORE put_disk, we have to check
@@ -2013,7 +2018,6 @@
 {
        struct ub_dev *sc = usb_get_intfdata(intf);
        struct gendisk *disk = sc->disk;
-       request_queue_t *q = disk->queue;
        unsigned long flags;
 
        /*
@@ -2056,13 +2060,8 @@
         */
        if (disk->flags & GENHD_FL_UP)
                del_gendisk(disk);
-       if (q)
-               blk_cleanup_queue(q);
 
        /*
-        * We really expect blk_cleanup_queue() to wait, so no amount
-        * of paranoya is too much.
-        *
         * Taking a lock on a structure which is about to be freed
         * is very nonsensual. Here it is largely a way to do a debug freeze,
         * and a bracket which shows where the nonsensual code segment ends.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to