From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755515AbbGUPGm (ORCPT ); Tue, 21 Jul 2015 11:06:42 -0400 Received: from mail-yk0-f174.google.com ([209.85.160.174]:35684 "EHLO mail-yk0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754396AbbGUPGj (ORCPT ); Tue, 21 Jul 2015 11:06:39 -0400 Date: Tue, 21 Jul 2015 11:06:34 -0400 From: Tejun Heo To: Jens Axboe Cc: kernel-janitors@vger.kernel.org, Dan Carpenter , linux-kernel@vger.kernel.org Subject: [PATCH block/for-linus] blkcg: fix double unlock in blkcg_policy_register() error path Message-ID: <20150721150634.GF15934@mtj.duckdns.org> References: <20150720145436.GA19257@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150720145436.GA19257@mwanda> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 06b285bd1125 ("blkcg: fix blkcg_policy_data allocation bug") introduced double unlock of blkcg_pol_mutx on allocation failure path. Fix it. Signed-off-by: Tejun Heo Reported-by: Dan Carpenter Fixes: 06b285bd1125 ("blkcg: fix blkcg_policy_data allocation bug") --- block/blk-cgroup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 9da02c0..24fb729 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1187,10 +1187,8 @@ int blkcg_policy_register(struct blkcg_policy *pol) struct blkcg_policy_data *cpd; cpd = kzalloc(pol->cpd_size, GFP_KERNEL); - if (!cpd) { - mutex_unlock(&blkcg_pol_mutex); + if (!cpd) goto err_free_cpds; - } blkcg->pd[pol->plid] = cpd; cpd->plid = pol->plid;