nuttx/net/tcp
chao.an 9bdeed73e2 net/tcp: fix assertion of fallback connection alloc
When the free connection list is unenough to alloc a new instance,
the TCP stack will reuse the currently closed connection, but if
the handle is not released by the user via close(2), the reference
count of the connection remains in a non-zero value, it will cause
the assertion to fail, so when the handle is not released we should
not use such a conn instance when being actively closed, and ensure
that the reference count is assigned within the net lock protection

|(gdb) bt
|#0  up_assert (filename=0x565c78f7 "tcp/tcp_conn.c", lineno=771) at sim/up_assert.c:75
|#1  0x56566177 in _assert (filename=0x565c78f7 "tcp/tcp_conn.c", linenum=771) at assert/lib_assert.c:36
|#2  0x5657d620 in tcp_free (conn=0x565fb3e0 <g_tcp_connections>) at tcp/tcp_conn.c:771
|#3  0x5657d5a1 in tcp_alloc (domain=2 '\002') at tcp/tcp_conn.c:700
|#4  0x565b1f50 in inet_tcp_alloc (psock=0xf3dea150) at inet/inet_sockif.c:144
|#5  0x565b2082 in inet_setup (psock=0xf3dea150, protocol=0) at inet/inet_sockif.c:253
|#6  0x565b1bf0 in psock_socket (domain=2, type=1, protocol=0, psock=0xf3dea150) at socket/socket.c:121
|#7  0x56588f5f in socket (domain=2, type=1, protocol=0) at socket/socket.c:278
|#8  0x565b11c0 in hello_main (argc=1, argv=0xf3dfab10) at hello_main.c:35
|#9  0x56566631 in nxtask_startup (entrypt=0x565b10ef <hello_main>, argc=1, argv=0xf3dfab10) at sched/task_startup.c:70
|#10 0x565597fa in nxtask_start () at task/task_start.c:134

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-07-09 09:37:49 +09:00
..
Kconfig Change dpends on SCHED_[L|H]PWORK to SCHED_WORKQUEUE 2022-05-28 18:41:51 +03:00
Make.defs net: fix the build when CONFIG_NET_TCP_WRITE_BUFFERS is not enabled 2022-05-18 07:54:17 +09:00
tcp_accept.c net/inet: move socket flags into socket_conn_s 2022-02-10 15:04:33 -03:00
tcp_appsend.c net/tcp(buffered): retransmit only one the earliest not acknowledged segment 2022-06-16 18:14:29 +08:00
tcp_backlog.c net: Author Gregory Nutt: update licenses to Apache 2021-02-20 00:38:18 -08:00
tcp_callback.c net/tcp: replace the common connect prologue 2022-02-10 15:04:33 -03:00
tcp_close.c net/tcp: fix assertion of fallback connection alloc 2022-07-09 09:37:49 +09:00
tcp_conn.c net/tcp: fix assertion of fallback connection alloc 2022-07-09 09:37:49 +09:00
tcp_connect.c net/tcp: remove the socket hook reference from netdev callback 2022-02-10 15:04:33 -03:00
tcp_devpoll.c tcp: move wd_timer from wifi driver to tcp stack 2022-05-28 16:29:51 +08:00
tcp_dump.c net: fix the build when CONFIG_NET_TCP_WRITE_BUFFERS is not enabled 2022-05-18 07:54:17 +09:00
tcp_finddev.c net: Author Gregory Nutt: update licenses to Apache 2021-02-20 00:38:18 -08:00
tcp_getsockopt.c net/tcp: Use the relative value for keep alive timer 2022-05-18 18:40:41 +03:00
tcp_input.c net/tcp: d_appdata should remove the tcp specific option field 2022-06-15 20:28:10 +08:00
tcp_ioctl.c net: tcp/udp/icmp/icmpv6 add FIONSPACE support 2022-04-02 13:39:38 +08:00
tcp_ipselect.c net: Author Gregory Nutt: update licenses to Apache 2021-02-20 00:38:18 -08:00
tcp_listen.c net/tcp: Remove tcp_listen_initialize 2022-03-12 19:24:17 +02:00
tcp_monitor.c net/tcp/monitor: do not migrate the state to close 2022-02-11 18:56:40 +09:00
tcp_netpoll.c net/tcp: remove the socket hook reference from netdev callback 2022-02-10 15:04:33 -03:00
tcp_notifier.c sched/wqueue: Change the return type of work_notifier_teardown to void 2022-05-14 00:35:29 +03:00
tcp_recvfrom.c net/tcp: remove the socket hook reference from netdev callback 2022-02-10 15:04:33 -03:00
tcp_recvwindow.c net/tcp: change all window relative value type to uint32_t 2021-07-07 03:55:41 -05:00
tcp_send_buffered.c net/tcp(buffered): retransmit only one the earliest not acknowledged segment 2022-06-16 18:14:29 +08:00
tcp_send_unbuffered.c net: Ensure sendmsg and sendfile return -EAGAIN in case of timeout 2022-06-28 06:19:13 +03:00
tcp_send.c net: unify FAR keyword usage for all net buffer memory mapped buffers 2022-01-20 01:42:56 +08:00
tcp_sendfile.c net: Ensure sendmsg and sendfile return -EAGAIN in case of timeout 2022-06-28 06:19:13 +03:00
tcp_seqno.c
tcp_setsockopt.c tcp: move wd_timer from wifi driver to tcp stack 2022-05-28 16:29:51 +08:00
tcp_timer.c net/tcp: Search conn list again to aovid the race condition in tcp_timer_expiry 2022-06-07 20:15:41 +03:00
tcp_txdrain.c sched: Don't include nuttx/sched.h inside sched.h 2021-05-24 12:11:53 +09:00
tcp_wrbuffer.c net: tcp/udp/icmp/icmpv6 add FIONSPACE support 2022-04-02 13:39:38 +08:00
tcp.h net/tcp(buffered): retransmit only one the earliest not acknowledged segment 2022-06-16 18:14:29 +08:00