From: Weilong Chen <chenweil...@huawei.com> When try to merge several skbs to prior one, if the frag_list is used and the the last one is a small packet, once the condition "len <= skb_tailroom(to)" is satisfied, we will get a wrong packet! This patch just check frag_lists before the condtion to prevent this from happening.
Signed-off-by: Weilong Chen <chenweil...@huawei.com> --- net/core/skbuff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 8a725cc..d08edcb 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4133,6 +4133,9 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, if (skb_cloned(to)) return false; + if (skb_has_frag_list(to) || skb_has_frag_list(from)) + return false; + if (len <= skb_tailroom(to)) { if (len) BUG_ON(skb_copy_bits(from, 0, skb_put(to, len), len)); @@ -4140,9 +4143,6 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, return true; } - if (skb_has_frag_list(to) || skb_has_frag_list(from)) - return false; - if (skb_headlen(from) != 0) { struct page *page; unsigned int offset; -- 1.7.12 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html