Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jun 2012 14:57:19 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236853 - head/sys/kern
Message-ID:  <201206101457.q5AEvJ9S003763@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Sun Jun 10 14:57:18 2012
New Revision: 236853
URL: http://svn.freebsd.org/changeset/base/236853

Log:
  When we are closing capability during dup2(), we want to call mq_fdclose()
  on the underlying object and not on the capability itself.
  
  Discussed with:	rwatson
  Sponsored by:	FreeBSD Foundation
  MFC after:	1 month

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Sun Jun 10 14:26:51 2012	(r236852)
+++ head/sys/kern/kern_descrip.c	Sun Jun 10 14:57:18 2012	(r236853)
@@ -922,8 +922,13 @@ do_dup(struct thread *td, int flags, int
 	 */
 	if (delfp != NULL) {
 		knote_fdclose(td, new);
-		if (delfp->f_type == DTYPE_MQUEUE)
-			mq_fdclose(td, new, delfp);
+		/*
+		 * When we're closing an fd with a capability, we need to
+		 * notify mqueue if the underlying object is of type mqueue.
+		 */
+		(void)cap_funwrap(delfp, 0, &fp);
+		if (fp->f_type == DTYPE_MQUEUE)
+			mq_fdclose(td, new, fp);
 		FILEDESC_XUNLOCK(fdp);
 		(void) closef(delfp, td);
 		if (holdleaders) {



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