slackware-current/source/l/pulseaudio/f5cacd94abcc47003bd88ad7ca1450de649ffb15.patch
Patrick J Volkerding 715f1e2e38 Mon Jan 15 21:08:12 UTC 2024
a/kernel-firmware-20240115_9b6d0b0-noarch-1.txz:  Upgraded.
a/kernel-generic-6.6.12-x86_64-1.txz:  Upgraded.
a/kernel-huge-6.6.12-x86_64-1.txz:  Upgraded.
a/kernel-modules-6.6.12-x86_64-1.txz:  Upgraded.
d/kernel-headers-6.6.12-x86-1.txz:  Upgraded.
k/kernel-source-6.6.12-noarch-1.txz:  Upgraded.
l/libxml2-2.12.4-x86_64-1.txz:  Upgraded.
l/pulseaudio-17.0-x86_64-2.txz:  Rebuilt.
  Patch regressions:
  [PATCH] alsa-ucm: Check UCM verb before working with device status.
  [PATCH] alsa-ucm: Replace port device UCM context assertion with an error.
l/readline-8.2.010-x86_64-1.txz:  Upgraded.
x/libinput-1.25.0-x86_64-1.txz:  Upgraded.
isolinux/initrd.img:  Rebuilt.
kernels/*:  Upgraded.
usb-and-pxe-installers/usbboot.img:  Rebuilt.
2024-01-15 22:41:39 +01:00

95 lines
4.3 KiB
Diff

From f5cacd94abcc47003bd88ad7ca1450de649ffb15 Mon Sep 17 00:00:00 2001
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Thu, 30 Nov 2023 20:17:22 +0300
Subject: [PATCH] alsa-ucm: Check UCM verb before working with device status
Some versions of the ALSA libraries run into a segmentation fault when
we query a UCM device/modifier status without first setting a UCM verb.
It's not a reasonable thing to do anyway, so check for this case and
return an error. Also do the check in other helpers.
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/801>
---
src/modules/alsa/alsa-ucm.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index bb9438f79..7f5136249 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -624,6 +624,11 @@ static long ucm_device_status(pa_alsa_ucm_config *ucm, pa_alsa_ucm_device *dev)
char *devstatus;
long status = 0;
+ if (!ucm->active_verb) {
+ pa_log_error("Failed to get status for UCM device %s: no UCM verb set", dev_name);
+ return -1;
+ }
+
devstatus = pa_sprintf_malloc("_devstatus/%s", dev_name);
if (snd_use_case_geti(ucm->ucm_mgr, devstatus, &status) < 0) {
pa_log_debug("Failed to get status for UCM device %s", dev_name);
@@ -637,6 +642,11 @@ static long ucm_device_status(pa_alsa_ucm_config *ucm, pa_alsa_ucm_device *dev)
static int ucm_device_disable(pa_alsa_ucm_config *ucm, pa_alsa_ucm_device *dev) {
const char *dev_name = pa_proplist_gets(dev->proplist, PA_ALSA_PROP_UCM_NAME);
+ if (!ucm->active_verb) {
+ pa_log_error("Failed to disable UCM device %s: no UCM verb set", dev_name);
+ return -1;
+ }
+
/* If any of dev's conflicting devices is enabled, trying to disable
* dev gives an error despite the fact that it's already disabled.
* Check that dev is enabled to avoid this error. */
@@ -657,6 +667,11 @@ static int ucm_device_disable(pa_alsa_ucm_config *ucm, pa_alsa_ucm_device *dev)
static int ucm_device_enable(pa_alsa_ucm_config *ucm, pa_alsa_ucm_device *dev) {
const char *dev_name = pa_proplist_gets(dev->proplist, PA_ALSA_PROP_UCM_NAME);
+ if (!ucm->active_verb) {
+ pa_log_error("Failed to enable UCM device %s: no UCM verb set", dev_name);
+ return -1;
+ }
+
/* We don't need to enable devices that are already enabled */
if (ucm_device_status(ucm, dev) > 0) {
pa_log_debug("UCM device %s is already enabled", dev_name);
@@ -707,6 +722,11 @@ static long ucm_modifier_status(pa_alsa_ucm_config *ucm, pa_alsa_ucm_modifier *m
char *modstatus;
long status = 0;
+ if (!ucm->active_verb) {
+ pa_log_error("Failed to get status for UCM modifier %s: no UCM verb set", mod_name);
+ return -1;
+ }
+
modstatus = pa_sprintf_malloc("_modstatus/%s", mod_name);
if (snd_use_case_geti(ucm->ucm_mgr, modstatus, &status) < 0) {
pa_log_debug("Failed to get status for UCM modifier %s", mod_name);
@@ -720,6 +740,11 @@ static long ucm_modifier_status(pa_alsa_ucm_config *ucm, pa_alsa_ucm_modifier *m
static int ucm_modifier_disable(pa_alsa_ucm_config *ucm, pa_alsa_ucm_modifier *mod) {
const char *mod_name = pa_proplist_gets(mod->proplist, PA_ALSA_PROP_UCM_NAME);
+ if (!ucm->active_verb) {
+ pa_log_error("Failed to disable UCM modifier %s: no UCM verb set", mod_name);
+ return -1;
+ }
+
/* We don't need to disable modifiers that are already disabled */
if (ucm_modifier_status(ucm, mod) == 0) {
pa_log_debug("UCM modifier %s is already disabled", mod_name);
@@ -738,6 +763,11 @@ static int ucm_modifier_disable(pa_alsa_ucm_config *ucm, pa_alsa_ucm_modifier *m
static int ucm_modifier_enable(pa_alsa_ucm_config *ucm, pa_alsa_ucm_modifier *mod) {
const char *mod_name = pa_proplist_gets(mod->proplist, PA_ALSA_PROP_UCM_NAME);
+ if (!ucm->active_verb) {
+ pa_log_error("Failed to disable UCM modifier %s: no UCM verb set", mod_name);
+ return -1;
+ }
+
/* We don't need to enable modifiers that are already enabled */
if (ucm_modifier_status(ucm, mod) > 0) {
pa_log_debug("UCM modifier %s is already enabled", mod_name);
--
GitLab