[PATCH] perf/tracing/cpuhotplug: don't release cred_guard_mutex if not taken

From: Levin, Alexander (Sasha Levin)
Date: Fri Jun 02 2017 - 23:39:59 EST


From: Alexander Levin <alexander.levin@xxxxxxxxxxx>

If we failed to acquire task's cred_guard_mutex we shouldn't proceed
to release it in the error path.

Fixes: a63fbed776c ("perf/tracing/cpuhotplug: Fix locking order")
Signed-off-by: Alexander Levin <alexander.levin@xxxxxxxxxxx>
---
kernel/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 8d6acaeeea17..8e8323c6036b 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9878,7 +9878,7 @@ SYSCALL_DEFINE5(perf_event_open,
if (task) {
err = mutex_lock_interruptible(&task->signal->cred_guard_mutex);
if (err)
- goto err_cred;
+ goto err_task;

/*
* Reuse ptrace permission checks for now.
--
2.11.0