Skip to content

Commit 158e188

Browse files
Dan Carpentertiwai
authored andcommitted
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: 0b00a56 ("ALSA: hdac_ext: add hdac extended controller") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20201103101807.GC1127762@mwanda Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 9fc149c commit 158e188

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

sound/hda/ext/hdac_ext_controller.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
148148
return NULL;
149149
if (bus->idx != bus_idx)
150150
return NULL;
151+
if (addr < 0 || addr > 31)
152+
return NULL;
151153

152154
list_for_each_entry(hlink, &bus->hlink_list, list) {
153155
for (i = 0; i < HDA_MAX_CODECS; i++) {

0 commit comments

Comments
 (0)