From 03876c40ebd0f46ed5b3e1b1506f4537d9feeec2 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Tue, 16 Aug 2022 13:54:21 +0200 Subject: [PATCH] server: safeguard underneath socket destruction --- kernel/mars_server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/mars_server.c b/kernel/mars_server.c index 6123323c..1ad502b6 100644 --- a/kernel/mars_server.c +++ b/kernel/mars_server.c @@ -616,6 +616,8 @@ int handler_thread(void *data) path, status); goto err; } + if (!mars_socket_is_alive(sock)) + goto err; cond_resched(); } /* All right: we can connect to the new brick */ @@ -630,6 +632,8 @@ int handler_thread(void *data) } err: + if (!mars_socket_is_alive(sock)) + break; cmd.cmd_int1 = status; down(&brick->socket_sem); status = mars_send_cmd(sock, &cmd, false);