Commit 158e1886 authored by Dan Carpenter's avatar Dan Carpenter Committed by Takashi Iwai

ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link()

This is harmless, but the "addr" comes from the user and it could lead
to a negative shift or to shift wrapping if it's too high.

Fixes: 0b00a561 ("ALSA: hdac_ext: add hdac extended controller")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20201103101807.GC1127762@mwandaSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9fc149c3
...@@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, ...@@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
return NULL; return NULL;
if (bus->idx != bus_idx) if (bus->idx != bus_idx)
return NULL; return NULL;
if (addr < 0 || addr > 31)
return NULL;
list_for_each_entry(hlink, &bus->hlink_list, list) { list_for_each_entry(hlink, &bus->hlink_list, list) {
for (i = 0; i < HDA_MAX_CODECS; i++) { for (i = 0; i < HDA_MAX_CODECS; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment