git: 60bae7ec045a - main - mac_lomac: whack giant usage

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Tue, 15 Nov 2022 14:32:10 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=60bae7ec045a8af6e9c51ac080e51948fe84bb4d

commit 60bae7ec045a8af6e9c51ac080e51948fe84bb4d
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-11-15 14:31:41 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-11-15 14:31:41 +0000

    mac_lomac: whack giant usage
    
    It does not protect anything, the code looks dodgy regardless.
---
 sys/security/mac_lomac/mac_lomac.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c
index 5efcfe385cd5..dffd06d964a2 100644
--- a/sys/security/mac_lomac/mac_lomac.c
+++ b/sys/security/mac_lomac/mac_lomac.c
@@ -2248,12 +2248,6 @@ lomac_thread_userret(struct thread *td)
 		dodrop = 0;
 		mtx_unlock(&subj->mtx);
 		newcred = crget();
-		/*
-		 * Prevent a lock order reversal in mac_proc_vm_revoke;
-		 * ideally, the other user of subj->mtx wouldn't be holding
-		 * Giant.
-		 */
-		mtx_lock(&Giant);
 		PROC_LOCK(p);
 		mtx_lock(&subj->mtx);
 		/*
@@ -2275,7 +2269,6 @@ lomac_thread_userret(struct thread *td)
 		PROC_UNLOCK(p);
 		if (dodrop)
 			mac_proc_vm_revoke(curthread);
-		mtx_unlock(&Giant);
 	} else {
 		mtx_unlock(&subj->mtx);
 	}