cvs commit: src/sys/kern uipc_syscalls.c src/sys/sys syscallsubr.h
src/sys/compat/svr4 svr4_stream.c
John Baldwin
jhb at FreeBSD.org
Thu Jul 27 19:54:45 UTC 2006
jhb 2006-07-27 19:54:42 UTC
FreeBSD src repository
Modified files:
sys/kern uipc_syscalls.c
sys/sys syscallsubr.h
sys/compat/svr4 svr4_stream.c
Log:
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.
Revision Changes Path
1.60 +24 -10 src/sys/compat/svr4/svr4_stream.c
1.234 +15 -5 src/sys/kern/uipc_syscalls.c
1.44 +2 -1 src/sys/sys/syscallsubr.h
More information about the cvs-src
mailing list