diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2012-02-08 20:03:39 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-02-08 20:03:39 +0100 |
commit | 4609dff6b5d11e1ed5ff935e15f9f6022acb312b (patch) | |
tree | b1ffb94d7247ad6ba70e8d76800907a6450f7ebd /drivers | |
parent | 3f9a5aabd0a9fe0e0cd308506f48963d79169aa7 (diff) |
floppy: Fix a crash during rmmod
floppy driver does not call add_disk() on all the drives hence we don't take
gendisk reference on request queue for these drives. Don't call put_disk()
with disk->queue set, otherwise we try to put the reference we never took.
Reported-and-tested-by: Dirk Gouders <gouders@et.bocholt.fh-gelsenkirchen.de>
Signed-off-by: Vivek Goyal<vgoyal@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/floppy.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 401ba783321..9baf11e8636 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4585,6 +4585,15 @@ static void __exit floppy_module_exit(void) platform_device_unregister(&floppy_device[drive]); } blk_cleanup_queue(disks[drive]->queue); + + /* + * These disks have not called add_disk(). Don't put down + * queue reference in put_disk(). + */ + if (!(allowed_drive_mask & (1 << drive)) || + fdc_state[FDC(drive)].version == FDC_NONE) + disks[drive]->queue = NULL; + put_disk(disks[drive]); } |