Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jul 2006 19:54:42 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/kern uipc_syscalls.c src/sys/sys syscallsubr.h src/sys/compat/svr4 svr4_stream.c
Message-ID:  <200607271954.k6RJsgin014378@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607271954.k6RJsgin014378>