telemetry: fix accessing callbacks list using lock
PATCH 1/1 telemetry: fix accessing callbacks list using lock
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.
--- lib/telemetry/telemetry.c | 2 ++ 1 file changed, 2 insertions(+)
lib/telemetry/telemetry.c +2 -0
@@ -104,8 +104,10 @@ list_commands(const char *cmd __rte_unused, const char *params __rte_unused,int i;rte_tel_data_start_array (d,RTE_TEL_STRING_VAL ); +rte_spinlock_lock (&callback_sl);for (i =0 ; i < num_callbacks; i++)rte_tel_data_add_array_string (d, callbacks[i].cmd); +rte_spinlock_unlock (&callback_sl);return 0 ; }
Signature · 1 line
2.25.1
Quoted 6 lines · Ciara Power
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.
Quoted 6 lines
Fixes f38748736eb2 ("telemetry: add default callback commands")Signed-off-by Ciara Power <[email protected]>Reported-by David Marchand <[email protected]>---
David Marchand
AppliedQuoted 8 lines · Bruce Richardson
Quoted 6 lines · Ciara Power
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.
Quoted 6 lines
Quoted 5 lines
Fixes f38748736eb2 ("telemetry: add default callback commands")Reported-by David Marchand <[email protected]>Signed-off-by Ciara Power <[email protected]>Acked-by Bruce Richardson <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand