Skip to contentSkip to conversation

this mutex_lock is miss used

PATCH In review Zhenwen Xu 2 participants 2 messages Apr 19, 2009 Audit

lore
Share & tools
lore

Zhenwen Xu

author
#0 lore raw

PATCH 1/1 this mutex_lock is miss used

This mutex_lock and mutex_unlock has no use in such way. It should be like this way:

---
 kernel/audit.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
kernel/audit.c +1 -2
index 9442c35..3176ffa 100644
@@ -485,12 +485,11 @@ int audit_send_list(void *_dest)
 
 	/* wait for parent to finish and send an ACK */
 	mutex_lock(&audit_cmd_mutex);
-	mutex_unlock(&audit_cmd_mutex);
-
 	while ((skb = __skb_dequeue(&dest->q)) != NULL)
 		netlink_unicast(audit_sock, skb, pid, 0);
 
 	kfree(dest);
+	mutex_unlock(&audit_cmd_mutex);
 
 	return 0;
 }
Signature · 7 lines
1.5.6.5

-- 
---------------------------------
Zhenwen Xu - Open and Free
Home Page:	http://zhwen.org
My Studio:	http://dim4.cn
#1 lore raw
Quoted 2 lines · Zhenwen Xu

This mutex_lock and mutex_unlock has no use in such way.

Incorrect. They delay sending response until we are out of audit_receive().

Quoted 1 line

It should be like this way:

No, it should not. In particular, it should *NOT* be held while sending these packets.