Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jan 2012 19:36:38 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r229628 - stable/8/sys/fs/devfs
Message-ID:  <201201051936.q05Jactn051736@svn.freebsd.org>

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



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