linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [AUDIT]: Increase skb->truesize in audit_expand
@ 2008-01-28 11:10 Herbert Xu
  2008-01-28 14:13 ` James Morris
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2008-01-28 11:10 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton, David S. Miller,
	Linux Kernel Mailing List

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.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/kernel/audit.c b/kernel/audit.c
index f93c271..801c946 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -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;
 }
 
 /*

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [AUDIT]: Increase skb->truesize in audit_expand
  2008-01-28 11:10 [AUDIT]: Increase skb->truesize in audit_expand Herbert Xu
@ 2008-01-28 14:13 ` James Morris
  2008-01-29  4:47   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: James Morris @ 2008-01-28 14:13 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Linus Torvalds, Andrew Morton, David S. Miller,
	Linux Kernel Mailing List

On Mon, 28 Jan 2008, Herbert Xu wrote:

> 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.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Acked-by: James Morris <jmorris@namei.org>


(Candidate for stable ?)


- James
-- 
James Morris <jmorris@namei.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [AUDIT]: Increase skb->truesize in audit_expand
  2008-01-28 14:13 ` James Morris
@ 2008-01-29  4:47   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-01-29  4:47 UTC (permalink / raw)
  To: jmorris; +Cc: herbert, torvalds, akpm, linux-kernel

From: James Morris <jmorris@namei.org>
Date: Tue, 29 Jan 2008 01:13:03 +1100 (EST)

> On Mon, 28 Jan 2008, Herbert Xu wrote:
> 
> > 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.
> > 
> > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> Acked-by: James Morris <jmorris@namei.org>
> 
> 
> (Candidate for stable ?)

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-29  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-28 11:10 [AUDIT]: Increase skb->truesize in audit_expand Herbert Xu
2008-01-28 14:13 ` James Morris
2008-01-29  4:47   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).