Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 cpu_lwp_free() can be called with (l != cur...



details:   https://anonhg.NetBSD.org/src/rev/e6905fa87a44
branches:  trunk
changeset: 1006725:e6905fa87a44
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Jan 25 15:38:24 2020 +0000

description:
cpu_lwp_free() can be called with (l != curlwp) in error paths, so don't
detonate.

diffstat:

 sys/arch/x86/x86/vm_machdep.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 80d9358c8e60 -r e6905fa87a44 sys/arch/x86/x86/vm_machdep.c
--- a/sys/arch/x86/x86/vm_machdep.c     Sat Jan 25 15:12:47 2020 +0000
+++ b/sys/arch/x86/x86/vm_machdep.c     Sat Jan 25 15:38:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.40 2020/01/12 13:01:11 ad Exp $       */
+/*     $NetBSD: vm_machdep.c,v 1.41 2020/01/25 15:38:24 ad Exp $       */
 
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.40 2020/01/12 13:01:11 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.41 2020/01/25 15:38:24 ad Exp $");
 
 #include "opt_mtrr.h"
 
@@ -237,12 +237,16 @@
 /*
  * cpu_lwp_free is called from exit() to let machine-dependent
  * code free machine-dependent resources.  Note that this routine
- * must not block.
+ * must not block.  NB: this may be called with l != curlwp in
+ * error paths.
  */
 void
 cpu_lwp_free(struct lwp *l, int proc)
 {
 
+       if (l != curlwp)
+               return;
+
        /* Abandon the FPU state. */
        fpu_lwp_abandon(l);
 



Home | Main Index | Thread Index | Old Index