Check is active_threads is NULL before calling current_task() to
avoid dereference of null pointer.

* vm/vm_fault.c (active_threads): Check if it's NULL.

---
 vm/vm_fault.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vm/vm_fault.c b/vm/vm_fault.c
index 4b30f98..1089491 100644
--- a/vm/vm_fault.c
+++ b/vm/vm_fault.c
@@ -249,7 +249,8 @@ vm_fault_return_t vm_fault_page(first_object, first_offset,
 
        vm_stat_sample(SAMPLED_PC_VM_FAULTS_ANY);
        vm_stat.faults++;               /* needs lock XXX */
-       current_task()->faults++;
+       if (active_threads[(0)] != NULL)        
+               current_task()->faults++;
 
 /*
  *     Recovery actions
-- 
1.8.1.4


Reply via email to