summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1997-05-16 19:11:35 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1997-05-16 19:11:35 +0000
commita019761a9d1cef4c815819554ce12675287f597a (patch)
tree11d61d6ce2028b643c7e67bf5829304a3a61c574
parentd335dfd153bb45e98127e7c51d71f2e29d13e4de (diff)
Some buffers have NULL in b_proc when passed to vndstrategy,
however ffs_write needs a proc pointer in the uio structure, so fill in &proc0 to avoid a NULL deref
-rw-r--r--sys/dev/vnd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index b43da1c2db7..5957096cac4 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.9 1997/05/14 15:32:46 niklas Exp $ */
+/* $OpenBSD: vnd.c,v 1.10 1997/05/16 19:11:34 niklas Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -422,7 +422,14 @@ vndstrategy(bp)
auio.uio_iovcnt = 1;
auio.uio_offset = dbtob(bp->b_blkno);
auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_procp = bp->b_proc;
+
+ /*
+ * It seems we can get NULL proc pointers in bp->b_proc
+ * that causes a quota check in VOP_WRITE to fault.
+ * In that case cahalk it up on proc0 instead, for
+ * safety.
+ */
+ auio.uio_procp = (bp->b_proc ? bp->b_proc : &proc0);
VOP_LOCK(vnd->sc_vp);
vnd->sc_flags |= VNF_BUSY;