perf/core: Fix potential NULL deref

commit a71ef31485 upstream.

Smatch is awesome.

Fixes: 32671e3799 ("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>
This commit is contained in:
Peter Zijlstra 2023-10-24 11:42:21 +02:00 committed by Greg Kroah-Hartman
parent fe031abf47
commit ce7c6ad176
1 changed files with 2 additions and 1 deletions

View File

@ -11059,7 +11059,8 @@ static int inherit_group(struct perf_event *parent_event,
if (IS_ERR(child_ctr))
return PTR_ERR(child_ctr);
}
leader->group_generation = parent_event->group_generation;
if (leader)
leader->group_generation = parent_event->group_generation;
return 0;
}