From 8cb43731419823c76deec4e0793d1bb6967737bd Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Tue, 11 May 1999 11:03:18 +0000 Subject: [PATCH] During probe, the page lockdown code in dpt_control.c does some bad math: it does not handle page-boundary conditions, and will not end up mapping all of the requested addresses. This will cause a panic: page fault during probe on some systems. I have a machine that will panic every time (when using the dpt driver) on kernel probe when there are 5 drives installed. When there are 4 drives, it is fine. Fix is to always allocate/deallocate an extra page. There is also a bonus splx() fix on an early error return. Submitted by: Mark J. Taylor PR: 9367 --- sys/dev/dpt/dpt_control.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/dpt/dpt_control.c b/sys/dev/dpt/dpt_control.c index b28fb672d1c..e117b998b39 100644 --- a/sys/dev/dpt/dpt_control.c +++ b/sys/dev/dpt/dpt_control.c @@ -36,7 +36,7 @@ * future. */ -#ident "$Id: dpt_control.c,v 1.9 1998/09/15 08:33:31 gibbs Exp $" +#ident "$Id: dpt_control.c,v 1.10 1998/12/04 22:54:45 archie Exp $" #include "opt_dpt.h" @@ -150,6 +150,7 @@ dpt_physmap(u_int32_t req_paddr, vm_size_t req_size) if (va == (vm_offset_t) 0) return (va); + size += PAGE_SIZE; for (ndx = 0; ndx < size; ndx += PAGE_SIZE) { pmap_kenter(va + ndx, paddr + ndx); invltlb(); @@ -161,7 +162,7 @@ dpt_physmap(u_int32_t req_paddr, vm_size_t req_size) /* * Release virtual space allocated by physmap We ASSUME that the correct - * srart address and the correct LENGTH are given. + * start address and the correct LENGTH are given. * * Disaster will follow if these assumptions are false! */ @@ -419,6 +420,7 @@ dpt_open(dev_t dev, int flags, int fmt, struct proc * p) printf("dpt%d: Failed to obtain an I/O buffer\n", minor_no & ~SCSI_CONTROL_MASK); #endif + splx(ospl); return (EINVAL); } }