diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2016-09-29 17:33:30 +0200 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-09-30 10:31:20 +0200 |
commit | bbb427e342495df1cda10051d0566388697499c0 (patch) | |
tree | f52002457cef52dd9e3cdcb490b6342a81767d9f /block/blk-cgroup.c | |
parent | cgroup: fix error handling regressions in proc_cgroup_show() and cgroup_relea... (diff) | |
download | linux-bbb427e342495df1cda10051d0566388697499c0.tar.xz linux-bbb427e342495df1cda10051d0566388697499c0.zip |
blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL
Unlocking a mutex twice is wrong. Hence modify blkcg_policy_register()
such that blkcg_pol_mutex is unlocked once if cpd == NULL. This patch
avoids that smatch reports the following error:
block/blk-cgroup.c:1378: blkcg_policy_register() error: double unlock 'mutex:&blkcg_pol_mutex'
Fixes: 06b285bd1125 ("blkcg: fix blkcg_policy_data allocation bug")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: <stable@vger.kernel.org> # v4.2+
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r-- | block/blk-cgroup.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index dd38e5ced4a3..b08ccbb9393a 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1340,10 +1340,8 @@ int blkcg_policy_register(struct blkcg_policy *pol) struct blkcg_policy_data *cpd; cpd = pol->cpd_alloc_fn(GFP_KERNEL); - if (!cpd) { - mutex_unlock(&blkcg_pol_mutex); + if (!cpd) goto err_free_cpds; - } blkcg->cpd[pol->plid] = cpd; cpd->blkcg = blkcg; |