You need to sign in or sign up before continuing.
提交 d01dbeb6 编写于 作者: H Herbert Xu 提交者: David S. Miller

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: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 94aca1da
...@@ -27,10 +27,14 @@ static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb) ...@@ -27,10 +27,14 @@ static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb)
- skb_headroom(skb); - skb_headroom(skb);
int ntail = dst->dev->needed_tailroom - skb_tailroom(skb); int ntail = dst->dev->needed_tailroom - skb_tailroom(skb);
if (nhead > 0 || ntail > 0) if (nhead <= 0) {
return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC); if (ntail <= 0)
return 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) static int xfrm_output_one(struct sk_buff *skb, int err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册