PERFORCE change 93409 for review

Todd Miller millert at FreeBSD.org
Thu Mar 16 19:15:42 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=93409

Change 93409 by millert at 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 &&


More information about the trustedbsd-cvs mailing list