Skip to content

Commit 3bcb1ef

Browse files
peltsujukkar
authored andcommitted
modem: fix socket descriptor leak
z_free_fd() is called twice then you close(). For example in ublox sara r4 driver offload_close() calls modem_socket_put() where z_free_fd() is called first time. Then this same function is called another time in socket.c in z_impl_zsock_close() after this function has called offload_close() in ublox sara r4 driver. This causes socket descriptor leak. Fixes #26819 Signed-off-by: Akseli Peltola <[email protected]>
1 parent b34d055 commit 3bcb1ef

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/modem/modem_socket.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ void modem_socket_put(struct modem_socket_config *cfg, int sock_fd)
233233

234234
k_sem_take(&cfg->sem_lock, K_FOREVER);
235235

236-
z_free_fd(sock->sock_fd);
237236
sock->id = cfg->base_socket_num - 1;
238237
sock->sock_fd = -1;
239238
sock->is_waiting = false;

0 commit comments

Comments
 (0)