diff options
author | dyson <dyson@FreeBSD.org> | 1996-02-05 05:17:15 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1996-02-05 05:17:15 +0000 |
commit | 01c2e97c89f31e49b948ea41edbc44accd5be67b (patch) | |
tree | 02bb1dc56bee57b0a8e5aeb33bf616638bbaeb30 /sys/kern | |
parent | 15f25db6c3044ef7cdee42f84c295e4ba5ac0f82 (diff) | |
download | FreeBSD-src-01c2e97c89f31e49b948ea41edbc44accd5be67b.zip FreeBSD-src-01c2e97c89f31e49b948ea41edbc44accd5be67b.tar.gz |
Kva space allocated for direct buffer wasn't quite big enough. The
system can panic easily without this patch.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/sys_pipe.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index a337c02..0f2d2de 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -18,7 +18,7 @@ * 5. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: sys_pipe.c,v 1.2 1996/01/29 02:57:33 dyson Exp $ + * $Id: sys_pipe.c,v 1.6 1996/02/04 22:09:05 dyson Exp $ */ #ifndef OLD_PIPE @@ -492,9 +492,13 @@ pipe_build_write_buffer(wpipe, uio) * and map the buffer */ if (wpipe->pipe_map.kva == 0) { + /* + * We need to allocate space for an extra page because the + * address range might (will) span pages at times. + */ wpipe->pipe_map.kva = kmem_alloc_pageable(kernel_map, - wpipe->pipe_buffer.size); - amountpipekva += wpipe->pipe_buffer.size; + wpipe->pipe_buffer.size + PAGE_SIZE); + amountpipekva += wpipe->pipe_buffer.size + PAGE_SIZE; } pmap_qenter(wpipe->pipe_map.kva, wpipe->pipe_map.ms, wpipe->pipe_map.npages); @@ -527,8 +531,8 @@ struct pipe *wpipe; vm_offset_t kva = wpipe->pipe_map.kva; wpipe->pipe_map.kva = 0; kmem_free(kernel_map, kva, - wpipe->pipe_buffer.size); - amountpipekva -= wpipe->pipe_buffer.size; + wpipe->pipe_buffer.size + PAGE_SIZE); + amountpipekva -= wpipe->pipe_buffer.size + PAGE_SIZE; } } for (i=0;i<wpipe->pipe_map.npages;i++) @@ -971,10 +975,10 @@ pipeclose(cpipe) cpipe->pipe_buffer.size); } if (cpipe->pipe_map.kva) { - amountpipekva -= cpipe->pipe_buffer.size; + amountpipekva -= cpipe->pipe_buffer.size + PAGE_SIZE; kmem_free(kernel_map, cpipe->pipe_map.kva, - cpipe->pipe_buffer.size); + cpipe->pipe_buffer.size + PAGE_SIZE); } free(cpipe, M_TEMP); } |