[Pdbg] [PATCH] libpdbg: Do not free sbefifo during release of all targets

Amitay Isaacs amitay at ozlabs.org
Fri Oct 9 14:51:55 AEDT 2020


Pdbg releases all targets before exiting.  P9 core/thread targets when
released use scoms for special wakeup.  However, when using sbefifo
backend, sbefifo driver is released before core/thread targets.
This casuses segfault as scom access tries to use already free'd
sbefifo context.

Correct fix is to add reference counting on sbefifo context and free only
when all the refernces have been released.  A quick and dirty fix here
is to drop freeing sbefifo context.  Proper fix will be implemented later.

Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/sbefifo.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c
index 6e45088..9d68853 100644
--- a/libpdbg/sbefifo.c
+++ b/libpdbg/sbefifo.c
@@ -647,9 +647,11 @@ static int sbefifo_probe(struct pdbg_target *target)
 
 static void sbefifo_release(struct pdbg_target *target)
 {
-	struct sbefifo *sf = target_to_sbefifo(target);
-
-	sbefifo_disconnect(sf->sf_ctx);
+	/*
+	 * FIXME: Need to add reference counting for sbefifo context, so it is
+	 * not freed till every last hwunit using sbefifo driver has been
+	 * released.
+	 */
 }
 
 static struct mem sbefifo_mem = {
-- 
2.26.2



More information about the Pdbg mailing list