- Backport upstream fixes: UCM updates, Broadwell UCM support, namehint fixes, fix faulty assert in PCM plugins, etc: 0001-ucm-document-some-standard-values.patch 0002-conf-ucm-broadwell-rt286-add-ucm-config.patch 0003-conf-ucm-Add-Makefile.am-for-broadwell-rt286-ucm-con.patch 0004-ucm-reformat-snd_use_case_get-doc.patch 0005-ucm-improve-jack-configuration-documentation.patch 0006-USB-audio-Sound-Blaster-HD-iec958-is-on-device-1.patch 0007-Sync-include-sound-asound.h-with-4.1-kernel.patch 0008-conf-ucm-broadwell-rt286-change-to-use-the-correct-j.patch 0009-namehint-Fix-invalid-list-access-in-snd_device_name_.patch 0010-namehint-Fix-the-listing-without-device-number.patch 0011-namehint-Fix-bad-free-with-invalid-iface-name.patch 0012-Allow-hint-for-ctl-hwdep-timer-and-seq.patch 0013-conf-Add-hint-descriptions-to-ctl-hwdep-seq-and-time.patch 0014-conf-ucm-broadwell-rt286-change-to-set-capture-volum.patch 0015-ucm-allow-multiple-devices-in-JackHWMute.patch 0016-pcm-Remove-assert-from-snd_pcm_hw_params_slave.patch OBS-URL: https://build.opensuse.org/request/show/308371 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=181
68 lines
2.1 KiB
Diff
68 lines
2.1 KiB
Diff
From bf98b4e3166c28343429119135644ba70c6e5277 Mon Sep 17 00:00:00 2001
|
|
From: Takashi Iwai <tiwai@suse.de>
|
|
Date: Thu, 30 Apr 2015 12:26:43 +0200
|
|
Subject: [PATCH 09/16] namehint: Fix invalid list access in
|
|
snd_device_name_hint()
|
|
|
|
snd_device_name_hint() tries to free the allocated list at the error
|
|
path via snd_device_name_free_hint(). But snd_device_name_free_hint()
|
|
expects a list terminated by NULL while snd_device_name_hint() doesn't
|
|
add it. Adding it may again result in an error and thus isn't
|
|
guaranteed to work. Hence we can't add NULL at the error path.
|
|
|
|
Instead, now the code always allocates one entry more, and zero-clears
|
|
the newly allocated beforehand to guarantee the NULL termination.
|
|
|
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
---
|
|
src/control/namehint.c | 21 ++++++++++-----------
|
|
1 file changed, 10 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/src/control/namehint.c b/src/control/namehint.c
|
|
index 28975a400b75..66de634d3550 100644
|
|
--- a/src/control/namehint.c
|
|
+++ b/src/control/namehint.c
|
|
@@ -52,10 +52,11 @@ static int hint_list_add(struct hint_list *list,
|
|
{
|
|
char *x;
|
|
|
|
- if (list->count == list->allocated) {
|
|
+ if (list->count + 1 >= list->allocated) {
|
|
char **n = realloc(list->list, (list->allocated + 10) * sizeof(char *));
|
|
if (n == NULL)
|
|
return -ENOMEM;
|
|
+ memset(n + list->allocated, 0, 10 * sizeof(*n));
|
|
list->allocated += 10;
|
|
list->list = n;
|
|
}
|
|
@@ -620,18 +621,16 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
|
|
}
|
|
err = 0;
|
|
__error:
|
|
- if (err < 0) {
|
|
+ /* add an empty entry if nothing has been added yet; the caller
|
|
+ * expects non-NULL return
|
|
+ */
|
|
+ if (!err && !list.list)
|
|
+ err = hint_list_add(&list, NULL, NULL);
|
|
+ if (err < 0)
|
|
snd_device_name_free_hint((void **)list.list);
|
|
- if (list.cardname)
|
|
- free(list.cardname);
|
|
- } else {
|
|
- err = hint_list_add(&list, NULL, NULL);
|
|
- if (err < 0)
|
|
- goto __error;
|
|
+ else
|
|
*hints = (void **)list.list;
|
|
- if (list.cardname)
|
|
- free(list.cardname);
|
|
- }
|
|
+ free(list.cardname);
|
|
if (local_config_rw)
|
|
snd_config_delete(local_config_rw);
|
|
if (local_config)
|
|
--
|
|
2.4.1
|
|
|