]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[AUDIT]: Increase skb->truesize in audit_expand
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 29 Jan 2008 04:47:09 +0000 (20:47 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Feb 2008 03:27:08 +0000 (19:27 -0800)
The recent UDP patch exposed this bug in the audit code.  It
was calling pskb_expand_head without increasing skb->truesize.
The caller of pskb_expand_head needs to do so because that function
is designed to be called in places where truesize is already fixed
and therefore it doesn't update its value.

Because the audit system is using it in a place where the truesize
has not yet been fixed, it needs to update its value manually.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/audit.c

index f93c2713017da93b90e5e8d67d029c1b754ffaa0..801c946dd24b639520e6037b63dd96860c2e60d9 100644 (file)
@@ -1200,13 +1200,17 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
 static inline int audit_expand(struct audit_buffer *ab, int extra)
 {
        struct sk_buff *skb = ab->skb;
-       int ret = pskb_expand_head(skb, skb_headroom(skb), extra,
-                                  ab->gfp_mask);
+       int oldtail = skb_tailroom(skb);
+       int ret = pskb_expand_head(skb, 0, extra, ab->gfp_mask);
+       int newtail = skb_tailroom(skb);
+
        if (ret < 0) {
                audit_log_lost("out of memory in audit_expand");
                return 0;
        }
-       return skb_tailroom(skb);
+
+       skb->truesize += newtail - oldtail;
+       return newtail;
 }
 
 /*