lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #26405] Prematurely released semaphore causes lwip_sel


From: Simon Goldschmidt
Subject: [lwip-devel] [bug #26405] Prematurely released semaphore causes lwip_select() to crash
Date: Mon, 04 May 2009 20:02:21 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; de; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10

Follow-up Comment #2, bug #26405 (project lwip):

Reading the code, I don't get how it could go wrong:

tcpip_thread calls:
    sys_sem_signal(selectsem);
    sys_sem_signal(scb->sem);
while the application thread calls:
    i = sys_sem_wait_timeout(select_cb.sem, msectimeout);
    sys_sem_wait(selectsem);
    sys_sem_signal(selectsem);
    sys_sem_free(select_cb.sem);

The only problem I see here is that the port used by Konstantin could maybe
ignore the int parameter passed to sys_sem_new and always initialize the
semaphore with 1, in which case it would wait only for selectsem... but that
would make problems elswhere, too.

Anyway, since it's good practice (or at least that's what I've learnt:) to
use resources in the same order in every place, I don't have that strong an
opinion against changing the order of the sys_sem_signal calls...
Nevertheless, I'd like to understand the bug before making the change.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?26405>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/





reply via email to

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