diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-08-10 10:46:47 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-08-10 10:46:47 +0200 |
commit | 7287e5649b122ec134f58e157e7908e2285dfa42 (patch) | |
tree | 27693eea2f2d1058eb55a17fbc4a313e0a983cc8 /src | |
parent | 3eb6acfd135cdfb82d19a4f445776ea2f13fd4e1 (diff) | |
download | ouroboros-7287e5649b122ec134f58e157e7908e2285dfa42.tar.gz ouroboros-7287e5649b122ec134f58e157e7908e2285dfa42.zip |
ipcpd: Fix locking problem in local IPCP
A lock was not being taken to check the state, but then it was
released if the state was not IPCP_NULL, resulting in a segfault.
Diffstat (limited to 'src')
-rw-r--r-- | src/ipcpd/local/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 99580a45..a6076800 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -261,14 +261,14 @@ static int ipcp_local_bootstrap(struct dif_config * conf) return -1; } + pthread_rwlock_wrlock(&_ipcp->state_lock); + if (_ipcp->state != IPCP_INIT) { pthread_rwlock_unlock(&_ipcp->state_lock); LOG_ERR("IPCP in wrong state."); return -1; } - pthread_rwlock_wrlock(&_ipcp->state_lock); - _ipcp->state = IPCP_ENROLLED; pthread_create(&_ap_instance->sduloop, |