summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/commands.c
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2019-09-04 14:07:53 +0200
committerPatrice Buriez <patrice.buriez@intel.com>2019-10-09 12:12:09 +0000
commit73b79d29bc926a87e317c3881c197fc2db64e9d0 (patch)
tree541db297449d981edb7bbed4fb13a5f87c874b04 /VNFs/DPPD-PROX/commands.c
parent67560734daab81c050a13d3b435d7eca4442c199 (diff)
Fix parsing parameter errors in start and stop commands
Some wrong parameters in start (such as "start all 4" while there are only less than 4 tasks available on some cores) and stop command could have potentially caused a crash in some cases. Change-Id: I6dc201575b574c53ded242ea795c35de82fb787e Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/commands.c')
-rw-r--r--VNFs/DPPD-PROX/commands.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/VNFs/DPPD-PROX/commands.c b/VNFs/DPPD-PROX/commands.c
index 50d04d21..969dec39 100644
--- a/VNFs/DPPD-PROX/commands.c
+++ b/VNFs/DPPD-PROX/commands.c
@@ -137,10 +137,14 @@ void start_cores(uint32_t *cores, int count, int task_id)
targ = &lconf->targs[tid];
start_l3(targ);
}
- } else {
+ } else if (task_id < lconf->n_tasks_all) {
targ = &lconf->targs[task_id];
start_l3(targ);
+ } else {
+ plog_warn("Invalid task id %d on core %u\n", task_id, cores[i]);
+ continue;
}
+ if (wait_command_handled(lconf) == -1) return;
lconf->msg.type = LCONF_MSG_START;
lconf->msg.task_id = task_id;
lconf_set_req(lconf);
@@ -177,6 +181,10 @@ void stop_cores(uint32_t *cores, int count, int task_id)
for (int i = 0; i < count; ++i) {
struct lcore_cfg *lconf = &lcore_cfg[cores[i]];
+ if (task_id >= lconf->n_tasks_all) {
+ plog_warn("Trying to stop invalid task id %d on core %u\n", task_id, cores[i]);
+ continue;
+ }
if (lconf->n_tasks_run) {
if (wait_command_handled(lconf) == -1) return;
@@ -890,6 +898,7 @@ void cmd_reset_port(uint8_t portid)
plog_warn("Failed to restart port %d\n", portid);
}
}
+
void cmd_write_reg(uint8_t port_id, unsigned int id, unsigned int val)
{
if (!port_is_active(port_id)) {