diff --git a/drivers/net/rckemac.c b/drivers/net/rckemac.c index 0ba62c15..e06b7981 100644 --- a/drivers/net/rckemac.c +++ b/drivers/net/rckemac.c @@ -232,6 +232,7 @@ static err_t rckemacif_output(struct netif* netif, struct pbuf* p) int rest; int packets; int sum = 0; + int chance = 20; /* check for over/underflow */ if (BUILTIN_EXPECT((p->tot_len < 20 /* IP header size */) || (p->tot_len > 1536), 0)) { @@ -257,6 +258,9 @@ again: if (sum < packets) { LWIP_DEBUGF(NETIF_DEBUG, ("Warning: not enough space available, retrying...\n")); + chance--; + if (chance < 0) + return ERR_MEM; goto again; } #endif