svn commit: r236853 - head/sys/kern

Pawel Jakub Dawidek pjd at FreeBSD.org
Sun Jun 10 14:57:19 UTC 2012


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) {


More information about the svn-src-all mailing list