]>
Commit | Line | Data |
---|---|---|
39a3a1fe GKH |
1 | From bbb427e342495df1cda10051d0566388697499c0 Mon Sep 17 00:00:00 2001 |
2 | From: Bart Van Assche <bart.vanassche@sandisk.com> | |
3 | Date: Thu, 29 Sep 2016 08:33:30 -0700 | |
4 | Subject: blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL | |
5 | ||
6 | From: Bart Van Assche <bart.vanassche@sandisk.com> | |
7 | ||
8 | commit bbb427e342495df1cda10051d0566388697499c0 upstream. | |
9 | ||
10 | Unlocking a mutex twice is wrong. Hence modify blkcg_policy_register() | |
11 | such that blkcg_pol_mutex is unlocked once if cpd == NULL. This patch | |
12 | avoids that smatch reports the following error: | |
13 | ||
14 | block/blk-cgroup.c:1378: blkcg_policy_register() error: double unlock 'mutex:&blkcg_pol_mutex' | |
15 | ||
16 | Fixes: 06b285bd1125 ("blkcg: fix blkcg_policy_data allocation bug") | |
17 | Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> | |
18 | Cc: Tejun Heo <tj@kernel.org> | |
19 | Signed-off-by: Tejun Heo <tj@kernel.org> | |
20 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
21 | ||
22 | --- | |
23 | block/blk-cgroup.c | 4 +--- | |
24 | 1 file changed, 1 insertion(+), 3 deletions(-) | |
25 | ||
26 | --- a/block/blk-cgroup.c | |
27 | +++ b/block/blk-cgroup.c | |
28 | @@ -1340,10 +1340,8 @@ int blkcg_policy_register(struct blkcg_p | |
29 | struct blkcg_policy_data *cpd; | |
30 | ||
31 | cpd = pol->cpd_alloc_fn(GFP_KERNEL); | |
32 | - if (!cpd) { | |
33 | - mutex_unlock(&blkcg_pol_mutex); | |
34 | + if (!cpd) | |
35 | goto err_free_cpds; | |
36 | - } | |
37 | ||
38 | blkcg->cpd[pol->plid] = cpd; | |
39 | cpd->blkcg = blkcg; |