summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2018-10-11 12:20:41 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-21 09:27:31 +0100
commit82e05b994790211bbcc4b18c99f5eb5112e44f56 (patch)
treef51d4948fc0ad873ab9b35d02d2a2b9ea2fe2109 /drivers/block
parent7d81f8fe5427ebe7d5ea8cd526c77fee9c01a7c3 (diff)
swim: fix cleanup on setup error
[ Upstream commit 1448a2a5360ae06f25e2edc61ae070dff5c0beb4 ] If we fail to allocate the request queue for a disk, we still need to free that disk, not just the previous ones. Additionally, we need to cleanup the previous request queues. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/swim.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index b5afd495d482..eec6e393c124 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -868,8 +868,17 @@ static int swim_floppy_init(struct swim_priv *swd)
exit_put_disks:
unregister_blkdev(FLOPPY_MAJOR, "fd");
- while (drive--)
- put_disk(swd->unit[drive].disk);
+ do {
+ struct gendisk *disk = swd->unit[drive].disk;
+
+ if (disk) {
+ if (disk->queue) {
+ blk_cleanup_queue(disk->queue);
+ disk->queue = NULL;
+ }
+ put_disk(disk);
+ }
+ } while (drive--);
return err;
}