* [PATCH] ALSA: hda: Validate codec address in get_response
@ 2026-12-05 9:37 Sreeraj S Kurup
0 siblings, 0 replies; only message in thread
From: Sreeraj S Kurup @ 2026-12-05 9:37 UTC (permalink / raw)
To: perex, tiwai; +Cc: linux-sound, linux-kernel, Sreeraj S Kurup
snd_hdac_bus_get_response() uses the codec address to access
the response array in the PIO and RIRB paths.
An invalid codec address can cause an out-of-bounds array
access. Add a check using snd_BUG_ON() and return -EINVAL
when the address is greater than or equal to HDA_MAX_CODECS.
This protects against invalid addresses passed by existing
callers as well as future callers, preventing access outside
the response array.
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
sound/hda/core/controller.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/hda/core/controller.c b/sound/hda/core/controller.c
index 3929dd195018..6f2baf3616ec 100644
--- a/sound/hda/core/controller.c
+++ b/sound/hda/core/controller.c
@@ -389,6 +389,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_send_cmd);
int snd_hdac_bus_get_response(struct hdac_bus *bus, unsigned int addr,
unsigned int *res)
{
+
+ if (snd_BUG_ON(addr >= HDA_MAX_CODECS))
+ return -EINVAL;
+
if (bus->use_pio_for_commands)
return snd_hdac_bus_get_response_pio(bus, addr, res);
--
2.55.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-05 9:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05 9:37 [PATCH] ALSA: hda: Validate codec address in get_response Sreeraj S Kurup
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®