DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] telemetry: fix accessing callbacks list using lock
@ 2021-05-05 15:22 Ciara Power
  2021-05-05 15:35 ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Ciara Power @ 2021-05-05 15:22 UTC (permalink / raw)
  To: dev; +Cc: stable, bruce.richardson, Ciara Power, David Marchand

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

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reported-by: David Marchand <david.marchand@redhat.com>
---
 lib/telemetry/telemetry.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 386d0080bc..68b479e0e4 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -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;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] telemetry: fix accessing callbacks list using lock
  2021-05-05 15:22 [dpdk-dev] [PATCH] telemetry: fix accessing callbacks list using lock Ciara Power
@ 2021-05-05 15:35 ` Bruce Richardson
  2021-05-05 16:15   ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2021-05-05 15:35 UTC (permalink / raw)
  To: Ciara Power; +Cc: dev, stable, David Marchand

On Wed, May 05, 2021 at 03:22:48PM +0000, Ciara Power wrote:
> 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
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> Reported-by: David Marchand <david.marchand@redhat.com>
> ---

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] telemetry: fix accessing callbacks list using lock
  2021-05-05 15:35 ` Bruce Richardson
@ 2021-05-05 16:15   ` David Marchand
  0 siblings, 0 replies; 3+ messages in thread
From: David Marchand @ 2021-05-05 16:15 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Ciara Power, dev, dpdk stable

On Wed, May 5, 2021 at 5:36 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Wed, May 05, 2021 at 03:22:48PM +0000, Ciara Power wrote:
> > 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>

Applied, thanks.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-05 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 15:22 [dpdk-dev] [PATCH] telemetry: fix accessing callbacks list using lock Ciara Power
2021-05-05 15:35 ` Bruce Richardson
2021-05-05 16:15   ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).