From patchwork Mon Apr 1 13:40:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenghui Wang X-Patchwork-Id: 10879979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4830313B5 for ; Mon, 1 Apr 2019 13:40:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3478D287AD for ; Mon, 1 Apr 2019 13:40:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32E45288DB; Mon, 1 Apr 2019 13:40:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC2BD287E0 for ; Mon, 1 Apr 2019 13:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727351AbfDANkw (ORCPT ); Mon, 1 Apr 2019 09:40:52 -0400 Received: from smtpbg202.qq.com ([184.105.206.29]:54000 "EHLO smtpbg202.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727332AbfDANkw (ORCPT ); Mon, 1 Apr 2019 09:40:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1554126048; bh=xcOVAO9FLT1t00ieWMJbhPMwJrUEO08yI+we8Q/1fxo=; h=From:To:Subject:Date:Message-Id:MIME-Version:Content-Transfer-Encoding; b=gmRCNG4zC5FSv6GLpCphur7XMf4NNbV66NbHSASBRBO9tvtHgrBKOvyHNLRw/gYgb 0A9edxvdEAYZa4L4y83F1a6LKwLZTzUZKWFgn+hEyvTPiPxYeT35tHu6G45BmsNMuz nBA+VdHJOPqAiI4AoaB6vU1Y3U5ByaBEkFoMyWJE= X-QQ-mid: esmtp2t1554126047t091lyvd9 Received: from localhost.localdomain (unknown [221.220.250.87]) by esmtp4.qq.com (ESMTP) with id ; Mon, 01 Apr 2019 21:40:37 +0800 (CST) X-QQ-SSF: 01000000000000F0FH3000000000000 X-QQ-FEAT: oMsKLsS2kt+xD9VPsVfLijVxk8e6wMej7+E6U47JgAb6tlSXHBs0M52EZ3OG9 1C6sWQ6UN42fVD6939rYcD6SEcaXNSbZnUdwKUVDKxzlXBh/vdQfILu6y+GjjAKr7fzvGwu jhg3B97q8kd+pKPX4Z/a5QpmF1pGhPDqmcBPkNDlKplo3rao6d5OqomrAnuXg24X/UkYMVX iIqBOGZL0+UUD4X+oYwCNj8XH+9cBy9ynIYCoB7R0XmANioDys/DW6ZIZW8FiARR6JYNcxy /mCVYGrc5qtkg+xtuEcUdXcvs= X-QQ-GoodBg: 0 From: Shenghui Wang To: axboe@kernel.dk, linux-block@vger.kernel.org Subject: [PATCH] block: use blk_free_flush_queue() to free hctx->fq in blk_mq_init_hctx Date: Mon, 1 Apr 2019 21:40:36 +0800 Message-Id: <20190401134036.8377-1-shhuiw@foxmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: esmtp:foxmail.com:bgforeign:bgforeign4 X-QQ-Bgrelay: 1 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP kfree() can leak the hctx->fq->flush_rq field. Signed-off-by: Shenghui Wang Reviewed-by: Ming Lei --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 3ff3d7b49969..f3b0d33bdf88 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2332,7 +2332,7 @@ static int blk_mq_init_hctx(struct request_queue *q, return 0; free_fq: - kfree(hctx->fq); + blk_free_flush_queue(hctx->fq); exit_hctx: if (set->ops->exit_hctx) set->ops->exit_hctx(hctx, hctx_idx);