mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-20 15:40:55 +00:00
sys_arch_mbox_tryfetch not validated correctly
sys_arch_mbox_tryfetch() shall return SYS_MBOX_EMPTY or 0 according to the documentation. Wherever the function is used the return value is incorrectly compared to SYS_ARCH_TIMEOUT. For now SYS_MBOX_EMPTY is defined to SYS_ARCH_TIMEOUT so this is not an issue as long as SYS_MBOX_EMPTY isn't re-defined. Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
parent
af0499131f
commit
f47d2ed5fe
@ -500,7 +500,7 @@ netconn_accept(struct netconn *conn, struct netconn **new_conn)
|
||||
|
||||
NETCONN_MBOX_WAITING_INC(conn);
|
||||
if (netconn_is_nonblocking(conn)) {
|
||||
if (sys_arch_mbox_tryfetch(&conn->acceptmbox, &accept_ptr) == SYS_ARCH_TIMEOUT) {
|
||||
if (sys_arch_mbox_tryfetch(&conn->acceptmbox, &accept_ptr) == SYS_MBOX_EMPTY) {
|
||||
API_MSG_VAR_FREE_ACCEPT(msg);
|
||||
NETCONN_MBOX_WAITING_DEC(conn);
|
||||
return ERR_WOULDBLOCK;
|
||||
@ -597,7 +597,7 @@ netconn_recv_data(struct netconn *conn, void **new_buf, u8_t apiflags)
|
||||
NETCONN_MBOX_WAITING_INC(conn);
|
||||
if (netconn_is_nonblocking(conn) || (apiflags & NETCONN_DONTBLOCK) ||
|
||||
(conn->flags & NETCONN_FLAG_MBOXCLOSED) || (conn->pending_err != ERR_OK)) {
|
||||
if (sys_arch_mbox_tryfetch(&conn->recvmbox, &buf) == SYS_ARCH_TIMEOUT) {
|
||||
if (sys_arch_mbox_tryfetch(&conn->recvmbox, &buf) == SYS_MBOX_EMPTY) {
|
||||
err_t err;
|
||||
NETCONN_MBOX_WAITING_DEC(conn);
|
||||
err = netconn_err(conn);
|
||||
|
@ -222,7 +222,7 @@ tcpip_thread_poll_one(void)
|
||||
int ret = 0;
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
if (sys_arch_mbox_tryfetch(&tcpip_mbox, (void **)&msg) != SYS_ARCH_TIMEOUT) {
|
||||
if (sys_arch_mbox_tryfetch(&tcpip_mbox, (void **)&msg) != SYS_MBOX_EMPTY) {
|
||||
LOCK_TCPIP_CORE();
|
||||
if (msg != NULL) {
|
||||
tcpip_thread_handle_msg(msg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user