From 263c8311461c66407d1d12e5a44264ec0d8d1849 Mon Sep 17 00:00:00 2001 From: Paul Guyot Date: Fri, 10 Jan 2025 23:26:25 +0100 Subject: [PATCH] Fix deadlock in socket code Fix a deadlock that was introduced in 555745c8a0cccdb0e1b0fade1993616a3cb16a0c and that happens on platforms without recursive locks (e.g. esp32) by removing an unnessary lock in `socket_recv`. Signed-off-by: Paul Guyot --- src/libAtomVM/otp_socket.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libAtomVM/otp_socket.c b/src/libAtomVM/otp_socket.c index 5655d7ba8..70ab8edeb 100644 --- a/src/libAtomVM/otp_socket.c +++ b/src/libAtomVM/otp_socket.c @@ -1820,9 +1820,7 @@ static ssize_t do_socket_recv(struct SocketResource *rsrc_obj, uint8_t *buf, siz ssize_t socket_recv(struct SocketResource *rsrc_obj, uint8_t *buf, size_t len, int flags, term *from, Heap *heap) { - SMP_RWLOCK_RDLOCK(rsrc_obj->socket_lock); ssize_t result = do_socket_recv(rsrc_obj, buf, len, flags, from, heap); - SMP_RWLOCK_UNLOCK(rsrc_obj->socket_lock); return result; }