Thread (6 messages) flat view 6 messages, 2 authors, 2012-09-20
STALE5087d

[PATCH net-next] core: adjust checks for calling skb_copy_bits in skb_try_coalesce

From: <hidden>
Date: 2012-09-20 03:19:56
Subsystem: networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

From: Li RongQing <redacted>

Ensure that frags and frags_list of dst skb are empty if need to call
skb_copy_bits, or else it will break the data sequence.

Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Li RongQing <redacted>
---
 net/core/skbuff.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index fe00d12..f0b9446 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3455,15 +3455,15 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
 	if (skb_cloned(to))
 		return false;
 
-	if (len <= skb_tailroom(to)) {
+	if (skb_has_frag_list(to) || skb_has_frag_list(from))
+		return false;
+
+	if (len <= skb_tailroom(to) && !skb_shinfo(to)->nr_frags) {
 		BUG_ON(skb_copy_bits(from, 0, skb_put(to, len), len));
 		*delta_truesize = 0;
 		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.4.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help