From d6fbe2a5adffaf7d55db4ca8518ebba092078e7b Mon Sep 17 00:00:00 2001 From: sg Date: Tue, 28 Oct 2014 22:28:50 +0100 Subject: [PATCH] fixed bugs #41495 Possible threading issue in select() and #43278 event_callback() handle context switch when calling sys_sem_signal() --- CHANGELOG | 4 ++++ src/api/sockets.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 0bea06dd..3c53f000 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -127,6 +127,10 @@ HISTORY ++ Bugfixes: + 2014-10-21: Simon Goldschmidt (patch by Joel Cunningham and Albert Huitsing) + * sockts.c: fixed bugs #41495 Possible threading issue in select() and #43278 + event_callback() handle context switch when calling sys_sem_signal() + 2014-10-21: Simon Goldschmidt * api_msg.c: fixed bug #38219 Assert on TCP netconn_write with sndtimeout set diff --git a/src/api/sockets.c b/src/api/sockets.c index 9c4933f3..e8fa417d 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -1387,6 +1387,8 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) /* At this point, SYS_ARCH is still protected! */ again: for (scb = select_cb_list; scb != NULL; scb = scb->next) { + /* remember the state of select_cb_list to detect changes */ + last_select_cb_ctr = select_cb_ctr; if (scb->sem_signalled == 0) { /* semaphore not signalled yet */ int do_signal = 0; @@ -1414,7 +1416,6 @@ again: } } /* unlock interrupts with each step */ - last_select_cb_ctr = select_cb_ctr; SYS_ARCH_UNPROTECT(lev); /* this makes sure interrupt protection time is short */ SYS_ARCH_PROTECT(lev);