From: Tomas Hruby Date: Thu, 7 Feb 2013 09:50:58 +0000 (+0000) Subject: LWIP - avoid an assert when a driver restarts X-Git-Tag: v3.3.0~1065 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=9582cbffc568e129d53a39c92f7438b63d62de87;p=minix.git LWIP - avoid an assert when a driver restarts --- 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,