Skip to content

Commit 28177da

Browse files
jukkarnashif
authored andcommitted
net: conn: Use safe slist macro when searching connection
Try to catch simultaneous insert to/delete from list when searching the connection. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 6dfb11c commit 28177da

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

subsys/net/ip/connection.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ static struct net_conn *conn_find_handler(uint16_t proto, uint8_t family,
149149
uint16_t local_port)
150150
{
151151
struct net_conn *conn;
152+
struct net_conn *tmp;
152153

153-
SYS_SLIST_FOR_EACH_CONTAINER(&conn_used, conn, node) {
154+
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&conn_used, conn, tmp, node) {
154155
if (conn->proto != proto) {
155156
continue;
156157
}

0 commit comments

Comments
 (0)