mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
perf machine: Fix NULL parent dereference in fork event processing
machine__process_fork_event() calls machine__findnew_thread() for the
parent thread, which can return NULL on allocation failure. The code
then dereferences parent via thread__pid(parent) without a NULL check
when validating whether the parent PID matches. The later NULL check
at thread__fork() does not prevent this earlier dereference.
Add a NULL guard before accessing the parent thread.
Fixes: 5cb73340d9 ("perf tools: Make fork event processing more resilient")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
23010160bb
commit
73ac546bd6
|
|
@ -1923,7 +1923,8 @@ int machine__process_fork_event(struct machine *machine, union perf_event *event
|
|||
* (fork) event that would have removed the thread was lost. Assume the
|
||||
* latter case and continue on as best we can.
|
||||
*/
|
||||
if (thread__pid(parent) != (pid_t)event->fork.ppid) {
|
||||
if (parent != NULL &&
|
||||
thread__pid(parent) != (pid_t)event->fork.ppid) {
|
||||
dump_printf("removing erroneous parent thread %d/%d\n",
|
||||
thread__pid(parent), thread__tid(parent));
|
||||
machine__remove_thread(machine, parent);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user