Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Umang Jain <uajain@igalia.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Dmitry Baryshkov <lumag@kernel.org>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-dev@igalia.com, Umang Jain <uajain@igalia.com>
Subject: [PATCH] ALSA: pcm: Harden the spk_alloc assumption check
Date: Thu, 20 Nov 2025 19:47:57 +0530	[thread overview]
Message-ID: <20251120141757.901505-1-uajain@igalia.com> (raw)

If the parsed ELD has spk_alloc=0, it currently assigns the parsed ELD
spk_alloc to 0xffff. However, we should also check if there is at least
one SAD (Short audio descriptor) to enforce the assumption, as ELD
without any sad_count, is usually considered invalid for e.g. in
commit ce9778b7a0272("ALSA: hda/hdmi: Consider ELD is invalid when no
SAD is present").

Signed-off-by: Umang Jain <uajain@igalia.com>
---
 sound/core/pcm_drm_eld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/pcm_drm_eld.c b/sound/core/pcm_drm_eld.c
index 688eefce82fa..cb2eebaac85f 100644
--- a/sound/core/pcm_drm_eld.c
+++ b/sound/core/pcm_drm_eld.c
@@ -379,7 +379,7 @@ int snd_parse_eld(struct device *dev, struct snd_parsed_hdmi_eld *e,
 	 * in console or for audio devices. Assume the highest speakers
 	 * configuration, to _not_ prohibit multi-channel audio playback.
 	 */
-	if (!e->spk_alloc)
+	if (!e->spk_alloc && e->sad_count)
 		e->spk_alloc = 0xffff;
 
 	return 0;
-- 
2.51.2


             reply	other threads:[~2025-11-20 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20 14:17 Umang Jain [this message]
2025-11-21  9:35 ` [PATCH] ALSA: pcm: Harden the spk_alloc assumption check Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251120141757.901505-1-uajain@igalia.com \
    --to=uajain@igalia.com \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox