From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 14:57:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97F48106564A; Sun, 10 Jun 2012 14:57:19 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8306C8FC1A; Sun, 10 Jun 2012 14:57:19 +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 q5AEvJjt003765; Sun, 10 Jun 2012 14:57:19 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AEvJ9S003763; Sun, 10 Jun 2012 14:57:19 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206101457.q5AEvJ9S003763@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 10 Jun 2012 14:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236853 - head/sys/kern 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: Sun, 10 Jun 2012 14:57:19 -0000 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) {