From: Jes Sorensen <jes.sorensen@gmail.com>
To: linux-block@vger.kernel.org
Cc: kernel-team@fb.com, Jes Sorensen <jsorensen@fb.com>
Subject: [PATCH 1/1] blk-mq: Fix memory leak in error handling
Date: Fri, 19 Apr 2019 16:35:44 -0400 [thread overview]
Message-ID: <20190419203544.11725-2-Jes.Sorensen@gmail.com> (raw)
In-Reply-To: <20190419203544.11725-1-Jes.Sorensen@gmail.com>
From: Jes Sorensen <jsorensen@fb.com>
If blk_mq_init_allocated_queue() fails, make sure to free the poll
stat callback struct allocated.
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
block/blk-mq.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9516304a38ee..7aa90c0b056b 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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);
--
2.17.1
next prev parent reply other threads:[~2019-04-19 20:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-19 20:35 [PATCH 0/1] blk-mq error handling memory leak Jes Sorensen
2019-04-19 20:35 ` Jes Sorensen [this message]
2019-05-29 20:33 ` [PATCH 1/1] blk-mq: Fix memory leak in error handling Jens Axboe
2019-05-29 20:16 ` [PATCH 0/1] blk-mq error handling memory leak Jes Sorensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190419203544.11725-2-Jes.Sorensen@gmail.com \
--to=jes.sorensen@gmail.com \
--cc=jsorensen@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).