metrics: add check for invalid key
This patchset adds a check to rte_metrics_update_values() that prevents the updating of metrics when presented with an invalid metric key. Previously, doing the latter could result in a crash. Fixes: 349950ddb9c5 ("metrics: add information metrics library") Cc: stable@dpdk.org Signed-off-by: Remy Horton <remy.horton@intel.com> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
parent
90b0e5aaf4
commit
50d2459fdd
@ -159,6 +159,11 @@ rte_metrics_update_values(int port_id,
|
||||
stats = memzone->addr;
|
||||
|
||||
rte_spinlock_lock(&stats->lock);
|
||||
|
||||
if (key >= stats->cnt_stats) {
|
||||
rte_spinlock_unlock(&stats->lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
idx_metric = key;
|
||||
cnt_setsize = 1;
|
||||
while (idx_metric < stats->cnt_stats) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user