Skip to content

Commit deb0c3c

Browse files
Qian CaiIngo Molnar
authored andcommitted
perf/core: Fix unlock balance in perf_init_event()
Commit: 66d258c ("perf/core: Optimize perf_init_event()") introduced an unlock imbalance in perf_init_event() where it calls "goto again" and then only repeat rcu_read_unlock(). Signed-off-by: Qian Cai <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Fixes: 66d258c ("perf/core: Optimize perf_init_event()") Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent fed4c9c commit deb0c3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10307,7 +10307,6 @@ static struct pmu *perf_init_event(struct perf_event *event)
1030710307
goto unlock;
1030810308
}
1030910309

10310-
rcu_read_lock();
1031110310
/*
1031210311
* PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE
1031310312
* are often aliases for PERF_TYPE_RAW.
@@ -10317,6 +10316,7 @@ static struct pmu *perf_init_event(struct perf_event *event)
1031710316
type = PERF_TYPE_RAW;
1031810317

1031910318
again:
10319+
rcu_read_lock();
1032010320
pmu = idr_find(&pmu_idr, type);
1032110321
rcu_read_unlock();
1032210322
if (pmu) {

0 commit comments

Comments
 (0)