Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Jun 2002 13:26:04 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 13616 for review
Message-ID:  <200206292026.g5TKQ4lm075080@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=13616

Change 13616 by rwatson@rwatson_curry on 2002/06/29 13:25:25

	Remove use of Giant from __mac_set_proc().  Call mac_internalize()
	while not holding the proc lock, since it may allocate memory,
	which can result in sleeping.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#154 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#154 (text+ko) ====

@@ -2338,26 +2338,21 @@
 	if (error)
 		return (error);
 
+	error = mac_internalize(&intlabel, &extmac);
+	if (error)
+		return (error);
+
 	newcred = crget();
 
 	p = td->td_proc;
-	mtx_lock(&Giant);
 	PROC_LOCK(p);
 	oldcred = p->p_ucred;
 
-	error = mac_internalize(&intlabel, &extmac);
-	if (error) {
-		crfree(newcred);
-		mtx_unlock(&Giant);
-		return (error);
-	}
-
 	error = mac_cred_check_relabel_subject(oldcred, &intlabel);
 	if (error) {
 		PROC_UNLOCK(p);
 		mac_destroy_temp(&intlabel);
 		crfree(newcred);
-		mtx_unlock(&Giant);
 		return (error);
 	}
 
@@ -2368,10 +2363,8 @@
 	p->p_ucred = newcred;
 
 	PROC_UNLOCK(p);
-
 	crfree(oldcred);
 	mac_destroy_temp(&intlabel);
-	mtx_unlock(&Giant);
 	return (0);
 }
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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