From f15b256063cf25b45701f3141eca5bf22f1b6356 Mon Sep 17 00:00:00 2001 From: shin Date: Fri, 28 Dec 2001 02:13:14 +0000 Subject: [PATCH] check if curproc is invalid, and do panic. otherwise, we can't useful backtrace. Ex. address error in interrupt handler. --- sys/arch/mips/mips/trap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/arch/mips/mips/trap.c b/sys/arch/mips/mips/trap.c index dd4372acaa68..76de7f8afa03 100644 --- a/sys/arch/mips/mips/trap.c +++ b/sys/arch/mips/mips/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.165 2001/11/14 18:15:26 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.166 2001/12/28 02:13:14 shin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -44,7 +44,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.165 2001/11/14 18:15:26 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.166 2001/12/28 02:13:14 shin Exp $"); #include "opt_cputype.h" /* which mips CPU levels do we support? */ #include "opt_ktrace.h" @@ -318,7 +318,7 @@ trap(status, cause, vaddr, opc, frame) * It is an error for the kernel to access user space except * through the copyin/copyout routines. */ - if (p->p_addr->u_pcb.pcb_onfault == NULL) + if (p == NULL || p->p_addr->u_pcb.pcb_onfault == NULL) goto dopanic; /* check for fuswintr() or suswintr() getting a page fault */ if (p->p_addr->u_pcb.pcb_onfault == (caddr_t)fswintrberr) { @@ -410,7 +410,7 @@ trap(status, cause, vaddr, opc, frame) case T_ADDR_ERR_ST: /* misaligned access */ case T_BUS_ERR_LD_ST: /* BERR asserted to cpu */ copyfault: - if (p->p_addr->u_pcb.pcb_onfault == NULL) + if (p == NULL || p->p_addr->u_pcb.pcb_onfault == NULL) goto dopanic; frame->tf_epc = (int)p->p_addr->u_pcb.pcb_onfault; return; /* KERN */