mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-15 09:21:56 +00:00
After introducing SO_SNDBUF socket option, a possible deadlock situation slipped into the TCP implementation. The scenario for the deadlock: * application thread tries to send some data, it enters net_context_send() which locks the context mutex, * internal context_sendto() blocks on a TX packet allocation, if the TX pool is empty rescheduling takes place, * now, if at the same time some incoming packet has arrived (ACK for example), TCP stack enters tcp_in() function from a different thread. The function locks the TCP connection mutex, and tries to obtain the SNDBUF option value. net_context_get_option() tries to lock the context mutex, but it is already held by the transmitting thread, so the receiver thread blocks * when TX packet is available again, the transmitting thread unblocks and tries to pass the packet down to TCP stack. net_tcp_queue_data() is called which attempts to lock the TCP connection mutex, but it is already held by the receiving thread. Both threads are in a deadlock now with no chance to recover. Fix this, by obtaining the SNDBUF option value in tcp_in() before locking the TCP connection mutex. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no> |
||
---|---|---|
.. | ||
6lo_private.h | ||
6lo.c | ||
6lo.h | ||
canbus_socket.c | ||
canbus_socket.h | ||
CMakeLists.txt | ||
connection.c | ||
connection.h | ||
dhcpv4.c | ||
dhcpv4.h | ||
icmpv4.c | ||
icmpv4.h | ||
icmpv6.c | ||
icmpv6.h | ||
igmp.c | ||
ipv4_autoconf_internal.h | ||
ipv4_autoconf.c | ||
ipv4.c | ||
ipv4.h | ||
ipv6_fragment.c | ||
ipv6_mld.c | ||
ipv6_nbr.c | ||
ipv6.c | ||
ipv6.h | ||
Kconfig | ||
Kconfig.debug | ||
Kconfig.ipv4 | ||
Kconfig.ipv6 | ||
Kconfig.mgmt | ||
Kconfig.stack | ||
Kconfig.stats | ||
nbr.c | ||
nbr.h | ||
net_context.c | ||
net_core.c | ||
net_if.c | ||
net_mgmt.c | ||
net_pkt.c | ||
net_private.h | ||
net_shell.c | ||
net_shell.h | ||
net_stats.c | ||
net_stats.h | ||
net_tc_mapping.h | ||
net_tc.c | ||
net_timeout.c | ||
packet_socket.c | ||
packet_socket.h | ||
promiscuous.c | ||
route.c | ||
route.h | ||
tcp_internal.h | ||
tcp_private.h | ||
tcp.c | ||
tcp.h | ||
tp_priv.h | ||
tp.c | ||
tp.h | ||
trickle.c | ||
udp_internal.h | ||
udp.c | ||
utils.c |