History

perf/core: Fix unlock balance in perf_init_event()

Commit: 66d258c5b048 ("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().

Qian Cai committed 7 years ago

Commit deb0c3c1 parent fed4c9c1 file · +1 −1Browse files

Unified · Split

kernel/events/core.c+1−1
@@ -10307,7 +10307,6 @@ static struct pmu *perf_init_event(struct perf_event *event) · 10306 unmodified lines
10307 goto unlock;10307 goto unlock;
10308 }10308 }
10309 10309
10310 rcu_read_lock();
10311 /*10310 /*
10312 * PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE10311 * PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE
10313 * are often aliases for PERF_TYPE_RAW.10312 * are often aliases for PERF_TYPE_RAW.
@@ -10317,6 +10316,7 @@ static struct pmu *perf_init_event(struct perf_event *event) · 3 unmodified lines
10317 type = PERF_TYPE_RAW;10316 type = PERF_TYPE_RAW;
10318 10317
10319again:10318again:
10319 rcu_read_lock();
10320 pmu = idr_find(&pmu_idr, type);10320 pmu = idr_find(&pmu_idr, type);
10321 rcu_read_unlock();10321 rcu_read_unlock();
10322 if (pmu) {10322 if (pmu) {