[pulseaudio-discuss] [PATCH] alsa-card: fix null dereference
Tanu Kaskinen
tanuk at iki.fi
Thu May 24 17:31:51 UTC 2018
jack->melem can be null if the jack disappears between probing the card
and the init_jacks() call. I don't know if jacks actually ever disappear
like that (seems unlikely), but this check is in any case needed as long
as init_jacks() has proper handling for the jack disappearing case
(rather than just an assert).
There was a crash report[1] that indicated that card_suspend_changed()
called report_jack_state() with a null melem. I don't know if that was
because the jack actually disappeared, or is there some other bug too.
[1] https://bugs.freedesktop.org/show_bug.cgi?id=104385
---
src/modules/alsa/module-alsa-card.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index b193d40cc..1f78f18d1 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -640,7 +640,8 @@ static pa_hook_result_t card_suspend_changed(pa_core *c, pa_card *card, struct u
if (card->suspend_cause == 0) {
/* We were unsuspended, update jack state in case it changed while we were suspended */
PA_HASHMAP_FOREACH(jack, u->jacks, state) {
- report_jack_state(jack->melem, 0);
+ if (jack->melem)
+ report_jack_state(jack->melem, 0);
}
}
--
2.17.0
More information about the pulseaudio-discuss
mailing list