diff options
author | pjd <pjd@FreeBSD.org> | 2012-06-10 14:57:18 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2012-06-10 14:57:18 +0000 |
commit | 23c7c80ef5754d3744c0e192b9e37c1761cc0305 (patch) | |
tree | c8535aa7e638795135ffa59431f17e1b64c6b227 /sys/kern/kern_descrip.c | |
parent | 0af45322c0d6dd97ee785a77cf4b6a28ced2770c (diff) | |
download | FreeBSD-src-23c7c80ef5754d3744c0e192b9e37c1761cc0305.zip FreeBSD-src-23c7c80ef5754d3744c0e192b9e37c1761cc0305.tar.gz |
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
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 0739ccd..6444e5d 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -922,8 +922,13 @@ do_dup(struct thread *td, int flags, int old, int new, */ 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) { |