diff options
author | jhb <jhb@FreeBSD.org> | 2006-07-27 19:54:41 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-07-27 19:54:41 +0000 |
commit | 6b46a69f12998c9846877c8a8fb21b23651044c1 (patch) | |
tree | 888dfdd2cf28ec9b345b25942d3f972771ea3c2c /etc | |
parent | 39705fd8c65be4ed1f0d045f08156d17f4e05c5a (diff) | |
download | FreeBSD-src-6b46a69f12998c9846877c8a8fb21b23651044c1.zip FreeBSD-src-6b46a69f12998c9846877c8a8fb21b23651044c1.tar.gz |
Fix a file descriptor race I reintroduced when I split accept1() up into
kern_accept() and accept1(). If another thread closed the new file
descriptor and the first thread later got an error trying to copyout the
socket address, then it would attempt to close the wrong file object. To
fix, add a struct file ** argument to kern_accept(). If it is non-NULL,
then on success kern_accept() will store a pointer to the new file object
there and not release any of the references. It is up to the calling code
to drop the references appropriately (including a call to fdclose() in case
of error to safely handle the aforementioned race). While I'm at it, go
ahead and fix the svr4 streams code to not leak the accept fd if it gets an
error trying to copyout the streams structures.
Diffstat (limited to 'etc')
0 files changed, 0 insertions, 0 deletions