Skip to content

Commit 81b74ac

Browse files
committed
paride/pcd: cleanup queues when detection fails
The driver allocates queues for all the units it potentially supports. But if we fail to detect any drives, then we fail loading the module without cleaning up those queues. This is now evident with the switch to blk-mq, though the bug has been there forever as far as I can tell. Also fix cleanup through regular module exit. Reported-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6ce5902 commit 81b74ac

File tree

1 file changed

+5
-1
lines changed
  • drivers/block/paride

1 file changed

+5
-1
lines changed

drivers/block/paride/pcd.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,12 @@ static int pcd_detect(void)
749749
return 0;
750750

751751
printk("%s: No CD-ROM drive found\n", name);
752-
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)
752+
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
753+
blk_cleanup_queue(cd->disk->queue);
754+
cd->disk->queue = NULL;
755+
blk_mq_free_tag_set(&cd->tag_set);
753756
put_disk(cd->disk);
757+
}
754758
pi_unregister_driver(par_drv);
755759
return -1;
756760
}

0 commit comments

Comments
 (0)