From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:36:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ACF6106566B; Thu, 5 Jan 2012 19:36:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 194228FC0C; Thu, 5 Jan 2012 19:36:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05JaNr4051696; Thu, 5 Jan 2012 19:36:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JaNnX051694; Thu, 5 Jan 2012 19:36:23 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051936.q05JaNnX051694@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:36:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229627 - stable/9/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 19:36:24 -0000 Author: jhb Date: Thu Jan 5 19:36:23 2012 New Revision: 229627 URL: http://svn.freebsd.org/changeset/base/229627 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/9/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Thu Jan 5 19:18:41 2012 (r229626) +++ stable/9/sys/fs/devfs/devfs_vnops.c Thu Jan 5 19:36:23 2012 (r229627) @@ -600,10 +600,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