02 May, 2018

1 commit

  • commit 088e861edffb84879cf0c0d1b02eda078c3a0ffe upstream.

    As recently Smatch suggested, a few places in ALSA control core codes
    may expand the array directly from the user-space value with
    speculation:

    sound/core/control.c:1003 snd_ctl_elem_lock() warn: potential spectre issue 'kctl->vd'
    sound/core/control.c:1031 snd_ctl_elem_unlock() warn: potential spectre issue 'kctl->vd'
    sound/core/control.c:844 snd_ctl_elem_info() warn: potential spectre issue 'kctl->vd'
    sound/core/control.c:891 snd_ctl_elem_read() warn: potential spectre issue 'kctl->vd'
    sound/core/control.c:939 snd_ctl_elem_write() warn: potential spectre issue 'kctl->vd'

    Although all these seem doing only the first load without further
    reference, we may want to stay in a safer side, so hardening with
    array_index_nospec() would still make sense.

    In this patch, we put array_index_nospec() to the common
    snd_ctl_get_ioff*() helpers instead of each caller. These helpers are
    also referred from some drivers, too, and basically all usages are to
    calculate the array index from the user-space value, hence it's better
    to cover there.

    BugLink: https://marc.info/?l=linux-kernel&m=152411496503418&w=2
    Reported-by: Dan Carpenter
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

30 Nov, 2017

1 commit

  • commit d6c0615f510bc1ee26cfb2b9a3343ac99b9c46fb upstream.

    The previous fix for addressing the breakage in vmaster slave
    initialization, commit a91d66129fb9 ("ALSA: hda - Fix incorrect TLV
    callback check introduced during set_fs() removal"), introduced a new
    helper to process over each slave kctl. However, this helper passes
    only the original kctl, not the virtual slave kctl. As a result,
    HD-audio driver (which is the only user so far) couldn't initialize
    the slave correctly because it's trying to update the value directly
    with the original kctl, not with the mapped kctl.

    This patch fixes the situation again by passing both the mapped slaved
    and original slave kctls to the function. Luckily there is a single
    caller as of now, so changing the call signature is no big matter.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197959
    Fixes: a91d66129fb9 ("ALSA: hda - Fix incorrect TLV callback check introduced during set_fs() removal")
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

18 Oct, 2017

1 commit

  • The commit 99b5c5bb9a54 ("ALSA: hda - Remove the use of set_fs()")
    converted the get_kctl_0dB_offset() call for killing set_fs() usage in
    HD-audio codec code. The conversion assumed that the TLV callback
    used in HD-audio code is only snd_hda_mixer_amp() and applies the TLV
    calculation locally.

    Although this assumption is correct, and all slave kctls are actually
    with that callback, the current code is still utterly buggy; it
    doesn't hit this condition and falls back to the next check. It's
    because the function gets called after adding slave kctls to vmaster.
    By assigning a slave kctl, the slave kctl object is faked inside
    vmaster code, and the whole kctl ops are overridden. Thus the
    callback op points to a different value from what we've assumed.

    More badly, as reported by the KERNEXEC and UDEREF features of PaX,
    the code flow turns into the unexpected pitfall. The next fallback
    check is SNDRV_CTL_ELEM_ACCESS_TLV_READ access bit, and this always
    hits for each kctl with TLV. Then it evaluates the callback function
    pointer wrongly as if it were a TLV array. Although currently its
    side-effect is fairly limited, this incorrect reference may lead to an
    unpleasant result.

    For addressing the regression, this patch introduces a new helper to
    vmaster code, snd_ctl_apply_vmaster_slaves(). This works similarly
    like the existing map_slaves() in hda_codec.c: it loops over the slave
    list of the given master, and applies the given function to each
    slave. Then the initializer function receives the right kctl object
    and we can compare the correct pointer instead of the faked one.

    Also, for catching the similar breakage in future, give an error
    message when the unexpected TLV callback is found and bail out
    immediately.

    Fixes: 99b5c5bb9a54 ("ALSA: hda - Remove the use of set_fs()")
    Reported-by: PaX Team
    Cc: # v4.13
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

02 Mar, 2017

1 commit

  • In the following patches we are going to remove various headers
    from sched.h and other headers that sched.h includes.

    To make those patches build cleanly prepare the scene by adding
    dependencies to various files that learned to rely on those
    to-be-removed dependencies.

    These changes all make sense standalone: they add a header for
    a data type that a particular .c or .h file is using.

    Acked-by: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

28 Apr, 2015

2 commits


04 Mar, 2015

1 commit


02 Feb, 2015

1 commit


15 Jul, 2014

1 commit


24 Jun, 2013

1 commit

  • Introduce a new helper function, snd_ctl_sync_vmaster(), which updates
    the slave put callbacks forcibly as well as calling the hook. This
    will be used in the upcoming patch in HD-audio codec driver for
    toggling the mute in vmaster slaves.

    Along with the new function, the old snd_ctl_sync_vmaster_hook() is
    replaced as a macro calling with the argument hook_only=true.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

12 Mar, 2013

1 commit

  • script/kernel-doc reports the following type of warnings (when run in verbose
    mode):

    Warning(sound/core/init.c:152): No description found for return value of
    'snd_card_create'

    To fix that:
    - add missing descriptions of function return values
    - use "Return:" sections to describe those return values

    Along the way:
    - complete some descriptions
    - fix some typos

    Signed-off-by: Yacine Belkadi
    Signed-off-by: Takashi Iwai

    Yacine Belkadi
     

19 Mar, 2012

1 commit


12 Mar, 2012

1 commit


18 Feb, 2012

1 commit


16 Nov, 2011

1 commit


22 May, 2011

1 commit


31 Mar, 2011

1 commit


22 Mar, 2011

1 commit

  • Add a function to dynamically replace a given control. If the
    control does not already exist, a third parameter is used to determine
    whether to actually add that control. This is useful in cases where
    downloadable firmware at runtime can add or replace existing controls.
    A separate patch needs to be made to allow ALSA Mixer to render the
    replaced controls on the fly.

    Signed-off-by: Dimitris Papastamos
    Signed-off-by: Takashi Iwai

    Dimitris Papastamos
     

11 Mar, 2011

1 commit


10 Jan, 2011

1 commit


06 Nov, 2009

2 commits


09 Mar, 2009

2 commits

  • Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • Added snd_ctl_add_slave_uncached() function to add a slave element
    with volatile controls. The values of normal slave elements are
    supposed to be cachable, i.e. they are changed only via the put
    callbacks. OTOH, when a slave element is volatile and its values may
    be changed by other reason (e.g. hardware status change), the values
    will get inconsistent.

    The new function allows the slave elements with volatile changes.
    When the slave is tied with this call, the native get callback is
    issued at each time so that the values are always updated.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

13 Jun, 2008

1 commit


24 Apr, 2008

1 commit


16 Oct, 2007

2 commits


09 Feb, 2007

2 commits


23 Sep, 2006

3 commits


03 Jan, 2006

1 commit


22 Jun, 2005

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds