zephyr/subsys/net
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
..
ip all: logging: Remove log_strdup function 2022-06-23 13:42:23 +02:00
l2 different subsystems: use unsigned int for irq_lock() 2022-07-14 14:37:13 -05:00
lib net: sockets: Fix potential deadlock during TCP send 2022-07-18 08:36:09 -07:00
pkt_filter subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
buf.c subsystems: migrate includes to <zephyr/...> 2022-05-09 12:07:35 +02:00
CMakeLists.txt
hostname.c all: logging: Remove log_strdup function 2022-06-23 13:42:23 +02:00
Kconfig net: remove superfluous default n for boolean 2022-04-19 11:49:27 +02:00
Kconfig.hostname
Kconfig.template.log_config.default.net
Kconfig.template.log_config.net