| Submitter | Herbert Xu |
|---|---|
| Date | Sept. 25, 2008, 2:36 a.m. |
| Message ID | <20080925023622.GA15800@gondor.apana.org.au> |
| Download | mbox | patch |
| Permalink | /patch/1425/ |
| State | Accepted |
| Delegated to: | David Miller |
| Headers | show |
Comments
From: Herbert Xu <herbert@gondor.apana.org.au> Date: Thu, 25 Sep 2008 10:36:22 +0800 > Here's the fix. > > ipsec: Fix pskb_expand_head corruption in xfrm_state_check_space > > We're never supposed to shrink the headroom or tailroom. In fact, > shrinking the headroom is a fatal action. > > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Thanks a lot for diagnosing this and writing the patch Herbert. I'll integrate this when I next get a chance. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index ac25b4c..dc50f1e 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c @@ -27,10 +27,14 @@ static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb) - skb_headroom(skb); int ntail = dst->dev->needed_tailroom - skb_tailroom(skb); - if (nhead > 0 || ntail > 0) - return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC); - - return 0; + if (nhead <= 0) { + if (ntail <= 0) + return 0; + nhead = 0; + } else if (ntail < 0) + ntail = 0; + + return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC); } static int xfrm_output_one(struct sk_buff *skb, int err)