diff --git a/CHANGELOG b/CHANGELOG index 76839cd4..c57f4e52 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -202,6 +202,9 @@ HISTORY ++ Bugfixes: + 2015-02-25: patch by Greg Renda + * ip4_frag.c: fixed bug #38210 (ip reassembly while remove oldest datagram) + 2015-02-25: Simon Goldschmidt * sockets.c: fixed bug #38165 (socket with mulicast): ensure igmp membership are dropped when socket (not netconn!) is closed. diff --git a/src/core/ipv4/ip_frag.c b/src/core/ipv4/ip_frag.c index f54d7db6..c9298aa1 100644 --- a/src/core/ipv4/ip_frag.c +++ b/src/core/ipv4/ip_frag.c @@ -223,7 +223,7 @@ ip_reass_remove_oldest_datagram(struct ip_hdr *fraghdr, int pbufs_needed) /* @todo Can't we simply remove the last datagram in the * linked list behind reassdatagrams? */ - struct ip_reassdata *r, *oldest, *prev; + struct ip_reassdata *r, *oldest, *prev, *oldest_prev; int pbufs_freed = 0, pbufs_freed_current; int other_datagrams; @@ -232,6 +232,7 @@ ip_reass_remove_oldest_datagram(struct ip_hdr *fraghdr, int pbufs_needed) do { oldest = NULL; prev = NULL; + oldest_prev = NULL; other_datagrams = 0; r = reassdatagrams; while (r != NULL) { @@ -240,9 +241,11 @@ ip_reass_remove_oldest_datagram(struct ip_hdr *fraghdr, int pbufs_needed) other_datagrams++; if (oldest == NULL) { oldest = r; + oldest_prev = prev; } else if (r->timer <= oldest->timer) { /* older than the previous oldest */ oldest = r; + oldest_prev = prev; } } if (r->next != NULL) { @@ -251,7 +254,7 @@ ip_reass_remove_oldest_datagram(struct ip_hdr *fraghdr, int pbufs_needed) r = r->next; } if (oldest != NULL) { - pbufs_freed_current = ip_reass_free_complete_datagram(oldest, prev); + pbufs_freed_current = ip_reass_free_complete_datagram(oldest, oldest_prev); pbufs_freed += pbufs_freed_current; } } while ((pbufs_freed < pbufs_needed) && (other_datagrams > 1));