Author: jhb
Date: Thu Jan  5 19:36:38 2012
New Revision: 229628
URL: http://svn.freebsd.org/changeset/base/229628

Log:
  MFC 228361:
  Explicitly use curthread while manipulating td_fpop during last close
  of a devfs file descriptor in devfs_close_f().  The passed in td argument
  may be NULL if the close was invoked by garbage collection of open
  file descriptors in pending control messages in the socket buffer of a
  UNIX domain socket after it was closed.

Modified:
  stable/8/sys/fs/devfs/devfs_vnops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- stable/8/sys/fs/devfs/devfs_vnops.c Thu Jan  5 19:36:23 2012        
(r229627)
+++ stable/8/sys/fs/devfs/devfs_vnops.c Thu Jan  5 19:36:38 2012        
(r229628)
@@ -548,10 +548,14 @@ devfs_close_f(struct file *fp, struct th
        int error;
        struct file *fpop;
 
-       fpop = td->td_fpop;
-       td->td_fpop = fp;
+       /*
+        * NB: td may be NULL if this descriptor is closed due to
+        * garbage collection from a closed UNIX domain socket.
+        */
+       fpop = curthread->td_fpop;
+       curthread->td_fpop = fp;
        error = vnops.fo_close(fp, td);
-       td->td_fpop = fpop;
+       curthread->td_fpop = fpop;
 
        /*
         * The f_cdevpriv cannot be assigned non-NULL value while we
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to