From patchwork Fri Sep 1 14:17:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: weiping zhang X-Patchwork-Id: 9934375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5F3E060309 for ; Fri, 1 Sep 2017 14:17:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5225828676 for ; Fri, 1 Sep 2017 14:17:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46A372867C; Fri, 1 Sep 2017 14:17:41 +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=-5.3 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, URIBL_SBL 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 F387728676 for ; Fri, 1 Sep 2017 14:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751927AbdIAORj (ORCPT ); Fri, 1 Sep 2017 10:17:39 -0400 Received: from mx1.didichuxing.com ([111.202.154.82]:9151 "EHLO BJEXCAS007.didichuxing.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751924AbdIAORj (ORCPT ); Fri, 1 Sep 2017 10:17:39 -0400 Received: from localhost.didichuxing.com (172.22.50.20) by BJSGEXMBX04.didichuxing.com (172.20.15.134) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Fri, 1 Sep 2017 22:17:37 +0800 Date: Fri, 1 Sep 2017 22:17:29 +0800 From: weiping zhang To: CC: Subject: [PATCH v2 1/2] blkcg: check pol->cpd_free_fn before free cpd Message-ID: Mail-Followup-To: axboe@kernel.dk, linux-block@vger.kernel.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [172.22.50.20] X-ClientProxiedBy: BJEXCAS004.didichuxing.com (172.20.1.44) To BJSGEXMBX04.didichuxing.com (172.20.15.134) 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 check pol->cpd_free_fn() instead of pol->cpd_alloc_fn() when free cpd. Signed-off-by: weiping zhang --- block/blk-cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 0480892..0c45870 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1450,7 +1450,7 @@ int blkcg_policy_register(struct blkcg_policy *pol) return 0; err_free_cpds: - if (pol->cpd_alloc_fn) { + if (pol->cpd_free_fn) { list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { if (blkcg->cpd[pol->plid]) { pol->cpd_free_fn(blkcg->cpd[pol->plid]); @@ -1490,7 +1490,7 @@ void blkcg_policy_unregister(struct blkcg_policy *pol) /* remove cpds and unregister */ mutex_lock(&blkcg_pol_mutex); - if (pol->cpd_alloc_fn) { + if (pol->cpd_free_fn) { list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { if (blkcg->cpd[pol->plid]) { pol->cpd_free_fn(blkcg->cpd[pol->plid]);