compat_modcmd: emul_netbsd_object will be NULL if no exec has taken place

between load and unload of the compat module.
This commit is contained in:
ad 2008-11-19 21:27:54 +00:00
parent 1754024de3
commit 5473327d60
1 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_mod.c,v 1.1 2008/11/19 18:36:02 ad Exp $ */
/* $NetBSD: compat_mod.c,v 1.2 2008/11/19 21:27:54 ad Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.1 2008/11/19 18:36:02 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.2 2008/11/19 21:27:54 ad Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -258,7 +258,10 @@ compat_modcmd(modcmd_t cmd, void *arg)
* is reference counted so will die eventually.
*/
rw_enter(&exec_lock, RW_WRITER);
(*emul_netbsd_object->pgops->pgo_detach)(emul_netbsd_object);
if (emul_netbsd_object != NULL) {
(*emul_netbsd_object->pgops->pgo_detach)
(emul_netbsd_object);
}
emul_netbsd.e_sigcode = NULL;
emul_netbsd.e_esigcode = NULL;
emul_netbsd.e_sigobject = NULL;