public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] audit code
@ 2004-08-10 21:12 Roger Luethi
  2004-08-11  2:04 ` James Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Luethi @ 2004-08-10 21:12 UTC (permalink / raw)
  To: faith; +Cc: linux-kernel

Two things that struck me as odd when reading parts of audit.c:

- audit_receive_skb calls netlink_ack with positive errnos; AFAICT
  they should be negative, though (netlink(7)).

- audit_receive_skb always returns 0; therefore, the condition
  in audit_receive is always false.

Signed-off-by: Roger Luethi <rl@hellgate.ch>

--- 2.6-mm/kernel/audit.c.orig	2004-08-10 20:49:07.407311613 +0200
+++ 2.6-mm/kernel/audit.c	2004-08-10 20:54:39.810234132 +0200
@@ -419,7 +419,7 @@ static int audit_receive_skb(struct sk_b
 		if (rlen > skb->len)
 			rlen = skb->len;
 		if ((err = audit_receive_msg(skb, nlh))) {
-			netlink_ack(skb, nlh, -err);
+			netlink_ack(skb, nlh, err);
 		} else if (nlh->nlmsg_flags & NLM_F_ACK)
 			netlink_ack(skb, nlh, 0);
 		skb_pull(skb, rlen);
@@ -437,10 +437,8 @@ static void audit_receive(struct sock *s
 
 				/* FIXME: this must not cause starvation */
 	while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
-		if (audit_receive_skb(skb) && skb->len)
-			skb_queue_head(&sk->sk_receive_queue, skb);
-		else
-			kfree_skb(skb);
+		audit_receive_skb(skb);
+		kfree_skb(skb);
 	}
 	up(&audit_netlink_sem);
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] audit code
  2004-08-10 21:12 [PATCH] audit code Roger Luethi
@ 2004-08-11  2:04 ` James Morris
  0 siblings, 0 replies; 2+ messages in thread
From: James Morris @ 2004-08-11  2:04 UTC (permalink / raw)
  To: Roger Luethi; +Cc: faith, linux-kernel

On Tue, 10 Aug 2004, Roger Luethi wrote:

> - audit_receive_skb always returns 0; therefore, the condition
>   in audit_receive is always false.

If it always returns zero, then it should also be changed to void fn(...).


- James
-- 
James Morris
<jmorris@redhat.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-11  2:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-10 21:12 [PATCH] audit code Roger Luethi
2004-08-11  2:04 ` James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox