]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC rev. 1.198 of sys/kern/sys_pipe.c,
authorkib <kib@FreeBSD.org>
Fri, 6 Jun 2008 12:17:28 +0000 (12:17 +0000)
committerkib <kib@FreeBSD.org>
Fri, 6 Jun 2008 12:17:28 +0000 (12:17 +0000)
commit0d26e7f74b7d884f4137e622a0eac6cc4090518e
tree43b062760b0638e36719f9d2e30f5e6b4509ac5d
parentfff28a7127d8f3a1bbc3afa3aa1246c2cd4ce13f
MFC rev. 1.198 of sys/kern/sys_pipe.c,
    rev. 1.30 of sys/sys/pipe.h
AKA r179243.

Another problem caused by the knlist_cleardel() potentially dropping
PIPE_MTX().

Since the pipe_present is cleared before (potentially) sleeping, the
second thread may enter the pipeclose() for the reciprocal pipe end.
The test at the end of the pipeclose() for the pipe_present == 0 would
succeed, allowing the second thread to free the pipe memory. First
threads then accesses the freed memory after being woken up.

Properly track the closing state of the pipe in the pipe_present.
Introduce the intermediate state that marks the pipe as mostly
dismantled but might be sleeping waiting for the knote list to be
cleared. Free the pipe pair memory only when both ends pass that point.
sys/kern/sys_pipe.c
sys/sys/pipe.h