To fix this, tcp_output should be replaced with vIRQ_set_pending(), which forces all TCP processing into IRQ context, using IRQ serialization to prevent race conditions. However, since this is hardware-specific, it is not a permanent fix. It is simpler to implement in the near term than https://github.com/ARMmbed/sal-driver-lwip-k64f-eth/pull/9, which is a better solution.
Prior to https://github.com/ARMmbed/sal-stack-lwip/pull/35, all TCP handling was done in IRQ context. With https://github.com/ARMmbed/sal-stack-lwip/pull/35, some TCP processing is done in event context.
To fix this, tcp_output should be replaced with vIRQ_set_pending(), which forces all TCP processing into IRQ context, using IRQ serialization to prevent race conditions. However, since this is hardware-specific, it is not a permanent fix. It is simpler to implement in the near term than https://github.com/ARMmbed/sal-driver-lwip-k64f-eth/pull/9, which is a better solution.