pipe_direct_write: Fix mismatched pipelock/unlock

If a signal is caught in pipelock, causing it to fail, pipe_direct_write
should not try to pipeunlock.

Reported by:	pho
Differential Revision:	https://reviews.freebsd.org/D3069
Reviewed by:	kib
Approved by:	markj (mentor)
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
cem 2015-07-13 17:45:22 +00:00
parent 4067f24f01
commit 08bb34a547

View File

@ -946,9 +946,10 @@ pipe_direct_write(wpipe, uio)
retry: retry:
PIPE_LOCK_ASSERT(wpipe, MA_OWNED); PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
error = pipelock(wpipe, 1); error = pipelock(wpipe, 1);
if (wpipe->pipe_state & PIPE_EOF) if (error != 0)
goto error1;
if ((wpipe->pipe_state & PIPE_EOF) != 0) {
error = EPIPE; error = EPIPE;
if (error) {
pipeunlock(wpipe); pipeunlock(wpipe);
goto error1; goto error1;
} }