blk-mq error handling memory leak
cover blk-mq error handling memory leak
From: Jes Sorensen <[email protected]>
Hi,
Digging through this, I don't see the callback data getting freed in case of errors in blk_mq_init_allocated_queue() unless I am missing some obscure path that cleans it up later?
Cheers,
Jes
Jes Sorensen (1):
blk-mq: Fix memory leak in error handling
block/blk-mq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
PATCH 1/1 blk-mq: Fix memory leak in error handling
From: Jes Sorensen <[email protected]>
If blk_mq_init_allocated_queue() fails, make sure to free the poll stat callback struct allocated.
--- block/blk-mq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
block/blk-mq.c +4 -1
@@ -2838,7 +2838,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);
@@ -2899,6 +2899,9 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,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 );
Signature · 1 line
2.17.1
Re: [PATCH 1/1] blk-mq: Fix memory leak in error handling
Quoted 4 lines · Jes Sorensen
From: Jes Sorensen <[email protected]>
If
blk_mq_init_allocated_queue()fails, make sure to free the poll stat callback struct allocated.
Applied, thanks.
Signature · 1 line
Jens Axboe
Quoted 7 lines · Jes Sorensen
From: Jes Sorensen <[email protected]>
Hi,
Digging through this, I don't see the callback data getting freed in case of errors in
blk_mq_init_allocated_queue()unless I am missing some obscure path that cleans it up later?
Ping!
Any reason not to apply this?
Thanks,
Jes
Quoted 9 lines
Cheers,
JesJes Sorensen (1):
blk-mq: Fix memory leak in error handlingblock/blk-mq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)