Module Name: src Committed By: ad Date: Sat Jan 25 15:38:24 UTC 2020
Modified Files: src/sys/arch/x86/x86: vm_machdep.c Log Message: cpu_lwp_free() can be called with (l != curlwp) in error paths, so don't detonate. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/x86/x86/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/x86/vm_machdep.c diff -u src/sys/arch/x86/x86/vm_machdep.c:1.40 src/sys/arch/x86/x86/vm_machdep.c:1.41 --- src/sys/arch/x86/x86/vm_machdep.c:1.40 Sun Jan 12 13:01:11 2020 +++ src/sys/arch/x86/x86/vm_machdep.c Sat Jan 25 15:38:24 2020 @@ -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_fork(struct lwp *l1, struct lwp /* * 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);