Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Feb 2005 20:42:02 GMT
From:      Tom Rhodes <trhodes@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 70654 for review
Message-ID:  <200502082042.j18Kg2tU082033@repoman.freebsd.org>

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

Change 70654 by trhodes@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);



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