aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/unix/cli.c
diff options
context:
space:
mode:
authorSteve Shin <jonshin@cisco.com>2018-06-29 09:40:20 -0700
committerDave Barach <openvpp@barachs.net>2018-06-30 13:50:21 +0000
commit0d5a195ce457a62b60ae59d451067f3fd26f57c9 (patch)
treead5c4f02705847800b8016b9494890a3ea14ca94 /src/vlib/unix/cli.c
parent0d60a0f8280fa7c902230a38956b1653e1ec7f3e (diff)
cli: Validate cli_file_index on quit command
VPP crash happens with 'vppctl quit quit' command. The 2nd quit command tries to access the file index which is already freed by the first quit. This can be avoided to validate cli_file_index. Change-Id: I880514c93523db2a727d7510c97950582cd6a6c8 Signed-off-by: Steve Shin <jonshin@cisco.com>
Diffstat (limited to 'src/vlib/unix/cli.c')
-rw-r--r--src/vlib/unix/cli.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 727b9544854..596f41809e6 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2489,6 +2489,10 @@ unix_cli_kill (unix_cli_main_t * cm, uword cli_file_index)
clib_file_t *uf;
int i;
+ /* Validate cli_file_index */
+ if (pool_is_free_index (cm->cli_file_pool, cli_file_index))
+ return;
+
cf = pool_elt_at_index (cm->cli_file_pool, cli_file_index);
uf = pool_elt_at_index (fm->file_pool, cf->clib_file_index);