[Artful][PATCH 06/12] powerpc/perf: Fix double unlock in imc_common_cpuhp_mem_free()

Gustavo Walbon gwalbon at linux.vnet.ibm.com
Thu Nov 2 14:04:55 UTC 2017

From: Dan Carpenter <dan.carpenter at oracle.com>

BugLink: https://bugs.launchpad.net/bugs/1481347

This function is not called with the nest_init_lock held, and it also
unlocks the nest_init_lock immediately below, so it's fairly clear
that this is a typo and should be locking the lock.

Fixes: 885dcd709ba9 ("powerpc/perf: Add nest IMC PMU support")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
(cherry-picked from b3376dcc6c62452fe24e76d8fc35bb13eb7ee178)
Signed-off-by: Gustavo Walbon <gwalbon at linux.vnet.ibm.com>
 arch/powerpc/perf/imc-pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index 46cd912af060..52017f6eafd9 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -1124,7 +1124,7 @@ static void cleanup_all_thread_imc_memory(void)
 static void imc_common_cpuhp_mem_free(struct imc_pmu *pmu_ptr)
 	if (pmu_ptr->domain == IMC_DOMAIN_NEST) {
-		mutex_unlock(&nest_init_lock);
+		mutex_lock(&nest_init_lock);
 		if (nest_pmus == 1) {

More information about the kernel-team mailing list