diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-11-03 13:18:07 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-11-18 21:20:18 +0300 |
commit | 2825a5bf3ca5d7a9ed27738aad5f7e26e1857111 (patch) | |
tree | cbc254f8242a30c44934c47e06ccdf6f17344645 /sound/hda/ext | |
parent | 22901751d2697a1c824df22c4c4af8cb4ecd3f68 (diff) | |
download | linux-2825a5bf3ca5d7a9ed27738aad5f7e26e1857111.tar.xz |
ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link()
[ Upstream commit 158e1886b6262c1d1c96a18c85fac5219b8bf804 ]
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: 0b00a5615dc4 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound/hda/ext')
-rw-r--r-- | sound/hda/ext/hdac_ext_controller.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/hda/ext/hdac_ext_controller.c b/sound/hda/ext/hdac_ext_controller.c index 09ff209df4a3..c87187f63573 100644 --- a/sound/hda/ext/hdac_ext_controller.c +++ b/sound/hda/ext/hdac_ext_controller.c @@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, return NULL; if (bus->idx != bus_idx) return NULL; + if (addr < 0 || addr > 31) + return NULL; list_for_each_entry(hlink, &bus->hlink_list, list) { for (i = 0; i < HDA_MAX_CODECS; i++) { |