diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-03-11 07:23:29 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-03-11 09:41:49 +0100 |
commit | eb1d30ad351ed18116acbd8b224ed8e07d6627d0 (patch) | |
tree | 47c9f81fad439f37a7078558ce01e5f64a6e3416 /freebsd/sys/kern | |
parent | tcpdump: Move static variables to special section (diff) | |
download | rtems-libbsd-eb1d30ad351ed18116acbd8b224ed8e07d6627d0.tar.bz2 |
Update to FreeBSD stable/12 2019-03-11
Git mirror commit 735fe7a0a5f9c265040e2e6654a01b081d6354f1.
Diffstat (limited to 'freebsd/sys/kern')
-rwxr-xr-x | freebsd/sys/kern/sys_pipe.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/freebsd/sys/kern/sys_pipe.c b/freebsd/sys/kern/sys_pipe.c index 050d63a4..817190b7 100755 --- a/freebsd/sys/kern/sys_pipe.c +++ b/freebsd/sys/kern/sys_pipe.c @@ -2099,15 +2099,19 @@ static int filt_pipewrite(struct knote *kn, long hint) { struct pipe *wpipe; - + + /* + * If this end of the pipe is closed, the knote was removed from the + * knlist and the list lock (i.e., the pipe lock) is therefore not held. + */ wpipe = kn->kn_hook; - PIPE_LOCK_ASSERT(wpipe, MA_OWNED); if (wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF)) { kn->kn_data = 0; kn->kn_flags |= EV_EOF; return (1); } + PIPE_LOCK_ASSERT(wpipe, MA_OWNED); kn->kn_data = (wpipe->pipe_buffer.size > 0) ? (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) : PIPE_BUF; if (wpipe->pipe_state & PIPE_DIRECTW) |