mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-05 14:04:38 +08:00
ip4_reass: free datagram entry if p == NULL
This commit is contained in:
parent
5b459c1282
commit
b5448a86fd
@ -590,14 +590,14 @@ ip4_reass(struct pbuf *p)
|
|||||||
u16_t datagram_len = (u16_t)(offset + len);
|
u16_t datagram_len = (u16_t)(offset + len);
|
||||||
if ((datagram_len < offset) || (datagram_len > (0xFFFF - IP_HLEN))) {
|
if ((datagram_len < offset) || (datagram_len > (0xFFFF - IP_HLEN))) {
|
||||||
/* u16_t overflow, cannot handle this */
|
/* u16_t overflow, cannot handle this */
|
||||||
goto nullreturn;
|
goto nullreturn_ipr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* find the right place to insert this pbuf */
|
/* find the right place to insert this pbuf */
|
||||||
/* @todo: trim pbufs if fragments are overlapping */
|
/* @todo: trim pbufs if fragments are overlapping */
|
||||||
valid = ip_reass_chain_frag_into_datagram_and_validate(ipr, p, is_last);
|
valid = ip_reass_chain_frag_into_datagram_and_validate(ipr, p, is_last);
|
||||||
if (valid == IP_REASS_VALIDATE_PBUF_DROPPED) {
|
if (valid == IP_REASS_VALIDATE_PBUF_DROPPED) {
|
||||||
goto nullreturn;
|
goto nullreturn_ipr;
|
||||||
}
|
}
|
||||||
/* if we come here, the pbuf has been enqueued */
|
/* if we come here, the pbuf has been enqueued */
|
||||||
|
|
||||||
@ -676,6 +676,13 @@ ip4_reass(struct pbuf *p)
|
|||||||
LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass_pbufcount: %d out\n", ip_reass_pbufcount));
|
LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass_pbufcount: %d out\n", ip_reass_pbufcount));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
nullreturn_ipr:
|
||||||
|
if ((ipr != NULL) && (ipr->p == NULL)) {
|
||||||
|
/* dropped pbuf after creating a new datagram entry: remove the entry, too */
|
||||||
|
LWIP_ASSERT("not firstalthough just enqueued", ipr == reassdatagrams);
|
||||||
|
ip_reass_dequeue_datagram(ipr, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
nullreturn:
|
nullreturn:
|
||||||
LWIP_DEBUGF(IP_REASS_DEBUG, ("ip4_reass: nullreturn\n"));
|
LWIP_DEBUGF(IP_REASS_DEBUG, ("ip4_reass: nullreturn\n"));
|
||||||
IPFRAG_STATS_INC(ip_frag.drop);
|
IPFRAG_STATS_INC(ip_frag.drop);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user