Commit 406a1d868001423c85a3165288e566e65f424fe6
Committed by
David S. Miller
1 parent
29ffe1a5c5
Exists in
master
and in
39 other branches
[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> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff
kernel/audit.c
... | ... | @@ -1200,13 +1200,17 @@ |
1200 | 1200 | static inline int audit_expand(struct audit_buffer *ab, int extra) |
1201 | 1201 | { |
1202 | 1202 | struct sk_buff *skb = ab->skb; |
1203 | - int ret = pskb_expand_head(skb, skb_headroom(skb), extra, | |
1204 | - ab->gfp_mask); | |
1203 | + int oldtail = skb_tailroom(skb); | |
1204 | + int ret = pskb_expand_head(skb, 0, extra, ab->gfp_mask); | |
1205 | + int newtail = skb_tailroom(skb); | |
1206 | + | |
1205 | 1207 | if (ret < 0) { |
1206 | 1208 | audit_log_lost("out of memory in audit_expand"); |
1207 | 1209 | return 0; |
1208 | 1210 | } |
1209 | - return skb_tailroom(skb); | |
1211 | + | |
1212 | + skb->truesize += newtail - oldtail; | |
1213 | + return newtail; | |
1210 | 1214 | } |
1211 | 1215 | |
1212 | 1216 | /* |