audit-related slab memory leak in recent -mm kernels?

Dustin Kirkland dustin.kirkland at us.ibm.com
Fri Feb 24 20:33:19 UTC 2006


Updated patch for Al's sake.  Assuming no other arguments, would you
please apply, Al?


:-Dustin

--- a/kernel/auditsc.c	2006-02-24 14:28:39.000000000 -0600
+++ b/kernel/auditsc.c	2006-02-24 14:30:25.000000000 -0600
@@ -380,7 +380,6 @@ static inline void audit_free_names(stru
 			printk(KERN_ERR "names[%d] = %p = %s\n", i,
 			       context->names[i].name,
 			       context->names[i].name ?: "(null)");
-			kfree(context->names[i].ctx);
 		}
 		dump_stack();
 		return;
@@ -391,9 +390,13 @@ static inline void audit_free_names(stru
 	context->ino_count  = 0;
 #endif
 
-	for (i = 0; i < context->name_count; i++)
+	for (i = 0; i < context->name_count; i++) {
+		char *p = context->names[i].ctx;
+		context->names[i].ctx = NULL;
+		kfree(p);
 		if (context->names[i].name)
 			__putname(context->names[i].name);
+	}
 	context->name_count = 0;
 	if (context->pwd)
 		dput(context->pwd);





More information about the Linux-audit mailing list