blkfront: Fix backtrace in del_gendisk
authorDaniel Stodden <daniel.stodden@citrix.com>
Fri, 30 Apr 2010 22:01:16 +0000 (22:01 +0000)
committerJens Axboe <jaxboe@fusionio.com>
Sat, 7 Aug 2010 16:31:35 +0000 (18:31 +0200)
The call to del_gendisk follows an non-refcounted gd->queue
pointer. We release the last ref in blk_cleanup_queue. Fixed by
reordering releases accordingly.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
drivers/block/xen-blkfront.c

index 7fa2a1db51e68d3e67d7dbe01a271a4738644985..3258ae67ac7a12227940466a5b70bb9db7cd46d1 100644 (file)
@@ -1021,14 +1021,14 @@ static void blkfront_closing(struct blkfront_info *info)
        /* Flush gnttab callback work. Must be done with no locks held. */
        flush_scheduled_work();
 
-       blk_cleanup_queue(info->rq);
-       info->rq = NULL;
-
        minor = info->gd->first_minor;
        nr_minors = info->gd->minors;
        del_gendisk(info->gd);
        xlbd_release_minors(minor, nr_minors);
 
+       blk_cleanup_queue(info->rq);
+       info->rq = NULL;
+
  out:
        if (info->xbdev)
                xenbus_frontend_closed(info->xbdev);