From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756392AbcIPIvx (ORCPT ); Fri, 16 Sep 2016 04:51:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40124 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754136AbcIPIvj (ORCPT ); Fri, 16 Sep 2016 04:51:39 -0400 From: Alexander Gordeev To: linux-kernel@vger.kernel.org Cc: Alexander Gordeev , Jens Axboe , linux-nvme@lists.infradead.org Subject: [PATCH 01/21] blk-mq: Fix memory leaks on a queue cleanup Date: Fri, 16 Sep 2016 10:51:12 +0200 Message-Id: <0afd4f6e8c2b1b4aa109b87940d9db466b60b53e.1474014910.git.agordeev@redhat.com> In-Reply-To: References: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 16 Sep 2016 08:51:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some data are leaked when blk_cleanup_queue() interface is called. CC: Jens Axboe CC: linux-nvme@lists.infradead.org Signed-off-by: Alexander Gordeev --- block/blk-mq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 13f5a6c..90e3fef 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1707,8 +1707,13 @@ static void blk_mq_free_hw_queues(struct request_queue *q, struct blk_mq_hw_ctx *hctx; unsigned int i; - queue_for_each_hw_ctx(q, hctx, i) + queue_for_each_hw_ctx(q, hctx, i) { free_cpumask_var(hctx->cpumask); + kfree(hctx->ctxs); + kfree(hctx); + } + + q->nr_hw_queues = 0; } static int blk_mq_init_hctx(struct request_queue *q, -- 1.8.3.1