Skip to contentSkip to conversation

: Increase skb->truesize in audit_expand

AUDIT Applied Herbert Xu 3 participants 3 messages Jan 28, 2008 – Jan 29, 2008 Audit

lore
Share & tools
lore

Herbert Xu

author
#0 lore raw

Hi:

[AUDIT]: Increase skb->truesize in audit_expand

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.

Cheers,

Signature · 5 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
kernel/audit.c +7 -3
index f93c271..801c946 100644
@@ -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;
 }
 
 /*
Acked-by
#1 lore raw
Quoted 10 lines · Herbert Xu

Hi:

[AUDIT]: Increase skb->truesize in audit_expand

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.

Quoted 4 lines

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.

(Candidate for stable ?)

- James

Signature · 1 line
James Morris <[email protected]>
Applied
#2 lore raw

From: James Morris <[email protected]>
Date: Tue, 29 Jan 2008 01:13:03 +1100 (EST)

Quoted 15 lines · Herbert Xu
Quoted 14 lines

Hi:

[AUDIT]: Increase skb->truesize in audit_expand

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.

Quoted 6 lines
Quoted 1 line

(Candidate for stable ?)

Applied, and yes I'll queue this up for -stable.