diff --git a/0007-Fix-access-of-freed-memory-in-namehints.patch b/0007-Fix-access-of-freed-memory-in-namehints.patch new file mode 100644 index 0000000..4f10e60 --- /dev/null +++ b/0007-Fix-access-of-freed-memory-in-namehints.patch @@ -0,0 +1,116 @@ +From 23bf1dce9438c0cf74357928289aa8f06957c283 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Fri, 13 Sep 2013 13:21:44 -0400 +Subject: [PATCH] Fix access of freed memory in namehints + +Sometimes a hook manipulates the config tree, which makes currently +running iterators point to freed memory. As a workaround, make two +copies, one for the iterators and another for the hooks. + +BugLink: https://bugs.launchpad.net/bugs/1008600 +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +--- + src/control/namehint.c | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) + +diff --git a/src/control/namehint.c b/src/control/namehint.c +index 8d5e925..28975a4 100644 +--- a/src/control/namehint.c ++++ b/src/control/namehint.c +@@ -406,7 +406,7 @@ static const next_devices_t next_devices[] = { + }; + #endif + +-static int add_card(snd_config_t *config, struct hint_list *list, int card) ++static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_list *list, int card) + { + int err, ok; + snd_config_t *conf, *n; +@@ -449,7 +449,7 @@ static int add_card(snd_config_t *config, struct hint_list *list, int card) + ok = 0; + for (device = 0; err >= 0 && device <= max_device; device++) { + list->device = device; +- err = try_config(config, list, list->siface, str); ++ err = try_config(rw_config, list, list->siface, str); + if (err < 0) + break; + ok++; +@@ -464,7 +464,7 @@ static int add_card(snd_config_t *config, struct hint_list *list, int card) + if (err < 0) { + list->card = card; + list->device = -1; +- err = try_config(config, list, list->siface, str); ++ err = try_config(rw_config, list, list->siface, str); + } + if (err == -ENOMEM) + goto __error; +@@ -493,7 +493,8 @@ static int get_card_name(struct hint_list *list, int card) + return 0; + } + +-static int add_software_devices(snd_config_t *config, struct hint_list *list) ++static int add_software_devices(snd_config_t *config, snd_config_t *rw_config, ++ struct hint_list *list) + { + int err; + snd_config_t *conf, *n; +@@ -509,7 +510,7 @@ static int add_software_devices(snd_config_t *config, struct hint_list *list) + continue; + list->card = -1; + list->device = -1; +- err = try_config(config, list, list->siface, str); ++ err = try_config(rw_config, list, list->siface, str); + if (err == -ENOMEM) + return -ENOMEM; + } +@@ -547,7 +548,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints) + struct hint_list list; + char ehints[24]; + const char *str; +- snd_config_t *conf, *local_config = NULL; ++ snd_config_t *conf, *local_config = NULL, *local_config_rw = NULL; + snd_config_update_t *local_config_update = NULL; + snd_config_iterator_t i, next; + int err; +@@ -557,6 +558,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints) + err = snd_config_update_r(&local_config, &local_config_update, NULL); + if (err < 0) + return err; ++ err = snd_config_copy(&local_config_rw, local_config); + list.list = NULL; + list.count = list.allocated = 0; + list.siface = iface; +@@ -586,9 +588,9 @@ int snd_device_name_hint(int card, const char *iface, void ***hints) + if (card >= 0) { + err = get_card_name(&list, card); + if (err >= 0) +- err = add_card(local_config, &list, card); ++ err = add_card(local_config, local_config_rw, &list, card); + } else { +- add_software_devices(local_config, &list); ++ add_software_devices(local_config, local_config_rw, &list); + err = snd_card_next(&card); + if (err < 0) + goto __error; +@@ -596,7 +598,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints) + err = get_card_name(&list, card); + if (err < 0) + goto __error; +- err = add_card(local_config, &list, card); ++ err = add_card(local_config, local_config_rw, &list, card); + if (err < 0) + goto __error; + err = snd_card_next(&card); +@@ -630,6 +632,8 @@ int snd_device_name_hint(int card, const char *iface, void ***hints) + if (list.cardname) + free(list.cardname); + } ++ if (local_config_rw) ++ snd_config_delete(local_config_rw); + if (local_config) + snd_config_delete(local_config); + if (local_config_update) +-- +1.8.4 + diff --git a/0008-HDA-Intel-present-up-to-8-HDMI-DP-outputs-via-hdmi-d.patch b/0008-HDA-Intel-present-up-to-8-HDMI-DP-outputs-via-hdmi-d.patch new file mode 100644 index 0000000..a37083a --- /dev/null +++ b/0008-HDA-Intel-present-up-to-8-HDMI-DP-outputs-via-hdmi-d.patch @@ -0,0 +1,131 @@ +From 383912ef83cb2d5835239a23f6afc6198697a587 Mon Sep 17 00:00:00 2001 +From: Anssi Hannula +Date: Mon, 23 Sep 2013 00:41:50 +0300 +Subject: [PATCH] HDA-Intel: present up to 8 HDMI/DP outputs via "hdmi" device + +Some new AMD cards have HDA codecs presenting 6 connected HDMI/DP pin +nodes (plus 1 unconnected pin node) according to the ALSA card database. + +Example: +http://www.alsa-project.org/db/?f=de3ced7af41de0ed54d218650e5e2f16c511787b + +Bump the maximum number of presented HDMI outputs per card via the +"hdmi" PCM from 4 to 8 (so that the last possible device is DEV=7). + +Note that HDMI PCM devices DEV=4..7 use shared PCM device numbers, so +HDA cards that have over 4 audio PCM devices or multiple S/PDIF or modem +devices will have their remaining PCM devices misrepresented as HDMI +devices. + +Signed-off-by: Anssi Hannula +Signed-off-by: Takashi Iwai +--- + src/conf/cards/HDA-Intel.conf | 92 +++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 92 insertions(+) + +diff --git a/src/conf/cards/HDA-Intel.conf b/src/conf/cards/HDA-Intel.conf +index 3957c12..7976b6c 100644 +--- a/src/conf/cards/HDA-Intel.conf ++++ b/src/conf/cards/HDA-Intel.conf +@@ -305,6 +305,98 @@ HDA-Intel.pcm.hdmi.3 { + } + } + ++HDA-Intel.pcm.hdmi.4 { ++ @args [ CARD AES0 AES1 AES2 AES3 ] ++ @args.CARD { type string } ++ @args.AES0 { type integer } ++ @args.AES1 { type integer } ++ @args.AES2 { type integer } ++ @args.AES3 { type integer } ++ @func refer ++ name { ++ @func concat ++ strings [ ++ "cards.HDA-Intel.pcm.hdmi.common:" ++ "CARD=" $CARD "," ++ "DEVICE=10," ++ "CTLINDEX=4," ++ "AES0=" $AES0 "," ++ "AES1=" $AES1 "," ++ "AES2=" $AES2 "," ++ "AES3=" $AES3 ++ ] ++ } ++} ++ ++HDA-Intel.pcm.hdmi.5 { ++ @args [ CARD AES0 AES1 AES2 AES3 ] ++ @args.CARD { type string } ++ @args.AES0 { type integer } ++ @args.AES1 { type integer } ++ @args.AES2 { type integer } ++ @args.AES3 { type integer } ++ @func refer ++ name { ++ @func concat ++ strings [ ++ "cards.HDA-Intel.pcm.hdmi.common:" ++ "CARD=" $CARD "," ++ "DEVICE=11," ++ "CTLINDEX=5," ++ "AES0=" $AES0 "," ++ "AES1=" $AES1 "," ++ "AES2=" $AES2 "," ++ "AES3=" $AES3 ++ ] ++ } ++} ++ ++HDA-Intel.pcm.hdmi.6 { ++ @args [ CARD AES0 AES1 AES2 AES3 ] ++ @args.CARD { type string } ++ @args.AES0 { type integer } ++ @args.AES1 { type integer } ++ @args.AES2 { type integer } ++ @args.AES3 { type integer } ++ @func refer ++ name { ++ @func concat ++ strings [ ++ "cards.HDA-Intel.pcm.hdmi.common:" ++ "CARD=" $CARD "," ++ "DEVICE=12," ++ "CTLINDEX=6," ++ "AES0=" $AES0 "," ++ "AES1=" $AES1 "," ++ "AES2=" $AES2 "," ++ "AES3=" $AES3 ++ ] ++ } ++} ++ ++HDA-Intel.pcm.hdmi.7 { ++ @args [ CARD AES0 AES1 AES2 AES3 ] ++ @args.CARD { type string } ++ @args.AES0 { type integer } ++ @args.AES1 { type integer } ++ @args.AES2 { type integer } ++ @args.AES3 { type integer } ++ @func refer ++ name { ++ @func concat ++ strings [ ++ "cards.HDA-Intel.pcm.hdmi.common:" ++ "CARD=" $CARD "," ++ "DEVICE=13," ++ "CTLINDEX=7," ++ "AES0=" $AES0 "," ++ "AES1=" $AES1 "," ++ "AES2=" $AES2 "," ++ "AES3=" $AES3 ++ ] ++ } ++} ++ + + + HDA-Intel.pcm.modem.0 { +-- +1.8.4 + diff --git a/0009-snd_tlv_convert_from_dB-fix-decreasing-gain-across-e.patch b/0009-snd_tlv_convert_from_dB-fix-decreasing-gain-across-e.patch new file mode 100644 index 0000000..0f26c53 --- /dev/null +++ b/0009-snd_tlv_convert_from_dB-fix-decreasing-gain-across-e.patch @@ -0,0 +1,44 @@ +From 529706fc323813cfad7c48d3738ea0bfa5b8305e Mon Sep 17 00:00:00 2001 +From: Stephen Warren +Date: Mon, 30 Sep 2013 15:25:49 -0600 +Subject: [PATCH] snd_tlv_convert_from_dB: fix decreasing gain across entries + +Currently, for a TLV consisting of TLV_DB_SCALE_ITEMs, if e.g. alsamixer +calls snd_mixer_selem_set_playback_dB() with a value that is in-between +two TLV_DB_SCALE_ITEMs, and xdir is negative, the selected raw hardware +value is the minimum in the first range above that value, rather than the +maximum in the last range below that value. + +The user-visible symptom is that in alsamixer, pressing the down key to +reduce the value sticks at certain points, and cannot be incrementally +reduced any further, although directly selecting a much lower value (e.g. +by pressing 0..9) works as expected. This is triggered e.g. by +sound/soc/codec/max98090.c's max98090_hp_tlv[]. + +Fix this by checking whether xdir is positive or not, rather than +checking whether it has a non-zero value. The code to select the previous +range's max value is already present. This matches how xdir is used in +other parts of the code. + +Signed-off-by: Stephen Warren +Signed-off-by: Takashi Iwai +--- + src/control/tlv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/control/tlv.c b/src/control/tlv.c +index 6b0b9f4..b08d887 100644 +--- a/src/control/tlv.c ++++ b/src/control/tlv.c +@@ -312,7 +312,7 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax, + submin, submax, + db_gain, value, xdir); + else if (db_gain < dbmin) { +- *value = xdir || pos == 2 ? submin : prev_submax; ++ *value = xdir > 0 || pos == 2 ? submin : prev_submax; + return 0; + } + prev_submax = submax; +-- +1.8.4 + diff --git a/alsa.changes b/alsa.changes index c90cf96..12bc97e 100644 --- a/alsa.changes +++ b/alsa.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Oct 1 12:27:25 CEST 2013 - tiwai@suse.de + +- Backport upstream fixes: namehints double-free fix, expansion of + more HDMI devices, and a fix for dB conversion + 0007-Fix-access-of-freed-memory-in-namehints.patch + 0008-HDA-Intel-present-up-to-8-HDMI-DP-outputs-via-hdmi-d.patch + 0009-snd_tlv_convert_from_dB-fix-decreasing-gain-across-e.patch + ------------------------------------------------------------------- Fri Sep 6 10:03:55 CEST 2013 - tiwai@suse.de diff --git a/alsa.spec b/alsa.spec index b134a5c..e6fd16e 100644 --- a/alsa.spec +++ b/alsa.spec @@ -60,6 +60,9 @@ Patch3: 0003-pcm-Fix-a-wrong-value-shown-in-the-error-message-in-.patch Patch4: 0004-UCM-Document-some-standard-values.patch Patch5: 0005-hdspm.h-Update-LTC-ioctl-to-use-struct-hdspm_ltc.patch Patch6: 0006-Update-iatomic.h-functions-definitions-for-mips.patch +Patch7: 0007-Fix-access-of-freed-memory-in-namehints.patch +Patch8: 0008-HDA-Intel-present-up-to-8-HDMI-DP-outputs-via-hdmi-d.patch +Patch9: 0009-snd_tlv_convert_from_dB-fix-decreasing-gain-across-e.patch # rest suse patches Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff Url: http://www.alsa-project.org/ @@ -117,6 +120,9 @@ Architecture. %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 %if %suse_version == 1130 %patch99 -p1 %endif