PERFORCE change 89390 for review

Christian S.J. Peron csjp at FreeBSD.org
Mon Jan 9 01:04:59 GMT 2006


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

Change 89390 by csjp at csjp_xor on 2006/01/09 01:04:12

	Do not call crget() while holding the NFSD lock. This change moves the
	ucred allocation before we pickup the lock, and adjusts any logic to
	help ensure that we free the ucred in the event we do not need it.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/nfsserver/nfs_srvsock.c#20 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/nfsserver/nfs_srvsock.c#20 (text+ko) ====

@@ -368,7 +368,6 @@
 		 * extensible data in the ucred, and worse.  This wasn't
 		 * fixed before FreeBSD 5.3-RELEASE.
 		 */
-		nd->nd_cr = crget();
 		nd->nd_cr->cr_uid = nd->nd_cr->cr_ruid =
 		    nd->nd_cr->cr_svuid = fxdr_unsigned(uid_t, *tl++);
 		nd->nd_cr->cr_groups[0] = nd->nd_cr->cr_rgid =
@@ -401,6 +400,10 @@
 	} else {
 		nd->nd_repstat = (NFSERR_AUTHERR | AUTH_REJECTCRED);
 		nd->nd_procnum = NFSPROC_NOOP;
+		if (nd->nd_cr != NULL) {
+			crfree(nd->nd_cr);
+			nd->nd_cr = NULL;
+		}
 		return (0);
 	}
 
@@ -714,11 +717,11 @@
 	NFSD_UNLOCK();
 	MALLOC(nd, struct nfsrv_descript *, sizeof (struct nfsrv_descript),
 		M_NFSRVDESC, M_WAITOK);
+	nd->nd_cr = crget();
 	NFSD_LOCK();
 	nd->nd_md = nd->nd_mrep = m;
 	nd->nd_nam2 = nam;
 	nd->nd_dpos = mtod(m, caddr_t);
-	nd->nd_cr = NULL;
 	error = nfs_getreq(nd, nfsd, TRUE);
 	if (error) {
 		if (nam) {
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list