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
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) · 3 unmodified lines
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) {