Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Mar 2006 19:07:33 GMT
From:      Todd Miller <millert@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 93409 for review
Message-ID:  <200603161907.k2GJ7XRR097184@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=93409

Change 93409 by millert@millert_p3 on 2006/03/16 19:06:34

	Fix some apparent merge errors, primarily in error paths.

Affected files ...

.. //depot/projects/trustedbsd/sebsd/sys/kern/kern_descrip.c#17 edit

Differences ...

==== //depot/projects/trustedbsd/sebsd/sys/kern/kern_descrip.c#17 (text+ko) ====

@@ -474,6 +474,8 @@
 			    (struct vnode *)fp->f_data, mode);
 			VOP_UNLOCK((struct vnode *)fp->f_data, 0, td);
 			if (error) {
+				FILE_UNLOCK(fp);
+				FILEDESC_UNLOCK(fdp);
 				fdrop(fp, td);
 				break;
 			}
@@ -485,6 +487,8 @@
 		    fp->f_flag, (fp->f_flag & ~FCNTLFLAGS) |
 		    (FFLAGS(arg & ~O_ACCMODE) & FCNTLFLAGS));
 		if (error) {
+			FILE_UNLOCK(fp);
+			FILEDESC_UNLOCK(fdp);
 			fdrop(fp, td);
 			break;
 		}
@@ -723,6 +727,9 @@
 #ifdef MAC
 	error = mac_check_file_dup(td->td_ucred, fp, new);
 	if (error) {
+		/* we've allocated a descriptor which we won't use */
+		if (fdp->fd_ofiles[new] == NULL)
+			fdunused(fdp, new);
 		FILEDESC_UNLOCK(fdp);
 		fdrop(fp, td);
 		return (error);
@@ -1858,7 +1865,8 @@
 	for (i = 0; i <= fdp->fd_lastfile; i++) {
 #ifdef MAC
 		if (fdp->fd_ofiles[i] != NULL &&
-		    ((fdp->fd_ofileflags[i] & UF_EXCLOSE) ||
+		    (fdp->fd_ofiles[i]->f_type == DTYPE_MQUEUE ||
+		    (fdp->fd_ofileflags[i] & UF_EXCLOSE) ||
 		    mac_check_file_inherit(td->td_ucred, fdp->fd_ofiles[i]))) {
 #else
 		if (fdp->fd_ofiles[i] != NULL &&



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