Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Avoid crashing when we do not explictly pass down a...



details:   https://anonhg.NetBSD.org/src/rev/75b924db7527
branches:  trunk
changeset: 770772:75b924db7527
user:      jym <jym%NetBSD.org@localhost>
date:      Tue Nov 01 15:39:37 2011 +0000

description:
Avoid crashing when we do not explictly pass down a CPU when creating
a kthread(9) in the LSIDL (KTHREAD_IDLE) state.

diffstat:

 sys/kern/kern_kthread.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r eb21ebe324fd -r 75b924db7527 sys/kern/kern_kthread.c
--- a/sys/kern/kern_kthread.c   Tue Nov 01 13:59:00 2011 +0000
+++ b/sys/kern/kern_kthread.c   Tue Nov 01 15:39:37 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_kthread.c,v 1.37 2011/10/29 20:11:08 jym Exp $    */
+/*     $NetBSD: kern_kthread.c,v 1.38 2011/11/01 15:39:37 jym Exp $    */
 
 /*-
  * Copyright (c) 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.37 2011/10/29 20:11:08 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.38 2011/11/01 15:39:37 jym Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -140,8 +140,12 @@
                l->l_stat = LSRUN;
                sched_enqueue(l, false);
                lwp_unlock(l);
-       } else
-               lwp_unlock_to(l, ci->ci_schedstate.spc_lwplock);
+       } else {
+               if (ci != NULL)
+                       lwp_unlock_to(l, ci->ci_schedstate.spc_lwplock);
+               else
+                       lwp_unlock(l);
+       }
        mutex_exit(proc0.p_lock);
 
        /* All done! */



Home | Main Index | Thread Index | Old Index