Skip to content
Commit 6521b9e4 authored by Marcin Niestroj's avatar Marcin Niestroj Committed by Jukka Rissanen
Browse files

net: tcp: Fix net_buf leak in case of low available net_buf count



This net_buf leak happends when we are low on available net_buf
count. During TCP segment preparation we do allocate IP header
successfully, but we fail to allocate TCP header. In such case
pkt->frags is not NULL anymore (it contains IP header), but we
override it during TCP header allocation error path. This results
in net_buf containing IP header to never be deallocated, because
it does not belong to any net_pkt anymore.

Use net_pkt_frag_add() function to add tail for future net_pkt
deallocation, instead of assigning tail to pkt->frags pointer.

Fixes: c6407659 ("net: tcp: Add the frag back to caller allocated
  net_pkt")
Signed-off-by: default avatarMarcin Niestroj <m.niestroj@grinn-global.com>
parent 06c4a950
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment