net/tcp/netdev/mld: correct the netlock handling

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2022-02-03 15:23:52 +08:00
committed by Alan Carvalho de Assis
parent b04b2f1bc8
commit 56b5ae0640
3 changed files with 6 additions and 4 deletions
+1
View File
@@ -343,6 +343,7 @@ static void mld_polldog_work(FAR void *arg)
fwarn("WARNING: No device associated with ifindex=%d\n", fwarn("WARNING: No device associated with ifindex=%d\n",
group->ifindex); group->ifindex);
net_unlock();
return; return;
} }
+1
View File
@@ -375,6 +375,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
ifindex = get_ifindex(); ifindex = get_ifindex();
if (ifindex < 0) if (ifindex < 0)
{ {
net_unlock();
return ifindex; return ifindex;
} }
+4 -4
View File
@@ -425,6 +425,7 @@ static inline int tcp_ipv4_bind(FAR struct tcp_conn_s *conn,
if (port < 0) if (port < 0)
{ {
nerr("ERROR: tcp_selectport failed: %d\n", port); nerr("ERROR: tcp_selectport failed: %d\n", port);
net_unlock();
return port; return port;
} }
@@ -448,11 +449,10 @@ static inline int tcp_ipv4_bind(FAR struct tcp_conn_s *conn,
conn->lport = 0; conn->lport = 0;
net_ipv4addr_copy(conn->u.ipv4.laddr, INADDR_ANY); net_ipv4addr_copy(conn->u.ipv4.laddr, INADDR_ANY);
return ret;
} }
net_unlock(); net_unlock();
return OK; return ret;
} }
#endif /* CONFIG_NET_IPv4 */ #endif /* CONFIG_NET_IPv4 */
@@ -492,6 +492,7 @@ static inline int tcp_ipv6_bind(FAR struct tcp_conn_s *conn,
if (port < 0) if (port < 0)
{ {
nerr("ERROR: tcp_selectport failed: %d\n", port); nerr("ERROR: tcp_selectport failed: %d\n", port);
net_unlock();
return port; return port;
} }
@@ -515,11 +516,10 @@ static inline int tcp_ipv6_bind(FAR struct tcp_conn_s *conn,
conn->lport = 0; conn->lport = 0;
net_ipv6addr_copy(conn->u.ipv6.laddr, g_ipv6_unspecaddr); net_ipv6addr_copy(conn->u.ipv6.laddr, g_ipv6_unspecaddr);
return ret;
} }
net_unlock(); net_unlock();
return OK; return ret;
} }
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */