Skip to content

Commit c21b48c

Browse files
edumazetdavem330
authored andcommitted
net: adjust skb->truesize in ___pskb_trim()
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 158f323 ("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 <[email protected]> Reported-by: Andrey Konovalov <[email protected]> Cc: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7162fb2 commit c21b48c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/core/skbuff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,8 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len)
15761576
skb_set_tail_pointer(skb, len);
15771577
}
15781578

1579+
if (!skb->sk || skb->destructor == sock_edemux)
1580+
skb_condense(skb);
15791581
return 0;
15801582
}
15811583
EXPORT_SYMBOL(___pskb_trim);

0 commit comments

Comments
 (0)