aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/memif
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2021-09-14 07:07:17 -0700
committerDamjan Marion <dmarion@me.com>2021-09-17 14:57:33 +0000
commitd26a582759a0e5cf36375479727c5d97ea4147ec (patch)
tree7713c1631f3729d2ca6f1485e2bec3090a5c6fcf /src/plugins/memif
parent91db3538c923063f9ddc8e7bde8c8481372fe14a (diff)
memif: avoid double pool_put on a clib_file
When memif CP processes the socket connection error, it may go through the following code paths which may eventually cause double pool_put on a clib_file memif_master_conn_fd_error:633 -> memif_disconnect -> memif_socket_close -> memif_file_del_by_index -> clib_file_del_by_index -> clib_file_del -> pool_put After memif_master_conn_fd_error:633, the code continues on memif_maser_conn_fd_error:651 -> memif_file_del -> clib_file_del -> pool_put The fix is to skip calling memif_file_del in memif_master_conn_fd_error:651 if uf->file_descriptor == ~0 to catch problem from all possible paths in memif_master_conn_fd_error Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I0960998db1ff358a8ddd4a5e22188a244eccd270
Diffstat (limited to 'src/plugins/memif')
-rw-r--r--src/plugins/memif/socket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/memif/socket.c b/src/plugins/memif/socket.c
index 5a381a7c7cd..d9748119302 100644
--- a/src/plugins/memif/socket.c
+++ b/src/plugins/memif/socket.c
@@ -648,7 +648,8 @@ memif_master_conn_fd_error (clib_file_t * uf)
memif_log_warn (0, "Error on unknown file descriptor %d",
uf->file_descriptor);
- memif_file_del (uf);
+ if (uf->file_descriptor != ~0)
+ memif_file_del (uf);
return 0;
}