zephyr/subsys/net/lib
Robert Lubos 78c871ab86 net: sockets: Fix potential deadlock during TCP send
There is a potential, corner case scenario, where a deadlock can occur
between TCP and socket layers, when both ends of the connection transmit
data.

The scenario is as follows:
 * Both ends of the connection transmit data,
 * Zephyr side send() call gets blocked due to filing the TX window
 * The next incoming packet is data packet, not updating the RX window
   on the peer side or acknowledging new data. The TCP layer will
   attepmt to notify the new data to the socket layer, by calling the
   registered callback. This will block the RX thread processing the TCP
   layer, as the socket mutex is already acquired by the blocked send()
   call.
 * No further packets are processed until the socket mutex is freed,
   which does not happen as the only way to unblock send() is process
   a new ACK, either updating window size or a acknowledging data.
   The connection stalls until send() times out.

The deadlock is not permament, as both threads get unlocked once send()
times out. It effectively breaks the active connection though.

Fix this, by unlocking the socket mutex for the time the send() call is
idle. Once the TCP layer notifies that the window is available again,
the mutex is acquired back.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-07-18 08:36:09 -07:00
..
capture all: logging: Remove log_strdup function 2022-06-23 13:42:23 +02:00
coap net: coap: make coap vars configurable 2022-07-05 21:56:34 +00:00
config all: logging: Remove log_strdup function 2022-06-23 13:42:23 +02:00
conn_mgr subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
dns all: logging: Remove log_strdup function 2022-06-23 13:42:23 +02:00
http all: logging: Remove log_strdup function 2022-06-23 13:42:23 +02:00
lwm2m net: lwm2m: Default ssid 2022-07-15 10:10:16 +02:00
mqtt subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
sntp subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
sockets net: sockets: Fix potential deadlock during TCP send 2022-07-18 08:36:09 -07:00
socks subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
tftp all: logging: Remove log_strdup function 2022-06-23 13:42:23 +02:00
tls_credentials subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
utils subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
websocket net: websocket: Allow building with POSIX API 2022-06-05 14:48:52 +02:00
CMakeLists.txt net: openthread: Move glue code into module directory 2022-07-11 11:00:12 +02:00
Kconfig