Skip to contentSkip to conversation

audit code

PATCH In review Roger Luethi 2 participants 2 messages Aug 10, 2004 – Aug 11, 2004 Audit

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 audit code

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.

kernel/audit.c renamed from kernel/audit.c.orig +3 -5
@@ -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);
 }
#1 lore raw
Quoted 2 lines · Roger Luethi

- 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

Signature · 2 lines
James Morris
<[email protected]>