]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
perf: Fix use-after-free in error path
authorPeter Zijlstra <peterz@infradead.org>
Mon, 19 Dec 2022 14:40:04 +0000 (15:40 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 27 Dec 2022 11:44:01 +0000 (12:44 +0100)
commita551844e345ba2a1c533dee4b55cb0efddb1bcda
treeb9e9745bfecbd4c4739d4511fc76802bbae2bb4c
parent08245672cdc6505550d1a5020603b0a8d4a6dcc7
perf: Fix use-after-free in error path

The syscall error path has a use-after-free; put_pmu_ctx() will
reference ctx, therefore we must ensure ctx is destroyed after pmu_ctx
is.

Fixes: bd2756811766 ("perf: Rewrite core context handling")
Reported-by: syzbot+b8e8c01c8ade4fe6e48f@syzkaller.appspotmail.com
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Chengming Zhou <zhouchengming@bytedance.com>
Link: https://lkml.kernel.org/r/Y6B3xEgkbmFUCeni@hirez.programming.kicks-ass.net
kernel/events/core.c