Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1509193 > unrolled thread

[PATCH 4.4 081/112] blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2016-10-26 14:40 +0200
Last post2016-10-26 14:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.4 081/112] blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-26 14:40 +0200

#1509193 — [PATCH 4.4 081/112] blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-10-26 14:40 +0200
Subject[PATCH 4.4 081/112] blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL
Message-ID<swvES-3Eq-31@gated-at.bofh.it>
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bart Van Assche <bart.vanassche@sandisk.com>

commit bbb427e342495df1cda10051d0566388697499c0 upstream.

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>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 block/blk-cgroup.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1331,10 +1331,8 @@ int blkcg_policy_register(struct blkcg_p
 			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;

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web