lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] possible issue in sockets.c


From: address@hidden
Subject: Re: [lwip-devel] possible issue in sockets.c
Date: Wed, 25 Dec 2013 12:22:20 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

Albert Huitsing wrote:
I've encountered a possible issue in src/api/sockets.c

in the function event_callback() there seems to be a potential problem with 
detecting possible
modification of the list while looping:

       }
       if (do_signal) {
         scb->sem_signalled = 1;
         /* Don't call SYS_ARCH_UNPROTECT() before signaling the semaphore, as 
this might
            lead to the select thread taking itself off the list, invalidagin 
the semaphore. */
         sys_sem_signal(&scb->sem);
       }
     }
     /* unlock interrupts with each step */
     last_select_cb_ctr = select_cb_ctr;


the call to sys_sem_signal() could cause a modification of the list.

so I think the 'select_cb_ctr' has to be stored *before* the call to 
sys_sem_signal()

The actual protection here is done through SYS_ARCH_PROTECT(), not by the order of storing the pointer vs. semaphore signaling, so this should be OK.

Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]