From 4deb4936d52da88752da93f9cdc49541c10ef413 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 31 Oct 2015 19:48:54 +0300 Subject: [PATCH] extmod/modlwip: socket->incoming changed by async callbacks, must be volatile. Otherwise for code like: while (socket->incoming == NULL) { LWIP_DELAY(100); } a compiler may cache it in a register and it will be an infinite loop. --- extmod/modlwip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/modlwip.c b/extmod/modlwip.c index ced9c06a1b..0f3ab7c155 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -184,7 +184,7 @@ typedef struct _lwip_socket_obj_t { mp_obj_base_t base; void *pcb; - void *incoming; + void *volatile incoming; byte peer[4]; mp_uint_t peer_port; mp_uint_t timeout;