diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-11-25 13:57:01 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-25 13:57:01 -0800 |
commit | 9f782db3f5ceee9aa8de6f853969fbec1b8c6e65 (patch) | |
tree | b798a8186941e5e95796862e3f2520f253791bf4 /net | |
parent | f6486d40b33d1ac2c44c7c55db7edf022d9f4329 (diff) |
tcp: skb_shift cannot cache frag ptrs past pskb_expand_head
Since pskb_expand_head creates copy of the shared area we
cannot keep any frag ptr past de-cloning. This fixes the
tcpdump recvfrom -EFAULT problem.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/skbuff.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 57555a4525d..e03d77d4c1c 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2018,7 +2018,10 @@ void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len) skb_split_no_header(skb, skb1, len, pos); } -/* Shifting from/to a cloned skb is a no-go. */ +/* Shifting from/to a cloned skb is a no-go. + * + * Caller cannot keep skb_shinfo related pointers past calling here! + */ static int skb_prepare_for_shift(struct sk_buff *skb) { return skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC); @@ -2070,6 +2073,8 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen) skb_prepare_for_shift(tgt)) return 0; + /* All previous frag pointers might be stale! */ + fragfrom = &skb_shinfo(skb)->frags[from]; fragto = &skb_shinfo(tgt)->frags[merge]; fragto->size += shiftlen; |