mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-25 11:55:37 +00:00
blk-mq: fix queue reference leak on blk_mq_alloc_disk_for_queue failure
[ Upstream commit22c17e279a
] Drop the request queue reference just acquired when __alloc_disk_node failed. Fixes:6f8191fdf4
("block: simplify disk shutdown") Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Link: https://lore.kernel.org/r/20221122072753.426077-1-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fe2f36b330
commit
c813b2613f
1 changed files with 6 additions and 1 deletions
|
@ -3956,9 +3956,14 @@ EXPORT_SYMBOL(__blk_mq_alloc_disk);
|
|||
struct gendisk *blk_mq_alloc_disk_for_queue(struct request_queue *q,
|
||||
struct lock_class_key *lkclass)
|
||||
{
|
||||
struct gendisk *disk;
|
||||
|
||||
if (!blk_get_queue(q))
|
||||
return NULL;
|
||||
return __alloc_disk_node(q, NUMA_NO_NODE, lkclass);
|
||||
disk = __alloc_disk_node(q, NUMA_NO_NODE, lkclass);
|
||||
if (!disk)
|
||||
blk_put_queue(q);
|
||||
return disk;
|
||||
}
|
||||
EXPORT_SYMBOL(blk_mq_alloc_disk_for_queue);
|
||||
|
||||
|
|
Loading…
Reference in a new issue