From 8c13bf36f418e8476c268d376e79491fcb48a0f2 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 5 Apr 2021 20:29:28 +0200 Subject: [PATCH 1/1] prebuffer: Remove buffer tree node on errors. 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/prebuffer_filter.c b/prebuffer_filter.c index 1988e6e0..9a801900 100644 --- a/prebuffer_filter.c +++ b/prebuffer_filter.c @@ -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) -- 2.39.2