Bladeren bron

Kernel: Avoid null dereference in sys$profiling_disable()

If we can't create a profiling coredump object, we shouldn't try to
call write() on it.
Andreas Kling 4 jaren geleden
bovenliggende
commit
4befc2c282
1 gewijzigde bestanden met toevoegingen van 4 en 2 verwijderingen
  1. 4 2
      Kernel/Syscalls/profiling.cpp

+ 4 - 2
Kernel/Syscalls/profiling.cpp

@@ -60,8 +60,10 @@ int Process::sys$profiling_disable(pid_t pid)
     // We explicitly unlock here because we can't hold the lock when writing the coredump VFS
     lock.unlock();
 
-    auto coredump = CoreDump::create(*process, String::formatted("/tmp/profiler_coredumps/{}", pid));
-    coredump->write();
+    if (auto coredump = CoreDump::create(*process, String::formatted("/tmp/profiler_coredumps/{}", pid)))
+        coredump->write();
+    else
+        dbgln("Unable to create profiler coredump for PID {}", pid);
     return 0;
 }