diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/core.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 1d1f030e2f1e..ef5e7cc686e3 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -1950,7 +1950,16 @@ static int __perf_event_enable(void *info) | |||
1950 | struct perf_cpu_context *cpuctx = __get_cpu_context(ctx); | 1950 | struct perf_cpu_context *cpuctx = __get_cpu_context(ctx); |
1951 | int err; | 1951 | int err; |
1952 | 1952 | ||
1953 | if (WARN_ON_ONCE(!ctx->is_active)) | 1953 | /* |
1954 | * There's a time window between 'ctx->is_active' check | ||
1955 | * in perf_event_enable function and this place having: | ||
1956 | * - IRQs on | ||
1957 | * - ctx->lock unlocked | ||
1958 | * | ||
1959 | * where the task could be killed and 'ctx' deactivated | ||
1960 | * by perf_event_exit_task. | ||
1961 | */ | ||
1962 | if (!ctx->is_active) | ||
1954 | return -EINVAL; | 1963 | return -EINVAL; |
1955 | 1964 | ||
1956 | raw_spin_lock(&ctx->lock); | 1965 | raw_spin_lock(&ctx->lock); |