floppy: fix use-after-free in module load failure path

Commit 488211844e0c ("floppy: switch to one queue per drive instead of
sharing a queue") introduced a use-after-free. We do "put_disk()" on
the disk device _before_ we then clean up the queue associated with that
disk.

Move the put_disk() down to avoid dereferencing a free'd data structure.

Cc: Jens Axboe <jaxboe@fusionio.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Reported-and-tested-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+1 -1
+1 -1
drivers/block/floppy.c
··· 4363 4363 out_put_disk: 4364 4364 while (dr--) { 4365 4365 del_timer(&motor_off_timer[dr]); 4366 - put_disk(disks[dr]); 4367 4366 if (disks[dr]->queue) 4368 4367 blk_cleanup_queue(disks[dr]->queue); 4368 + put_disk(disks[dr]); 4369 4369 } 4370 4370 return err; 4371 4371 }