Loading kernel/events/core.c +6 −4 Original line number Diff line number Diff line Loading @@ -3241,16 +3241,18 @@ errout: * Returns a matching context with refcount and pincount. */ static struct perf_event_context * find_get_context(struct pmu *pmu, struct task_struct *task, int cpu) find_get_context(struct perf_event *event, struct task_struct *task, int cpu) { struct perf_event_context *ctx, *clone_ctx = NULL; struct perf_cpu_context *cpuctx; struct pmu *pmu = event->pmu; unsigned long flags; int ctxn, err; if (!task) { /* Must be root to operate on a CPU event: */ if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) if (event->owner != EVENT_OWNER_KERNEL && perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) return ERR_PTR(-EACCES); /* Loading Loading @@ -7415,7 +7417,7 @@ SYSCALL_DEFINE5(perf_event_open, /* * Get the target context (task or percpu): */ ctx = find_get_context(pmu, task, event->cpu); ctx = find_get_context(event, task, event->cpu); if (IS_ERR(ctx)) { err = PTR_ERR(ctx); goto err_alloc; Loading Loading @@ -7584,7 +7586,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, account_event(event); ctx = find_get_context(event->pmu, task, cpu); ctx = find_get_context(event, task, cpu); if (IS_ERR(ctx)) { err = PTR_ERR(ctx); goto err_free; Loading Loading
kernel/events/core.c +6 −4 Original line number Diff line number Diff line Loading @@ -3241,16 +3241,18 @@ errout: * Returns a matching context with refcount and pincount. */ static struct perf_event_context * find_get_context(struct pmu *pmu, struct task_struct *task, int cpu) find_get_context(struct perf_event *event, struct task_struct *task, int cpu) { struct perf_event_context *ctx, *clone_ctx = NULL; struct perf_cpu_context *cpuctx; struct pmu *pmu = event->pmu; unsigned long flags; int ctxn, err; if (!task) { /* Must be root to operate on a CPU event: */ if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) if (event->owner != EVENT_OWNER_KERNEL && perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) return ERR_PTR(-EACCES); /* Loading Loading @@ -7415,7 +7417,7 @@ SYSCALL_DEFINE5(perf_event_open, /* * Get the target context (task or percpu): */ ctx = find_get_context(pmu, task, event->cpu); ctx = find_get_context(event, task, event->cpu); if (IS_ERR(ctx)) { err = PTR_ERR(ctx); goto err_alloc; Loading Loading @@ -7584,7 +7586,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, account_event(event); ctx = find_get_context(event->pmu, task, cpu); ctx = find_get_context(event, task, cpu); if (IS_ERR(ctx)) { err = PTR_ERR(ctx); goto err_free; Loading