From owner-p4-projects@FreeBSD.ORG Mon Jan 9 01:05:02 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 96BF816A423; Mon, 9 Jan 2006 01:05:01 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F21F16A420 for ; Mon, 9 Jan 2006 01:05:01 +0000 (GMT) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E2E6943D46 for ; Mon, 9 Jan 2006 01:04:59 +0000 (GMT) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k0914xdM082223 for ; Mon, 9 Jan 2006 01:04:59 GMT (envelope-from csjp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k0914xmP082220 for perforce@freebsd.org; Mon, 9 Jan 2006 01:04:59 GMT (envelope-from csjp@freebsd.org) Date: Mon, 9 Jan 2006 01:04:59 GMT Message-Id: <200601090104.k0914xmP082220@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to csjp@freebsd.org using -f From: "Christian S.J. Peron" To: Perforce Change Reviews Cc: Subject: PERFORCE change 89390 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2006 01:05:02 -0000 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) {