PERFORCE change 91241 for review

Robert Watson rwatson at FreeBSD.org
Mon Feb 6 16:33:24 GMT 2006


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

Change 91241 by rwatson at rwatson_zoo on 2006/02/06 16:33:03

	Fix a number of bugs relating to queue handling.  Audit pipes now
	appear to work at a fairly basic level.  You can test this with
	praudit /dev/auditpipe.

Affected files ...

.. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_pipe.c#2 edit

Differences ...

==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_pipe.c#2 (text+ko) ====

@@ -183,13 +183,14 @@
 	if (ap->ap_qlen >= ap->ap_qlimit) {
 		ape_remove = TAILQ_FIRST(&ap->ap_queue);
 		TAILQ_REMOVE(&ap->ap_queue, ape_remove, ape_queue);
-		audit_pipe_entry_free(ape);
+		audit_pipe_entry_free(ape_remove);
 		ap->ap_drops++;
 		audit_pipe_drops++;
 	}
 
 	TAILQ_INSERT_TAIL(&ap->ap_queue, ape, ape_queue);
 	ap->ap_inserts++;
+	ap->ap_qlen++;
 }
 
 /*
@@ -250,6 +251,7 @@
 	if (ap == NULL)
 		return (NULL);
 	ap->ap_qlimit = AUDIT_PIPE_QLIMIT_DEFAULT;
+	TAILQ_INIT(&ap->ap_queue);
 	TAILQ_INSERT_HEAD(&audit_pipe_list, ap, ap_list);
 	audit_pipe_count++;
 	audit_pipe_ever++;
@@ -321,12 +323,13 @@
 
 	mtx_lock(&audit_pipe_mtx);
 	ap = dev->si_drv1;
-	if (ap != NULL) {
+	if (ap == NULL) {
 		ap = audit_pipe_alloc();
 		if (ap == NULL) {
 			mtx_unlock(&audit_pipe_mtx);
 			return (ENOMEM);
 		}
+		dev->si_drv1 = ap;
 	} else if (ap->ap_open) {
 		mtx_unlock(&audit_pipe_mtx);
 		return (EBUSY);
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