From 22e46ab72ff1093882b502a095f36a15807a78d9 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 19 Oct 2018 10:16:53 +0200 Subject: ipcpd: Check flow id instead of assert This will check if the flow id is valid instead of asserting. It avoids assertion failures in the IPCP if an application crashes and the IRMd deallocates the flow while the IPCP still has pending writes. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/dev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/dev.c b/src/lib/dev.c index 6dbb925e..3c1494ee 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -1403,7 +1403,10 @@ int ipcp_flow_write(int fd, pthread_rwlock_rdlock(&ai.lock); - assert(flow->flow_id >= 0); + if (flow->flow_id < 0) { + pthread_rwlock_unlock(&ai.lock); + return -ENOTALLOC; + } if ((flow->oflags & FLOWFACCMODE) == FLOWFRDONLY) { pthread_rwlock_unlock(&ai.lock); -- cgit v1.2.3