PERFORCE change 70654 for review

Tom Rhodes trhodes at FreeBSD.org
Tue Feb 8 20:42:02 GMT 2005


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

Change 70654 by trhodes at trhodes_local on 2005/02/08 20:41:01

	SYSCTL_IN() before we SYSCTL_OUT()

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/security/mac_bsdextended/mac_bsdextended.c#79 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/security/mac_bsdextended/mac_bsdextended.c#79 (text+ko) ====

@@ -152,27 +152,6 @@
         if (index > MAC_BSDEXTENDED_MAXRULES)
 		return (ENOENT);
 
-	if (req->oldptr) {
-		mtx_lock(&mac_bsdextended_mtx);
-		if (index < 0 || index > rule_slots + 1) {
-			mtx_unlock(&mac_bsdextended_mtx);
-			return (ENOENT);
-			}
-
-		if (rules[index] == NULL) {
-			mtx_unlock(&mac_bsdextended_mtx);
-			return (ENOENT);
-			}
-
-		temprule = *rules[index];
-		mtx_unlock(&mac_bsdextended_mtx);
-
-		error = SYSCTL_OUT(req, &temprule, sizeof(temprule));
-
-		if (error)
-			return (error);
-	}
-
 	if (req->newptr) {
 		if (req->newlen == 0) {
 			/* printf("deletion\n"); */
@@ -213,6 +192,29 @@
 			*rules[index] = temprule;
 		}
 		mtx_unlock(&mac_bsdextended_mtx);
+		return 0;
+	}
+
+
+	if (req->oldptr) {
+		mtx_lock(&mac_bsdextended_mtx);
+		if (index < 0 || index > rule_slots + 1) {
+			mtx_unlock(&mac_bsdextended_mtx);
+			return (ENOENT);
+			}
+
+		if (rules[index] == NULL) {
+			mtx_unlock(&mac_bsdextended_mtx);
+			return (ENOENT);
+			}
+
+		temprule = *rules[index];
+		mtx_unlock(&mac_bsdextended_mtx);
+
+		error = SYSCTL_OUT(req, &temprule, sizeof(temprule));
+
+		if (error)
+			return (error);
 	}
 
 	return (0);
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