Skip to contentSkip to conversation

kauditd thread API fixes

PATCH In review Jeff Garzik 2 participants 2 messages Oct 1, 2006 Audit

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kauditd thread API fixes

Kill the "function should return a value" warning, and use the standard mechanism for deciding when a thread should stop.

---

Given the security-sensitive nature of the audit function, _perhaps_ the omission of kthread_should_stop() was intentional. If so, it at least deserves a comment. But I think this is more correct.

kernel/audit.c +4 -2
index f9889ee..b9146b1 100644
@@ -340,7 +340,7 @@ static int kauditd_thread(void *dummy)
 {
 	struct sk_buff *skb;
 
-	while (1) {
+	do {
 		skb = skb_dequeue(&audit_skb_queue);
 		wake_up(&audit_backlog_wait);
 		if (skb) {
@@ -368,7 +368,9 @@ static int kauditd_thread(void *dummy)
 			__set_current_state(TASK_RUNNING);
 			remove_wait_queue(&kauditd_wait, &wait);
 		}
-	}
+	} while (!kthread_should_stop());
+
+	return 0;
 }
 
 int audit_send_list(void *_dest)
#1 lore raw
Quoted 26 lines · On Sun, 1 Oct 2006 08:30:45 -0400 Jeff Garzik <[email protected]> wrote:

Kill the "function should return a value" warning, and use the standard mechanism for deciding when a thread should stop.

---

Given the security-sensitive nature of the audit function, _perhaps_ the omission of kthread_should_stop() was intentional. If so, it at least deserves a comment. But I think this is more correct.

kernel/audit.c +1 -1
index f9889ee..b9146b1 100644
@@ -340,7 +340,7 @@ static int kauditd_thread(void *dummy)
 {
 	struct sk_buff *skb;
 
-	while (1) {
+	do {
 		skb = skb_dequeue(&audit_skb_queue);
 		wake_up(&audit_backlog_wait);
 		if (skb) {

kernel/audit.c static int kauditd_thread(void *dummy) · line 376

Quoted 10 lines
kernel/audit.c +3 -1
@@ -368,7 +368,9 @@ static int kauditd_thread(void *dummy)
 			__set_current_state(TASK_RUNNING);
 			remove_wait_queue(&kauditd_wait, &wait);
 		}
-	}
+	} while (!kthread_should_stop());
+
+	return 0;
 }
 
 int audit_send_list(void *_dest)

I've had a basically-identical patch in -mm for a few months. Sent to viro once or twice, nothing happened, gave up. I'll re-add it to the maintainer-spamming-list.