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:
june li 2017-11-13 18:43:43 +08:00 committed by Jukka Rissanen
parent 8dab561689
commit c6407659f3

View File

@ -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;