]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
prebuffer: Remove buffer tree node on errors.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 5 Apr 2021 18:29:28 +0000 (20:29 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 12 Apr 2021 13:16:52 +0000 (15:16 +0200)
When the ->post_select method of a filter returns negative, it *must*
remove its buffer tree node as well. The prebuffer missed to do that,
which results in a stale reference to the buffer tree which keeps
the audiod slot busy. When no more slots are free, audiod hangs or
exits with a "no more free slots" message. This patch avoids this.

prebuffer_filter.c

index 1988e6e0fcc2d0b5f13c215fa6857524e6442e43..9a801900c157e1da2da979c92d7bd60d03e21b9c 100644 (file)
@@ -61,10 +61,10 @@ static int prebuffer_post_select(__a_unused struct sched *s, void *context)
 
        ret = task_get_notification(fn->task);
        if (ret < 0)
-               return ret;
+               goto fail;
        ret = btr_node_status(btrn, size, BTR_NT_INTERNAL);
        if (ret < 0)
-               return ret;
+               goto fail;
        if (ppd->barrier.tv_sec == 0)
                return 0;
        if (tv_diff(now, &ppd->barrier, NULL) < 0)
@@ -73,6 +73,9 @@ static int prebuffer_post_select(__a_unused struct sched *s, void *context)
                return 0;
        btr_splice_out_node(&fn->btrn);
        return -E_PREBUFFER_SUCCESS;
+fail:
+       btr_remove_node(&fn->btrn);
+       return ret;
 }
 
 static void prebuffer_open(struct filter_node *fn)