summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ouroboros/ipcp-dev.h2
-rw-r--r--src/ipcpd/normal/fa.c3
-rw-r--r--src/ipcpd/normal/psched.c4
-rw-r--r--src/lib/dev.c13
4 files changed, 16 insertions, 6 deletions
diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h
index 4f8b5da8..86e21cdc 100644
--- a/include/ouroboros/ipcp-dev.h
+++ b/include/ouroboros/ipcp-dev.h
@@ -43,7 +43,7 @@ int ipcp_flow_read(int fd,
int ipcp_flow_write(int fd,
struct shm_du_buff * sdb);
-void ipcp_flow_fini(int fd);
+int ipcp_flow_fini(int fd);
int ipcp_flow_get_qoscube(int fd,
qoscube_t * cube);
diff --git a/src/ipcpd/normal/fa.c b/src/ipcpd/normal/fa.c
index 56864e1f..8408033f 100644
--- a/src/ipcpd/normal/fa.c
+++ b/src/ipcpd/normal/fa.c
@@ -446,7 +446,8 @@ int fa_alloc_resp(int fd,
int fa_dealloc(int fd)
{
- ipcp_flow_fini(fd);
+ if (ipcp_flow_fini(fd) < 0)
+ return 0;
pthread_rwlock_wrlock(&fa.flows_lock);
diff --git a/src/ipcpd/normal/psched.c b/src/ipcpd/normal/psched.c
index c38c072d..6d02de18 100644
--- a/src/ipcpd/normal/psched.c
+++ b/src/ipcpd/normal/psched.c
@@ -217,7 +217,7 @@ void psched_destroy(struct psched * psched)
}
void psched_add(struct psched * psched,
- int fd)
+ int fd)
{
qoscube_t qc;
@@ -228,7 +228,7 @@ void psched_add(struct psched * psched,
}
void psched_del(struct psched * psched,
- int fd)
+ int fd)
{
qoscube_t qc;
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 57dfc3f2..50b12b43 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -667,7 +667,10 @@ int flow_dealloc(int fd)
pthread_rwlock_rdlock(&ai.lock);
- assert(ai.flows[fd].flow_id >= 0);
+ if (ai.flows[fd].flow_id < 0) {
+ pthread_rwlock_unlock(&ai.lock);
+ return -ENOTALLOC;
+ }
msg.flow_id = ai.flows[fd].flow_id;
@@ -1467,7 +1470,7 @@ void ipcp_sdb_release(struct shm_du_buff * sdb)
shm_rdrbuff_remove(ai.rdrb, shm_du_buff_get_idx(sdb));
}
-void ipcp_flow_fini(int fd)
+int ipcp_flow_fini(int fd)
{
struct shm_rbuff * rx_rb;
@@ -1475,6 +1478,11 @@ void ipcp_flow_fini(int fd)
pthread_rwlock_rdlock(&ai.lock);
+ if (ai.flows[fd].flow_id < 0) {
+ pthread_rwlock_unlock(&ai.lock);
+ return -1;
+ }
+
shm_rbuff_set_acl(ai.flows[fd].rx_rb, ACL_FLOWDOWN);
shm_rbuff_set_acl(ai.flows[fd].tx_rb, ACL_FLOWDOWN);
@@ -1489,6 +1497,7 @@ void ipcp_flow_fini(int fd)
if (rx_rb != NULL)
shm_rbuff_fini(rx_rb);
+ return 0;
}
int ipcp_flow_get_qoscube(int fd,