[PATCH] POSIX MQ audit memory leak fix

George C. Wilson ltcgcw at us.ibm.com
Mon Jun 12 19:41:49 UTC 2006


This is an incremental patch that addresses a memory leak in the POSIX message
queue audit patch.  It applies cleanly to Al Viro's lspp.b19 git branch.  Many
thanks to Linda Knippers for pointing out the issue.

Please apply.

 auditsc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Signed-off-by: George Wilson <ltcgcw at us.ibm.com>

--

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index ba8520d..276bde6 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1427,8 +1427,10 @@ int __audit_mq_timedreceive(mqd_t mqdes,
 		return -ENOMEM;
 
 	if (u_msg_prio != NULL) {
-		if (get_user(ax->msg_prio, u_msg_prio))
+		if (get_user(ax->msg_prio, u_msg_prio)) {
+			kfree(ax);
 			return -EFAULT;
+		}
 	} else
 		ax->msg_prio = 0;
 
-- 
George Wilson <ltcgcw at us.ibm.com>
IBM Linux Technology Center




More information about the Linux-audit mailing list