Skip to contentSkip to conversation

ALSA: hda - Fixes double fault in nvhdmi_chmap_cea_alloc_validate_get_type

PATCH Applied Subhransu S. Prusty 2 participants 2 messages Mar 14, 2016 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda - Fixes double fault in nvhdmi_chmap_cea_alloc_validate_get_type

nvhdmi_chmap_cea_alloc_validate_get_type calls itself recursively using chmap ops causing the double fault.

Fixed by adding the default validate_get_type handling inside nvdia validate_get_type handler.

---
 sound/pci/hda/patch_hdmi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/hda/patch_hdmi.c +6 -2
index f59e87b..a386a65 100644
@@ -2827,8 +2827,12 @@ static int nvhdmi_chmap_cea_alloc_validate_get_type(struct hdac_chmap *chmap,
 	if (cap->ca_index == 0x00 && channels == 2)
 		return SNDRV_CTL_TLVT_CHMAP_FIXED;
 
-	return chmap->ops.chmap_cea_alloc_validate_get_type(
-				chmap, cap, channels);
+	/* If the speaker allocation matches the channel count, it is OK. */
+	if (cap->channels != channels)
+		return -1;
+
+	/* all channels are remappable freely */
+	return SNDRV_CTL_TLVT_CHMAP_VAR;
 }
 
 static int nvhdmi_chmap_validate(struct hdac_chmap *chmap,
Signature · 1 line
1.9.1
Applied
#1 lore raw
Quoted 7 lines · Subhransu S. Prusty

nvhdmi_chmap_cea_alloc_validate_get_type calls itself recursively using chmap ops causing the double fault.

Fixed by adding the default validate_get_type handling inside nvdia validate_get_type handler.

Quoted 6 lines

Applied, thanks.

Takashi

Quoted 26 lines
---
 sound/pci/hda/patch_hdmi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/hda/patch_hdmi.c +6 -2
index f59e87b..a386a65 100644
@@ -2827,8 +2827,12 @@ static int nvhdmi_chmap_cea_alloc_validate_get_type(struct hdac_chmap *chmap,
 	if (cap->ca_index == 0x00 && channels == 2)
 		return SNDRV_CTL_TLVT_CHMAP_FIXED;
 
-	return chmap->ops.chmap_cea_alloc_validate_get_type(
-				chmap, cap, channels);
+	/* If the speaker allocation matches the channel count, it is OK. */
+	if (cap->channels != channels)
+		return -1;
+
+	/* all channels are remappable freely */
+	return SNDRV_CTL_TLVT_CHMAP_VAR;
 }
 
 static int nvhdmi_chmap_validate(struct hdac_chmap *chmap,
Signature · 1 line
1.9.1