From eb5d6fcef5969b596dc0613c8b166bf55d9203b8 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 31 Aug 2017 20:47:06 +0300 Subject: [PATCH] net: sockets: Be sure to initialize socket's queue on accept When new socket context is created on accepting connection to a listening socket, its recv_q FIFO should be initialized. Without initialization, this worked by a chance when FIFO structure was simple, but recent change to add dlist to it (which now needs proper initialization) exposed this issue. Jira: ZEP-2576 Signed-off-by: Paul Sokolovsky --- subsys/net/lib/sockets/sockets.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index 77f95f68480..6e922e89585 100644 --- a/subsys/net/lib/sockets/sockets.c +++ b/subsys/net/lib/sockets/sockets.c @@ -108,6 +108,7 @@ static void zsock_accepted_cb(struct net_context *new_ctx, struct net_context *parent = user_data; net_context_recv(new_ctx, zsock_received_cb, K_NO_WAIT, NULL); + k_fifo_init(&new_ctx->recv_q); NET_DBG("parent=%p, ctx=%p, st=%d", parent, new_ctx, status);