Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 2006 01:04:59 GMT
From:      "Christian S.J. Peron" <csjp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 89390 for review
Message-ID:  <200601090104.k0914xmP082220@repoman.freebsd.org>

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

Change 89390 by csjp@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) {



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