diff options
author | dimitri staessens <[email protected]> | 2016-10-05 13:13:39 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-10-05 14:25:30 +0200 |
commit | 3a60776ab1c56da40dbb9a7418e04ff70756d16b (patch) | |
tree | d90985e61884066204bf45091ff59a106d147fad /src | |
parent | 8a0bc74c2c7c3f5851b1a4dd51eb6ebbb0859a81 (diff) | |
parent | c0a08d0f7a4b66a030eb0eca0e3f1dc45ff08665 (diff) | |
download | ouroboros-3a60776ab1c56da40dbb9a7418e04ff70756d16b.tar.gz ouroboros-3a60776ab1c56da40dbb9a7418e04ff70756d16b.zip |
Merged in sandervrijders/ouroboros/be-bugfix (pull request #253)
lib, ipcpd: Fix bad locking
Diffstat (limited to 'src')
-rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 7 | ||||
-rw-r--r-- | src/lib/dev.c | 4 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index 2cf46e51..7a64b9e1 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -575,14 +575,11 @@ static void * eth_llc_ipcp_sdu_writer(void * o) uint8_t dsap; uint8_t r_addr[MAC_SIZE]; - pthread_rwlock_rdlock(&ipcpi.state_lock); - fd = ipcp_flow_read(&sdb); - if (fd < 0) { - pthread_rwlock_unlock(&ipcpi.state_lock); + if (fd < 0) continue; - } + pthread_rwlock_rdlock(&ipcpi.state_lock); pthread_rwlock_rdlock(ð_llc_data.flows_lock); ssap = reverse_bits(eth_llc_data.fd_to_ef[fd].sap); diff --git a/src/lib/dev.c b/src/lib/dev.c index 178ee287..8e1ee342 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -889,11 +889,11 @@ int np1_flow_resp(pid_t n_api, int port_id) int fd; struct shm_ap_rbuff * rb; + port_wait_assign(&ai.ports[port_id]); + pthread_rwlock_rdlock(&ai.data_lock); pthread_rwlock_wrlock(&ai.flows_lock); - port_wait_assign(&ai.ports[port_id]); - fd = ai.ports[port_id].fd; if (fd < 0) { pthread_rwlock_unlock(&ai.flows_lock); |