Add a KASSERT for p->p_wchan == NULL to setrunqueue()
authorclaudio <claudio@openbsd.org>
Tue, 19 Sep 2023 11:31:51 +0000 (11:31 +0000)
committerclaudio <claudio@openbsd.org>
Tue, 19 Sep 2023 11:31:51 +0000 (11:31 +0000)
There is the same check in sched_chooseproc() but that is too late
to know where the bad insertion into the runqueue was done.
OK mpi@

sys/kern/kern_sched.c

index 8d043f5..c4a00ef 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kern_sched.c,v 1.91 2023/09/14 22:07:11 cheloha Exp $ */
+/*     $OpenBSD: kern_sched.c,v 1.92 2023/09/19 11:31:51 claudio Exp $ */
 /*
  * Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
  *
@@ -268,6 +268,7 @@ setrunqueue(struct cpu_info *ci, struct proc *p, uint8_t prio)
 
        KASSERT(ci != NULL);
        SCHED_ASSERT_LOCKED();
+       KASSERT(p->p_wchan == NULL);
 
        p->p_cpu = ci;
        p->p_stat = SRUN;