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

Joel Stanley joel at jms.id.au
Fri Oct 9 23:38:31 AEDT 2020


On Fri, 9 Oct 2020 at 03:54, Amitay Isaacs <amitay at ozlabs.org> wrote:
>
> 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

causes

> 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

references

> is to drop freeing sbefifo context.  Proper fix will be implemented later.
>
> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>

Reviewed-by: Joel Stanley <joel at jms.id.au>

> ---
>  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
>
> --
> Pdbg mailing list
> Pdbg at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg


More information about the Pdbg mailing list