summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-12-19 12:52:22 +0000
committerpjd <pjd@FreeBSD.org>2006-12-19 12:52:22 +0000
commit6cc6a8d100d03e9a0a7755a0375b250c3801de1b (patch)
tree12ed26ee46508ff5af9afcea433d0158acf60f16 /sys/kern/sys_pipe.c
parent73c3b50972f8ffdcfeaf5cecd9bb2a56c6c27121 (diff)
downloadFreeBSD-src-6cc6a8d100d03e9a0a7755a0375b250c3801de1b.zip
FreeBSD-src-6cc6a8d100d03e9a0a7755a0375b250c3801de1b.tar.gz
Use pipe_direct_write() optimization only if the data is in process' memory.
This fixes sending data through pipe from the kernel. Fix suggested by: rwatson
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 46a4a4f..035b4fb 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1074,8 +1074,9 @@ pipe_write(fp, uio, active_cred, flags, td)
* The direct write mechanism will detect the reader going
* away on us.
*/
- if ((uio->uio_iov->iov_len >= PIPE_MINDIRECT) &&
- (wpipe->pipe_buffer.size >= PIPE_MINDIRECT) &&
+ if (uio->uio_segflg == UIO_USERSPACE &&
+ uio->uio_iov->iov_len >= PIPE_MINDIRECT &&
+ wpipe->pipe_buffer.size >= PIPE_MINDIRECT &&
(fp->f_flag & FNONBLOCK) == 0) {
pipeunlock(wpipe);
error = pipe_direct_write(wpipe, uio);
OpenPOWER on IntegriCloud