From 77651e130e45a3565de558daeb1fc7cb99a1cb5c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 11 Oct 2023 11:39:45 +0200 Subject: [PATCH] alsa: add extra checks Check if the device is opened when doing _prepare or _start. When it was a follower but failed to open, we might otherwise crash. Fixes #3554 --- spa/plugins/alsa/alsa-pcm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index ffcf4d5d0..dd2da5eb9 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -3020,6 +3020,9 @@ int spa_alsa_prepare(struct state *state) struct state *follower; int err; + if (!state->opened) + return -EIO; + spa_alsa_pause(state); if (state->prepared) @@ -3052,6 +3055,8 @@ int spa_alsa_start(struct state *state) if (state->started) return 0; + else if (!state->opened) + return -EIO; spa_alsa_prepare(state);