This fixes uninitialised timeout structures
leading to the .set field being non-zero thus reset_timeout
is attempted to be called on a timeout not yet in the wheel.

Reported by Brent Baccala
---
 i386/i386at/ioapic.c | 1 +
 kern/sched_prim.c    | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/i386/i386at/ioapic.c b/i386/i386at/ioapic.c
index 6d9e6db9..4b4c1282 100644
--- a/i386/i386at/ioapic.c
+++ b/i386/i386at/ioapic.c
@@ -231,6 +231,7 @@ timer_measure_10x_apic_hz(void)
     timeout_data_t tmp_timer;
     tmp_timer.fcn = timer_expiry_callback;
     tmp_timer.param = (void *)&done;
+    tmp_timer.set = 0;
 
     printf("timer calibration...");
 
diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index 5aa65811..605f7001 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -167,6 +167,7 @@ void sched_init(void)
 {
        recompute_priorities_timer.fcn = recompute_priorities;
        recompute_priorities_timer.param = NULL;
+       recompute_priorities_timer.set = 0;
 
        min_quantum = MIN_QUANTUM;
        wait_queue_init();
@@ -221,8 +222,10 @@ void thread_timeout_setup(
 {
        thread->timer.fcn = thread_timeout;
        thread->timer.param = thread;
+       thread->timer.set = 0;
        thread->depress_timer.fcn = (void (*)(void*))thread_depress_timeout;
        thread->depress_timer.param = thread;
+       thread->depress_timer.set = 0;
 }
 
 /*
-- 
2.51.0



Reply via email to