diff options
author | dimitri staessens <[email protected]> | 2017-09-23 10:01:05 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-09-23 10:01:05 +0200 |
commit | 30b6998337635a37db93680760637dae759c951d (patch) | |
tree | 25c39d78aea30efc2556a7e7612916889aa79623 /src | |
parent | 269ce58f0ffc179d36fa44eb3b205f41e5343f13 (diff) | |
download | ouroboros-30b6998337635a37db93680760637dae759c951d.tar.gz ouroboros-30b6998337635a37db93680760637dae759c951d.zip |
ipcpd: Fix data race in shim-udp
This fixes a data race in the shim-udp where the alloc_lock was
released before the ipcpi.alloc_id was set.
Diffstat (limited to 'src')
-rw-r--r-- | src/ipcpd/shim-udp/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index f47bb01a..d393dc4b 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -320,11 +320,12 @@ static int ipcp_udp_port_req(struct sockaddr_in * c_saddr, udp_data.fd_to_uf[fd].udp = f_saddr.sin_port; pthread_rwlock_unlock(&udp_data.flows_lock); - pthread_mutex_unlock(&ipcpi.alloc_lock); ipcpi.alloc_id = fd; pthread_cond_broadcast(&ipcpi.alloc_cond); + pthread_mutex_unlock(&ipcpi.alloc_lock); + log_dbg("Pending allocation request, fd %d, UDP port (%d, %d).", fd, ntohs(f_saddr.sin_port), ntohs(c_saddr->sin_port)); @@ -345,7 +346,7 @@ static int udp_port_to_fd(int udp_port) static int ipcp_udp_port_alloc_reply(uint16_t src_udp_port, uint16_t dst_udp_port, - int response) + int response) { int fd = -1; int ret = 0; |