mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 00:15:16 +00:00
Fixed bug #27316 (netconn: Possible deadlock in err_tcp) by using sys_mbox_trypost in err_tcp
This commit is contained in:
parent
972ca9e6c1
commit
52389fc09a
@ -50,6 +50,9 @@ HISTORY
|
||||
|
||||
++ Bugfixes:
|
||||
|
||||
2010-01-19: Simon Goldschmidt
|
||||
* api_msg.c: Fixed bug #27316: netconn: Possible deadlock in err_tcp
|
||||
|
||||
2010-01-18: Iordan Neshev/Simon Goldschmidt
|
||||
* src/netif/ppp: reorganised PPP sourcecode to 2.3.11 including some
|
||||
bugfix backports from 2.4.x.
|
||||
|
@ -312,14 +312,17 @@ err_tcp(void *arg, err_t err)
|
||||
{
|
||||
struct netconn *conn;
|
||||
enum netconn_state old_state;
|
||||
SYS_ARCH_DECL_PROTECT(lev);
|
||||
|
||||
conn = arg;
|
||||
LWIP_ASSERT("conn != NULL", (conn != NULL));
|
||||
|
||||
conn->pcb.tcp = NULL;
|
||||
|
||||
/* no protection since this is always fatal */
|
||||
/* no check since this is always fatal */
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
conn->last_err = err;
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
|
||||
/* API_EVENT might call tcp_tmr, so reset conn->state now */
|
||||
old_state = conn->state;
|
||||
@ -328,12 +331,14 @@ err_tcp(void *arg, err_t err)
|
||||
if (conn->recvmbox != SYS_MBOX_NULL) {
|
||||
/* Register event with callback */
|
||||
API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0);
|
||||
sys_mbox_post(conn->recvmbox, NULL);
|
||||
/* use trypot to preven deadlock */
|
||||
sys_mbox_trypost(conn->recvmbox, NULL);
|
||||
}
|
||||
if (conn->acceptmbox != SYS_MBOX_NULL) {
|
||||
/* Register event with callback */
|
||||
API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0);
|
||||
sys_mbox_post(conn->acceptmbox, NULL);
|
||||
/* use trypot to preven deadlock */
|
||||
sys_mbox_trypost(conn->acceptmbox, NULL);
|
||||
}
|
||||
if ((old_state == NETCONN_WRITE) || (old_state == NETCONN_CLOSE) ||
|
||||
(old_state == NETCONN_CONNECT)) {
|
||||
|
Loading…
Reference in New Issue
Block a user