audit code
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.
Signed-off-by Roger Luethi <[email protected]>
kernel/audit.c renamed from kernel/audit.c.orig +3 -5
@@ -419,7 +419,7 @@ static int audit_receive_skb(struct sk_bif (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); }
Quoted 2 lines · Roger Luethi
-
audit_receive_skbalways returns 0; therefore, the condition inaudit_receiveis always false.
If it always returns zero, then it should also be changed to void fn(...).
- James
Signature · 2 lines
James Morris <[email protected]>