public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roger Luethi <rl@hellgate.ch>
To: faith@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] audit code
Date: Tue, 10 Aug 2004 23:12:45 +0200	[thread overview]
Message-ID: <20040810211245.GA7646@k3.hellgate.ch> (raw)

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);
 }


             reply	other threads:[~2004-08-10 21:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-10 21:12 Roger Luethi [this message]
2004-08-11  2:04 ` [PATCH] audit code James Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040810211245.GA7646@k3.hellgate.ch \
    --to=rl@hellgate.ch \
    --cc=faith@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox