From patchwork Wed Aug 5 13:37:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Bin X-Patchwork-Id: 11702013 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCC1B6C1 for ; Wed, 5 Aug 2020 17:39:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFA5122D3E for ; Wed, 5 Aug 2020 17:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728914AbgHERjf (ORCPT ); Wed, 5 Aug 2020 13:39:35 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:50008 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728916AbgHERed (ORCPT ); Wed, 5 Aug 2020 13:34:33 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4663146D141309B3CA39; Wed, 5 Aug 2020 21:37:19 +0800 (CST) Received: from huawei.com (10.175.127.227) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Wed, 5 Aug 2020 21:37:08 +0800 From: Zheng Bin To: , , , CC: , Subject: [PATCH] block-throttle: set q->td to NULL if blkcg_activate_policy failed Date: Wed, 5 Aug 2020 21:37:20 +0800 Message-ID: <20200805133720.1008782-1-zhengbin13@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Otherwise q->td will point to the released memory, although there is no access to q->td in the following process, still recommend to do this. Signed-off-by: Zheng Bin --- block/blk-throttle.c | 1 + 1 file changed, 1 insertion(+) -- 2.25.4 diff --git a/block/blk-throttle.c b/block/blk-throttle.c index fee3325edf27..05b87516eee9 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -2399,6 +2399,7 @@ int blk_throtl_init(struct request_queue *q) free_percpu(td->latency_buckets[READ]); free_percpu(td->latency_buckets[WRITE]); kfree(td); + q->td = NULL; } return ret; }