Skip to content

Commit faa4d7f

Browse files
zhhyu7xiaoxiang781216
authored andcommitted
net/udp: fix conn_unlock not called outside conditional block
Move conn_unlock() call outside the if block in psock_udp_sendto() to ensure the connection lock is always released before returning, preventing a potential deadlock when the condition is not met. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
1 parent 54ee939 commit faa4d7f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

net/udp/udp_sendto_buffered.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,10 +895,10 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
895895
conn_unlock(&conn->sconn);
896896
goto errout_with_wrb;
897897
}
898-
899-
conn_unlock(&conn->sconn);
900898
}
901899

900+
conn_unlock(&conn->sconn);
901+
902902
/* Return the number of bytes that will be sent */
903903

904904
return len;

0 commit comments

Comments
 (0)