1. 13 Mar, 2018 1 commit
  2. 12 Mar, 2018 1 commit
  3. 08 Mar, 2018 2 commits
    • Takashi Iwai's avatar
      ALSA: vmaster: Zero-clear ctl before calling slave get · 7a33a02f
      Takashi Iwai authored
      Use kzalloc() instead of kmalloc() so that we don't need to rely fully
      on the slave get() callback to clear the control value that might be
      copied to user-space.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7a33a02f
    • Takashi Iwai's avatar
      ALSA: vmaster: Propagate slave error · 2e2c177c
      Takashi Iwai authored
      In slave_update() of vmaster code ignores the error from the slave
      get() callback and copies the values.  It's not only about the missing
      error code but also that this may potentially lead to a leak of
      uninitialized variables when the slave get() don't clear them.
      
      This patch fixes slave_update() not to copy the potentially
      uninitialized values when an error is returned from the slave get()
      callback, and to propagate the error value properly.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2e2c177c
  4. 01 Mar, 2018 1 commit
  5. 28 Feb, 2018 3 commits
    • Richard Fitzgerald's avatar
      ALSA: control: Fix a bunch of whitespace errors · dd5f313b
      Richard Fitzgerald authored
      Remove a bunch of trailing whitespace errors. They are
      fairly annoying if you have your editor set to strip trailing
      whitespace because you find you've introduced more changes
      than you were trying to make.
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      dd5f313b
    • Takashi Iwai's avatar
      Merge branch 'for-linus' into for-next · 3b8bd500
      Takashi Iwai authored
      Back-merge for applying a cleanup to core/control
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3b8bd500
    • Richard Fitzgerald's avatar
      ALSA: control: Fix memory corruption risk in snd_ctl_elem_read · 5a23699a
      Richard Fitzgerald authored
      The patch "ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE
      operations" introduced a potential for kernel memory corruption due
      to an incorrect if statement allowing non-readable controls to fall
      through and call the get function. For TLV controls a driver can omit
      SNDRV_CTL_ELEM_ACCESS_READ to ensure that only the TLV get function
      can be called. Instead the normal get() can be invoked unexpectedly
      and as the driver expects that this will only be called for controls
      <= 512 bytes, potentially try to copy >512 bytes into the 512 byte
      return array, so corrupting kernel memory.
      
      The problem is an attempt to refactor the snd_ctl_elem_read function
      to invert the logic so that it conditionally aborted if the control
      is unreadable instead of conditionally executing. But the if statement
      wasn't inverted correctly.
      
      The correct inversion of
      
          if (a && !b)
      
      is
          if (!a || b)
      
      Fixes: becf9e5d ("ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations")
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5a23699a
  6. 27 Feb, 2018 1 commit
  7. 26 Feb, 2018 1 commit
    • Takashi Iwai's avatar
      ALSA: hda - Fix pincfg at resume on Lenovo T470 dock · 71db96dd
      Takashi Iwai authored
      We've added a quirk to enable the recent Lenovo dock support, where it
      overwrites the pin configs of NID 0x17 and 19, not only updating the
      pin config cache.  It works right after the boot, but the problem is
      that the pin configs are occasionally cleared when the machine goes to
      PM.  Meanwhile the quirk writes the pin configs only at the pre-probe,
      so this won't be applied any longer.
      
      For addressing that issue, this patch moves the code to overwrite the
      pin configs into HDA_FIXUP_ACT_INIT section so that it's always
      applied at both probe and resume time.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195161
      Fixes: 61fcf8ec ("ALSA: hda/realtek - Enable Thinkpad Dock device for ALC298 platform")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      71db96dd
  8. 24 Feb, 2018 2 commits
  9. 22 Feb, 2018 1 commit
    • Takashi Iwai's avatar
      ALSA: x86: hdmi: Add single_port option for compatible behavior · 7229b12f
      Takashi Iwai authored
      The recent support for the multiple PCM devices allowed user to use
      multiple HDMI/DP outputs, but at the same time, the PCM stream
      assignment has been changed, too.  Due to that, the former PCM#0
      (there was only one stream in the past) is likely assigned to a
      different one (e.g. PCM#2), and it ends up with the regression when
      user sticks with the fixed configuration using the device#0.
      
      Although the multiple monitor support shouldn't matter when user
      deploys the backend like PulseAudio that checks the jack detection
      state, the behavior change isn't always acceptable for some users.
      
      As a mitigation, this patch introduces an option to switch the
      behavior back to the old-good-days: when the new option,
      single_port=1, is passed, the driver creates only a single PCM device,
      and it's assigned to the first connected one, like the earlier
      versions did.  The option is turned off as default still to support
      the multiple monitors.
      
      Fixes: 8a2d6ae1 ("ALSA: x86: Register multiple PCM devices for the LPE audio card")
      Reported-and-tested-by: default avatarHubert Mantel <mantel@metadox.de>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7229b12f
  10. 20 Feb, 2018 1 commit
  11. 14 Feb, 2018 7 commits
    • Jan-Marek Glogowski's avatar
      ALSA: hda/realtek: PCI quirk for Fujitsu U7x7 · fdcc968a
      Jan-Marek Glogowski authored
      These laptops have a combined jack to attach headsets, the U727 on
      the left, the U757 on the right, but a headsets microphone doesn't
      work. Using hdajacksensetest I found that pin 0x19 changed the
      present state when plugging the headset, in addition to 0x21, but
      didn't have the correct configuration (shown as "Not connected").
      
      So this sets the configuration to the same values as the headphone
      pin 0x21 except for the device type microphone, which makes it
      work correctly. With the patch the configured pins for U727 are
      
      Pin 0x12 (Internal Mic, Mobile-In): present = No
      Pin 0x14 (Internal Speaker): present = No
      Pin 0x19 (Black Mic, Left side): present = No
      Pin 0x1d (Internal Aux): present = No
      Pin 0x21 (Black Headphone, Left side): present = No
      Signed-off-by: default avatarJan-Marek Glogowski <glogow@fbihome.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      fdcc968a
    • Takashi Iwai's avatar
      ALSA: seq: Fix racy pool initializations · d15d662e
      Takashi Iwai authored
      ALSA sequencer core initializes the event pool on demand by invoking
      snd_seq_pool_init() when the first write happens and the pool is
      empty.  Meanwhile user can reset the pool size manually via ioctl
      concurrently, and this may lead to UAF or out-of-bound accesses since
      the function tries to vmalloc / vfree the buffer.
      
      A simple fix is to just wrap the snd_seq_pool_init() call with the
      recently introduced client->ioctl_mutex; as the calls for
      snd_seq_pool_init() from other side are always protected with this
      mutex, we can avoid the race.
      Reported-by: default avatar范龙飞 <long7573@126.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d15d662e
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: add a IOMMU workaround · 04f8773a
      Maciej S. Szmigiero authored
      The Audigy 2 CA0102 chip (but most likely others from the emu10k1 family,
      too) has a problem that from time to time it likes to do few DMA reads a
      bit beyond its normal allocation and gets very confused if these reads get
      blocked by a IOMMU.
      
      For the first (reserved) page this happens multiple times at every
      playback, for various synth pages it happens randomly, rarely for PCM
      playback buffers and the page table memory itself.
      All these reads seem to follow a similar pattern, observed read offsets
      beyond the allocation end were 0x00, 0x40, 0x80 and 0xc0 (PCI cache line
      multiples), so it looks like the device tries to accesses up to 256 extra
      bytes.
      
      As a workaround let's widen these DMA allocations by an extra page if we
      detect that the device is behind a non-passthrough IOMMU (the DMA memory
      should be relatively plenty on IOMMU systems).
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      04f8773a
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: make sure synth DMA pages are allocated with DMA functions · 055e0ae1
      Maciej S. Szmigiero authored
      Commit a5003fc0 ("[ALSA] emu10k1 - simplify page allocation for synth")
      switched from using the DMA allocator for synth DMA pages to manually
      calling alloc_page().
      However, this usage has an implicit assumption that the DMA address space
      for the emu10k1-family chip is the same as the CPU physical address space
      which is not true for a system with a IOMMU.
      
      Since this made the synth part of the driver non-functional on such systems
      let's effectively revert that commit (while keeping the
      __synth_free_pages() simplification).
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      055e0ae1
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: add optional debug printouts with DMA addresses · 541b9bad
      Maciej S. Szmigiero authored
      When we get a IOMMU page fault for a emu10k1 device it is very hard to
      discover which of chip many DMA allocations triggered it (since on a IOMMU
      system the DMA address space is often very different from the CPU one).
      Let's add optional debug printouts providing this information.
      
      These debug printouts are only enabled on an explicit request via the
      kernel dynamic debug mechanism.
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      541b9bad
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: use dma_set_mask_and_coherent() · 70d0bc7d
      Maciej S. Szmigiero authored
      We have been calling dma_set_mask() and then dma_set_coherent_mask() with
      the same value, but there is a dma_set_mask_and_coherent() function that
      does exactly that so let's use it instead.
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      70d0bc7d
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: remove reserved_page · a4463c92
      Maciej S. Szmigiero authored
      The emu10k1-family chips need the first page (index 0) reserved in their
      page tables for some reason (every emu10k1 driver I've checked does this
      without much of an explanation).
      Using the first page for normal samples results in a broken playback.
      
      However, we already have a dummy page allocated - so called "silent page"
      and, in fact, had always been setting it as the first page in the chip page
      table because an initialization of every entry of the page table to point
      to a silent page happens after and overwrites the reserved_page allocation.
      
      So the only thing remaining to remove the reserved_page allocation is a
      trivial change to the page allocation logic to ignore the first page entry
      and start its allocations from the second entry (index 1).
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a4463c92
  12. 12 Feb, 2018 9 commits
  13. 11 Feb, 2018 9 commits
    • Linus Torvalds's avatar
      Linux 4.16-rc1 · 7928b2cb
      Linus Torvalds authored
      7928b2cb
    • Al Viro's avatar
      unify {de,}mangle_poll(), get rid of kernel-side POLL... · 7a163b21
      Al Viro authored
      except, again, POLLFREE and POLL_BUSY_LOOP.
      
      With this, we finally get to the promised end result:
      
       - POLL{IN,OUT,...} are plain integers and *not* in __poll_t, so any
         stray instances of ->poll() still using those will be caught by
         sparse.
      
       - eventpoll.c and select.c warning-free wrt __poll_t
      
       - no more kernel-side definitions of POLL... - userland ones are
         visible through the entire kernel (and used pretty much only for
         mangle/demangle)
      
       - same behavior as after the first series (i.e. sparc et.al. epoll(2)
         working correctly).
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7a163b21
    • Linus Torvalds's avatar
      vfs: do bulk POLL* -> EPOLL* replacement · a9a08845
      Linus Torvalds authored
      This is the mindless scripted replacement of kernel use of POLL*
      variables as described by Al, done by this script:
      
          for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
              L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
              for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
          done
      
      with de-mangling cleanups yet to come.
      
      NOTE! On almost all architectures, the EPOLL* constants have the same
      values as the POLL* constants do.  But they keyword here is "almost".
      For various bad reasons they aren't the same, and epoll() doesn't
      actually work quite correctly in some cases due to this on Sparc et al.
      
      The next patch from Al will sort out the final differences, and we
      should be all done.
      Scripted-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a9a08845
    • Linus Torvalds's avatar
      Merge branch 'work.poll2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · ee5daa13
      Linus Torvalds authored
      Pull more poll annotation updates from Al Viro:
       "This is preparation to solving the problems you've mentioned in the
        original poll series.
      
        After this series, the kernel is ready for running
      
            for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
                  L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
                  for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
            done
      
        as a for bulk search-and-replace.
      
        After that, the kernel is ready to apply the patch to unify
        {de,}mangle_poll(), and then get rid of kernel-side POLL... uses
        entirely, and we should be all done with that stuff.
      
        Basically, that's what you suggested wrt KPOLL..., except that we can
        use EPOLL... instead - they already are arch-independent (and equal to
        what is currently kernel-side POLL...).
      
        After the preparations (in this series) switch to returning EPOLL...
        from ->poll() instances is completely mechanical and kernel-side
        POLL... can go away. The last step (killing kernel-side POLL... and
        unifying {de,}mangle_poll() has to be done after the
        search-and-replace job, since we need userland-side POLL... for
        unified {de,}mangle_poll(), thus the cherry-pick at the last step.
      
        After that we will have:
      
         - POLL{IN,OUT,...} *not* in __poll_t, so any stray instances of
           ->poll() still using those will be caught by sparse.
      
         - eventpoll.c and select.c warning-free wrt __poll_t
      
         - no more kernel-side definitions of POLL... - userland ones are
           visible through the entire kernel (and used pretty much only for
           mangle/demangle)
      
         - same behavior as after the first series (i.e. sparc et.al. epoll(2)
           working correctly)"
      
      * 'work.poll2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        annotate ep_scan_ready_list()
        ep_send_events_proc(): return result via esed->res
        preparation to switching ->poll() to returning EPOLL...
        add EPOLLNVAL, annotate EPOLL... and event_poll->event
        use linux/poll.h instead of asm/poll.h
        xen: fix poll misannotation
        smc: missing poll annotations
      ee5daa13
    • Linus Torvalds's avatar
      Merge tag 'xtensa-20180211' of git://github.com/jcmvbkbc/linux-xtensa · 3fc928dc
      Linus Torvalds authored
      Pull xtense fix from Max Filippov:
       "Build fix for xtensa architecture with KASAN enabled"
      
      * tag 'xtensa-20180211' of git://github.com/jcmvbkbc/linux-xtensa:
        xtensa: fix build with KASAN
      3fc928dc
    • Linus Torvalds's avatar
      Merge tag 'nios2-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2 · 60d7a21a
      Linus Torvalds authored
      Pull nios2 update from Ley Foon Tan:
      
       - clean up old Kconfig options from defconfig
      
       - remove leading 0x and 0s from bindings notation in dts files
      
      * tag 'nios2-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2:
        nios2: defconfig: Cleanup from old Kconfig options
        nios2: dts: Remove leading 0x and 0s from bindings notation
      60d7a21a
    • Max Filippov's avatar
      xtensa: fix build with KASAN · f8d0cbf2
      Max Filippov authored
      The commit 917538e2 ("kasan: clean up KASAN_SHADOW_SCALE_SHIFT
      usage") removed KASAN_SHADOW_SCALE_SHIFT definition from
      include/linux/kasan.h and added it to architecture-specific headers,
      except for xtensa. This broke the xtensa build with KASAN enabled.
      Define KASAN_SHADOW_SCALE_SHIFT in arch/xtensa/include/asm/kasan.h
      
      Reported by: kbuild test robot <fengguang.wu@intel.com>
      Fixes: 917538e2 ("kasan: clean up KASAN_SHADOW_SCALE_SHIFT usage")
      Acked-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      f8d0cbf2
    • Krzysztof Kozlowski's avatar
      nios2: defconfig: Cleanup from old Kconfig options · e0691ebb
      Krzysztof Kozlowski authored
      Remove old, dead Kconfig option INET_LRO. It is gone since
      commit 7bbf3cae ("ipv4: Remove inet_lro library").
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Acked-by: default avatarLey Foon Tan <ley.foon.tan@intel.com>
      e0691ebb
    • Mathieu Malaterre's avatar
      nios2: dts: Remove leading 0x and 0s from bindings notation · 5d13c731
      Mathieu Malaterre authored
      Improve the DTS files by removing all the leading "0x" and zeros to fix the
      following dtc warnings:
      
      Warning (unit_address_format): Node /XXX unit name should not have leading "0x"
      
      and
      
      Warning (unit_address_format): Node /XXX unit name should not have leading 0s
      
      Converted using the following command:
      
      find . -type f \( -iname *.dts -o -iname *.dtsi \) -exec sed -E -i -e "s/@0x([0-9a-fA-F\.]+)\s?\{/@\L\1 \{/g" -e "s/@0+([0-9a-fA-F\.]+)\s?\{/@\L\1 \{/g" {} +
      
      For simplicity, two sed expressions were used to solve each warnings separately.
      
      To make the regex expression more robust a few other issues were resolved,
      namely setting unit-address to lower case, and adding a whitespace before the
      the opening curly brace:
      
      https://elinux.org/Device_Tree_Linux#Linux_conventions
      
      This is a follow up to commit 4c9847b7 ("dt-bindings: Remove leading 0x from bindings notation")
      Reported-by: default avatarDavid Daney <ddaney@caviumnetworks.com>
      Suggested-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarMathieu Malaterre <malat@debian.org>
      Acked-by: default avatarLey Foon Tan <ley.foon.tan@intel.com>
      5d13c731
  14. 10 Feb, 2018 1 commit