From 9582cbffc568e129d53a39c92f7438b63d62de87 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Thu, 7 Feb 2013 09:50:58 +0000 Subject: [PATCH] LWIP - avoid an assert when a driver restarts --- servers/lwip/driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/servers/lwip/driver.c b/servers/lwip/driver.c index 473689ac7..bc139384a 100644 --- a/servers/lwip/driver.c +++ b/servers/lwip/driver.c @@ -430,6 +430,15 @@ void driver_up(const char * label, endpoint_t ep) nic->tx_buffer = debug_malloc(2048); if (nic->tx_buffer == NULL) panic("Cannot allocate tx_buffer"); + /* When driver restarts, the rx_pbuf is likely ready to receive data + * from its previous instance. We free the buffer here, nobody depends + * on it. A new one is allocated when we send a new read request to the + * driver. + */ + if (nic->rx_pbuf) { + pbuf_free(nic->rx_pbuf); + nic->rx_pbuf = NULL; + } /* prepare the RX grant once and forever */ if (cpf_setgrant_direct(nic->rx_iogrant, -- 2.44.0