diff options
author | Peter Zijlstra <peterz@infradead.org> | 2023-10-24 11:42:21 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-11-02 09:35:32 +0100 |
commit | 8b8cde8ebb872a6b62aee81869ad235a5eb251d9 (patch) | |
tree | a3223807999657f7128a93d3adfcbe4652a477eb | |
parent | 5e232f2205f201dd38187adf62f5cb14b372284b (diff) | |
download | linux-stable-8b8cde8ebb872a6b62aee81869ad235a5eb251d9.tar.gz linux-stable-8b8cde8ebb872a6b62aee81869ad235a5eb251d9.tar.bz2 linux-stable-8b8cde8ebb872a6b62aee81869ad235a5eb251d9.zip |
perf/core: Fix potential NULL deref
commit a71ef31485bb51b846e8db8b3a35e432cc15afb5 upstream.
Smatch is awesome.
Fixes: 32671e3799ca ("perf: Disallow mis-matched inherited group reads")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | kernel/events/core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 2b8315a948a2..8f2b9d8b9150 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -13293,7 +13293,8 @@ static int inherit_group(struct perf_event *parent_event, !perf_get_aux_event(child_ctr, leader)) return -EINVAL; } - leader->group_generation = parent_event->group_generation; + if (leader) + leader->group_generation = parent_event->group_generation; return 0; } |