mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
blk-mq: Fix memory leak in error handling
If blk_mq_init_allocated_queue() fails, make sure to free the poll stat callback struct allocated. Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
1 parent
fe2008640a
commit
41de54c648
1 file changed
+4
-1
+4
-1
@@ -2865,7 +2865,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
|
||||
goto err_exit;
|
||||
|
||||
if (blk_mq_alloc_ctxs(q))
|
||||
goto err_exit;
|
||||
goto err_poll;
|
||||
|
||||
/* init q->mq_kobj and sw queues' kobjects */
|
||||
blk_mq_sysfs_init(q);
|
||||
@@ -2929,6 +2929,9 @@ err_hctxs:
|
||||
kfree(q->queue_hw_ctx);
|
||||
err_sys_init:
|
||||
blk_mq_sysfs_deinit(q);
|
||||
err_poll:
|
||||
blk_stat_free_callback(q->poll_cb);
|
||||
q->poll_cb = NULL;
|
||||
err_exit:
|
||||
q->mq_ops = NULL;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
Reference in new issue
Block a user