From 97d2a1c3c185623c5472e89e78b4d8cc98a06c91 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 21 Mar 2017 16:51:15 +0100 Subject: ipcpd: local: Handle failed flow allocation When the flow_req_arr returned a negative error, it was not handled correctly in the local IPCP, and an access was made into a table with a negative integer. This handles it correctly. --- src/ipcpd/local/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ipcpd/local/main.c') diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 8d770c94..edb22be6 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -234,13 +234,19 @@ static int ipcp_local_flow_alloc(int fd, if (ipcp_get_state() != IPCP_OPERATIONAL) { pthread_rwlock_unlock(&ipcpi.state_lock); - log_dbg("Won't register with non-enrolled IPCP."); + log_dbg("Won't allocate over non-operational IPCP."); return -1; /* -ENOTENROLLED */ } pthread_rwlock_wrlock(&local_data.lock); out_fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name, cube); + if (out_fd < 0) { + log_dbg("Flow allocation failed."); + pthread_rwlock_unlock(&local_data.lock); + pthread_rwlock_unlock(&ipcpi.state_lock); + return -1; + } local_data.in_out[fd] = out_fd; local_data.in_out[out_fd] = fd; -- cgit v1.2.3