Skip to contentSkip to conversation

Patch "blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Oct 26, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
blkcg-unlock-blkcg_pol_mutex-only-once-when-cpd-null.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From bbb427e342495df1cda10051d0566388697499c0 Mon Sep 17 00:00:00 2001

From: Bart Van Assche <[email protected]>
Date: Thu, 29 Sep 2016 08:33:30 -0700
Subject: blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL

From: Bart Van Assche <[email protected]>

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")
Cc Tejun Heo <[email protected]>
---
 block/blk-cgroup.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
block/blk-cgroup.c +1 -3
@@ -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;

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/dm-mark-request_queue-dead-before-destroying-the-dm-device.patch queue-4.4/dm-mpath-check-if-path-s-request_queue-is-dying-in-activate_path.patch queue-4.4/sd-fix-rw_max-for-devices-that-report-an-optimal-xfer-size.patch queue-4.4/blkcg-unlock-blkcg_pol_mutex-only-once-when-cpd-null.patch