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) {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to