diff options
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 9dbe8cdaf145..49d8be5a45e3 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -342,6 +342,9 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx) | |||
342 | if (event->state > PERF_EVENT_STATE_OFF) | 342 | if (event->state > PERF_EVENT_STATE_OFF) |
343 | event->state = PERF_EVENT_STATE_OFF; | 343 | event->state = PERF_EVENT_STATE_OFF; |
344 | 344 | ||
345 | if (event->state > PERF_EVENT_STATE_FREE) | ||
346 | return; | ||
347 | |||
345 | /* | 348 | /* |
346 | * If this was a group event with sibling events then | 349 | * If this was a group event with sibling events then |
347 | * upgrade the siblings to singleton events by adding them | 350 | * upgrade the siblings to singleton events by adding them |
@@ -1861,6 +1864,8 @@ int perf_event_release_kernel(struct perf_event *event) | |||
1861 | { | 1864 | { |
1862 | struct perf_event_context *ctx = event->ctx; | 1865 | struct perf_event_context *ctx = event->ctx; |
1863 | 1866 | ||
1867 | event->state = PERF_EVENT_STATE_FREE; | ||
1868 | |||
1864 | WARN_ON_ONCE(ctx->parent_ctx); | 1869 | WARN_ON_ONCE(ctx->parent_ctx); |
1865 | mutex_lock(&ctx->mutex); | 1870 | mutex_lock(&ctx->mutex); |
1866 | perf_event_remove_from_context(event); | 1871 | perf_event_remove_from_context(event); |
@@ -5021,7 +5026,7 @@ err_fput_free_put_context: | |||
5021 | 5026 | ||
5022 | err_free_put_context: | 5027 | err_free_put_context: |
5023 | if (err < 0) | 5028 | if (err < 0) |
5024 | kfree(event); | 5029 | free_event(event); |
5025 | 5030 | ||
5026 | err_put_context: | 5031 | err_put_context: |
5027 | if (err < 0) | 5032 | if (err < 0) |