net: tcp: Add the frag back to caller allocated net_pkt
The original fragment chain of incoming packet will be lost and leaked in case of early error, add frag back to packet and let the caller do unref. Fixes #4323 Signed-off-by: june li <junelizh@foxmail.com>
This commit is contained in:
parent
8dab561689
commit
c6407659f3
@ -391,6 +391,8 @@ static struct net_pkt *prepare_segment(struct net_tcp *tcp,
|
||||
|
||||
if (pkt_allocated) {
|
||||
net_pkt_unref(pkt);
|
||||
} else {
|
||||
pkt->frags = tail;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -400,6 +402,8 @@ static struct net_pkt *prepare_segment(struct net_tcp *tcp,
|
||||
if (!header) {
|
||||
if (pkt_allocated) {
|
||||
net_pkt_unref(pkt);
|
||||
} else {
|
||||
pkt->frags = tail;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user