lkml.org 
[lkml]   [2020]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 014/101] ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link()
    Date
    From: Dan Carpenter <dan.carpenter@oracle.com>

    [ 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>
    ---
    sound/hda/ext/hdac_ext_controller.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/sound/hda/ext/hdac_ext_controller.c b/sound/hda/ext/hdac_ext_controller.c
    index 84b44cdae28a1..b96abebcfd1a4 100644
    --- a/sound/hda/ext/hdac_ext_controller.c
    +++ b/sound/hda/ext/hdac_ext_controller.c
    @@ -156,6 +156,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++) {
    --
    2.27.0


    \
     
     \ /
      Last update: 2020-11-17 14:21    [W:4.294 / U:0.100 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site