netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: adjust skb->truesize in ___pskb_trim()
@ 2017-04-26 16:07 Eric Dumazet
  2017-04-26 17:08 ` Andrey Konovalov
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Eric Dumazet @ 2017-04-26 16:07 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Andrey Konovalov, Willem de Bruijn

From: Eric Dumazet <edumazet@google.com>

Andrey found a way to trigger the WARN_ON_ONCE(delta < len) in
skb_try_coalesce() using syzkaller and a filter attached to a TCP
socket.

As we did recently in commit 158f323b9868 ("net: adjust skb->truesize in
pskb_expand_head()") we can adjust skb->truesize from ___pskb_trim(),
via a call to skb_condense().

If all frags were freed, then skb->truesize can be recomputed.

This call can be done if skb is not yet owned, or destructor is
sock_edemux().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Cc: Willem de Bruijn <willemb@google.com>
---
 net/core/skbuff.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f86bf69cfb8d8bc17262cdba5d9f57a4726cd476..f1d04592ace02f32efa6e05df89c9a5e0023157f 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1576,6 +1576,8 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len)
 		skb_set_tail_pointer(skb, len);
 	}
 
+	if (!skb->sk || skb->destructor == sock_edemux)
+		skb_condense(skb);
 	return 0;
 }
 EXPORT_SYMBOL(___pskb_trim);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-28 20:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-26 16:07 [PATCH net] net: adjust skb->truesize in ___pskb_trim() Eric Dumazet
2017-04-26 17:08 ` Andrey Konovalov
2017-04-27 18:43   ` Willem de Bruijn
2017-04-27  0:15 ` [PATCH net] tcp: do not underestimate skb->truesize in tcp_trim_head() Eric Dumazet
2017-04-27 11:49   ` Andrey Konovalov
2017-04-28 20:05     ` David Miller
2017-04-28 20:07 ` [PATCH net] net: adjust skb->truesize in ___pskb_trim() David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).