telemetry: fix race on callbacks list
authorCiara Power <ciara.power@intel.com>
Wed, 5 May 2021 15:22:48 +0000 (15:22 +0000)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 5 May 2021 16:21:26 +0000 (18:21 +0200)
commit048960272e809ea728110748d317ddce1d731a27
tree5898aa2364cee5d24a1c47c7c36028f1938ddb5f
parentdbab5118745f3a8d129beb470cf2ef7092e4a789
telemetry: fix race on callbacks list

The list_commands() function accessed the callbacks list,
but did not take the lock. This may have caused inconsistencies if
callbacks were being registered at the same time.
This is now fixed to lock before iterating the list,
and unlock afterwards.

Fixes: f38748736eb2 ("telemetry: add default callback commands")
Cc: stable@dpdk.org
Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/telemetry/telemetry.c