1. 27 Mar, 2018 1 commit
  2. 24 Mar, 2018 2 commits
    • Andrew Chant's avatar
      ALSA: usb-audio: update clock valid control · 568fa7e0
      Andrew Chant authored
      Make the "clock valid" control a global control instead of a mixer
      so that it doesn't appear in mixer applications.
      
      Additionally, remove the check for writeability prohibited by spec, and
      Use common code to read the control value.
      
      Tested with a UAC2 Audio device that presents a clock validity
      control.  The control still shows up in /proc usbmixer but not
      in alsamixer.
      Signed-off-by: default avatarAndrew Chant <achant@google.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      568fa7e0
    • Andrew Chant's avatar
      ALSA: usb-audio: UAC2 jack detection · 5a222e84
      Andrew Chant authored
      This implements UAC2 jack detection support, presenting
      jack status as a boolean read-only mono mixer.
      
      The presence of any channel in the UAC2_TE_CONNECTOR
      control for a terminal will result in the mixer saying
      the jack is connected.
      
      Mixer naming follows the convention in sound/core/ctljack.c,
      terminating the mixer with " Jack".
      For additional clues as to which jack is being presented,
      the name is prefixed with " - Input Jack" or " - Output Jack"
      depending on if it's an input or output terminal.
      
      This is required because terminal names are ambiguous
      between inputs and outputs and often duplicated -
      Bidirectional terminal types (0x400 -> 0x4FF)
      "... may be used separately for input only or output only.
      These types require two Terminal descriptors. Both have the same type."
      (quote from "USB Device Class Definition for Terminal Types")
      
      Since bidirectional terminal types are common for headphone adapters,
      this distinguishes between two otherwise identically-named
      jack controls.
      
      Tested with a UAC2 audio device with connector control capability.
      Signed-off-by: default avatarAndrew Chant <achant@google.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5a222e84
  3. 23 Mar, 2018 8 commits
    • Takashi Iwai's avatar
      ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams · 40cab6e8
      Takashi Iwai authored
      OSS PCM stream management isn't modal but it allows ioctls issued at
      any time for changing the parameters.  In the previous hardening
      patch ("ALSA: pcm: Avoid potential races between OSS ioctls and
      read/write"), we covered these races and prevent the corruption by
      protecting the concurrent accesses via params_lock mutex.  However,
      this means that some ioctls that try to change the stream parameter
      (e.g. channels or format) would be blocked until the read/write
      finishes, and it may take really long.
      
      Basically changing the parameter while reading/writing is an invalid
      operation, hence it's even more user-friendly from the API POV if it
      returns -EBUSY in such a situation.
      
      This patch adds such checks in the relevant ioctls with the addition
      of read/write access refcount.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      40cab6e8
    • Takashi Iwai's avatar
      ALSA: pcm: Avoid potential races between OSS ioctls and read/write · 02a5d692
      Takashi Iwai authored
      Although we apply the params_lock mutex to the whole read and write
      operations as well as snd_pcm_oss_change_params(), we may still face
      some races.
      
      First off, the params_lock is taken inside the read and write loop.
      This is intentional for avoiding the too long locking, but it allows
      the in-between parameter change, which might lead to invalid
      pointers.  We check the readiness of the stream and set up via
      snd_pcm_oss_make_ready() at the beginning of read and write, but it's
      called only once, by assuming that it remains ready in the rest.
      
      Second, many ioctls that may change the actual parameters
      (i.e. setting runtime->oss.params=1) aren't protected, hence they can
      be processed in a half-baked state.
      
      This patch is an attempt to plug these holes.  The stream readiness
      check is moved inside the read/write inner loop, so that the stream is
      always set up in a proper state before further processing.  Also, each
      ioctl that may change the parameter is wrapped with the params_lock
      for avoiding the races.
      
      The issues were triggered by syzkaller in a few different scenarios,
      particularly the one below appearing as GPF in loopback_pos_update.
      
      Reported-by: syzbot+c4227aec125487ec3efa@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      02a5d692
    • Nobutaka Okabe's avatar
      ALSA: usb-audio: Integrate native DSD support for ITF-USB based DACs. · f3b906d7
      Nobutaka Okabe authored
      Integrate the native DSD support quirk codes of "ITF-USB DSD" based DACs.
      
      Now, "is_itf_usb_dsd_2alts_dac()" and "is_itf_usb_dsd_3alts_dac()" is
      integrated into one function "is_itf_usb_dsd_dac()".
      So, remove the logic to distinguish UD-501 and UD-501V2 by the
      "Product Name".
      
      The integration is possible by changing the following two functions.
      
      - snd_usb_select_mode_quirk():
      Change the determination condition of the DSD mode switch command,
      from the altset number being used, to the audio format being played.
      Actually, this operation is same as playback using ASIO driver in
      Windows environment.
      
      - snd_usb_interface_dsd_format_quirk():
      To which altset supports native DSD is determined by the number of altsets.
      Previously, it's a constant "2" or "3".
      Signed-off-by: default avatarNobutaka Okabe <nob77413@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f3b906d7
    • Nobutaka Okabe's avatar
      ALSA: usb-audio: FIX native DSD support for TEAC UD-501 DAC · 74dc71f8
      Nobutaka Okabe authored
      There are two versions of TEAC UD-501, the normal version and
      the vendor updated version(UD-501V2).
      
      They have the same VID/PID, but the num of the altsetting is different,
      UD-501 has 2 altsets for stream, and UD-501V2 has 3.
      
      So, add the logic to distinguish them by the Product Name, not by the PID.
      Signed-off-by: default avatarNobutaka Okabe <nob77413@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      74dc71f8
    • Nobutaka Okabe's avatar
      ALSA: usb-audio: Add native DSD support for Luxman DA-06 · 71426535
      Nobutaka Okabe authored
      Add native DSD support quirk for Luxman DA-06 DAC, by adding the
      PID/VID 1852:5065.
      
      Rename "is_marantz_denon_dac()" function to "is_itf_usb_dsd_2alts_dac()"
      to cover broader device family sharing the same USB audio
      implementation(*).
      For the same reason, rename "is_teac_dsd_dac()" function to
      "is_itf_usb_dsd_3alts_dac()".
      
      (*)
      These devices have the same USB controller "ITF-USB DSD", supplied by
      INTERFACE Co., Ltd.
      "ITF-USB DSD" USB controller has two patterns,
      
      Pattern 1. (2 altsets version)
      - Altset 0: for control
      - Altset 1: for stream (S32)
      - Altset 2: for stream (S32, DSD_U32)
      
      Pattern 2. (3 altsets version)
      - Altset 0: for control
      - Altset 1: for stream (S16)
      - Altset 2: for stream (S32)
      - Altset 3: for stream (S32, DSD_U32)
      
      "is_itf_usb_dsd_2alts_dac()" returns true, if the DAC has "Pattern 1"
      USB controller, and "is_itf_usb_dsd_3alts_dac()" returns true, if
      "Pattern2".
      Signed-off-by: default avatarNobutaka Okabe <nob77413@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      71426535
    • Takashi Iwai's avatar
      Merge branch 'for-linus' into for-next · 3446b1e9
      Takashi Iwai authored
      Back-merge for applying more series of fixes for USB DSD support.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3446b1e9
    • Nobutaka Okabe's avatar
      ALSA: usb-audio: Add native DSD support for TEAC UD-301 · b0021486
      Nobutaka Okabe authored
      Add native DSD support quirk for TEAC UD-301 DAC,
      by adding the PID/VID 0644:804a.
      Signed-off-by: default avatarNobutaka Okabe <nob77413@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b0021486
    • Andrew Chant's avatar
      ALSA: usb-audio: fix uac control query argument · 21e9b3e9
      Andrew Chant authored
      This patch fixes code readability and should have no functional change.
      
      Correct uac control query functions to account for the 1-based indexing
      of USB Audio Class control identifiers.
      
      The function parameter, u8 control, should be the
      constant defined in audio-v2.h to identify the control to be checked for
      readability or writeability.
      
      This patch fixes all callers that had adjusted, and makes explicit
      the mapping between audio_feature_info[] array index and the associated
      control identifier.
      Signed-off-by: default avatarAndrew Chant <achant@google.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      21e9b3e9
  4. 22 Mar, 2018 4 commits
    • Takashi Iwai's avatar
      ALSA: aloop: Fix access to not-yet-ready substream via cable · 8e6b1a72
      Takashi Iwai authored
      In loopback_open() and loopback_close(), we assign and release the
      substream object to the corresponding cable in a racy way.  It's
      neither locked nor done in the right position.  The open callback
      assigns the substream before its preparation finishes, hence the other
      side of the cable may pick it up, which may lead to the invalid memory
      access.
      
      This patch addresses these: move the assignment to the end of the open
      callback, and wrap with cable->lock for avoiding concurrent accesses.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      8e6b1a72
    • Takashi Iwai's avatar
      ALSA: aloop: Sync stale timer before release · 67a01afa
      Takashi Iwai authored
      The aloop driver tries to stop the pending timer via timer_del() in
      the trigger callback and in the close callback.  The former is
      correct, as it's an atomic operation, while the latter expects that
      the timer gets really removed and proceeds the resource releases after
      that.  But timer_del() doesn't synchronize, hence the running timer
      may still access the released resources.
      
      A similar situation can be also seen in the prepare callback after
      trigger(STOP) where the prepare tries to re-initialize the things
      while a timer is still running.
      
      The problems like the above are seen indirectly in some syzkaller
      reports (although it's not 100% clear whether this is the only cause,
      as the race condition is quite narrow and not always easy to
      trigger).
      
      For addressing these issues, this patch adds the explicit alls of
      timer_del_sync() in some places, so that the pending timer is properly
      killed / synced.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      67a01afa
    • Kailang Yang's avatar
      ALSA: hda/realtek - Fix speaker no sound after system resume · 88d42b2b
      Kailang Yang authored
      It will have a chance speaker no sound after system resume.
      To toggle NID 0x53 index 0x2 bit 15 will solve this issue.
      This usage will also suitable with ALC256.
      
      Fixes: 4a219ef8 ("ALSA: hda/realtek - Add ALC256 HP depop function")
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      88d42b2b
    • Kailang Yang's avatar
      ALSA: hda/realtek - Fix Dell headset Mic can't record · f0ba9d69
      Kailang Yang authored
      This platform was hardware fixed type for CTIA type for headset port.
      Assigned 0x19 verb will fix can't record issue.
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f0ba9d69
  5. 21 Mar, 2018 2 commits
    • Ruslan Bilovol's avatar
      ALSA: usb: initial USB Audio Device Class 3.0 support · 9a2fe9b8
      Ruslan Bilovol authored
      Recently released USB Audio Class 3.0 specification
      introduces many significant changes comparing to
      previous versions, like
       - new Power Domains, support for LPM/L1
       - new Cluster descriptor
       - changed layout of all class-specific descriptors
       - new High Capability descriptors
       - New class-specific String descriptors
       - new and removed units
       - additional sources for interrupts
       - removed Type II Audio Data Formats
       - ... and many other things (check spec)
      
      It also provides backward compatibility through
      multiple configurations, as well as requires
      mandatory support for BADD (Basic Audio Device
      Definition) on each ADC3.0 compliant device
      
      This patch adds initial support of UAC3 specification
      that is enough for Generic I/O Profile (BAOF, BAIF)
      device support from BADD document.
      Signed-off-by: default avatarRuslan Bilovol <ruslan.bilovol@gmail.com>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9a2fe9b8
    • Takashi Iwai's avatar
      ALSA: hda - Force polling mode on CFL for fixing codec communication · a8d7bde2
      Takashi Iwai authored
      We've observed too long probe time with Coffee Lake (CFL) machines,
      and the likely cause is some communication problem between the
      HD-audio controller and the codec chips.  While the controller expects
      an IRQ wakeup for each codec response, it seems sometimes missing, and
      it takes one second for the controller driver to time out and read the
      response in the polling mode.
      
      Although we aren't sure about the real culprit yet, in this patch, we
      put a workaround by forcing the polling mode as default for CFL
      machines; the polling mode itself isn't too heavy, and much better
      than other workarounds initially suggested (e.g. disabling
      power-save), at least.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199007
      Fixes: e79b0006 ("ALSA: hda - Add Coffelake PCI ID")
      Reported-and-tested-by: default avatarHui Wang <hui.wang@canonical.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a8d7bde2
  6. 19 Mar, 2018 3 commits
  7. 17 Mar, 2018 1 commit
    • Takashi Iwai's avatar
      ALSA: hda/realtek - Always immediately update mute LED with pin VREF · e40bdb03
      Takashi Iwai authored
      Some HP laptops have a mute mute LED controlled by a pin VREF.  The
      Realtek codec driver updates the VREF via vmaster hook by calling
      snd_hda_set_pin_ctl_cache().
      
      This works fine as long as the driver is running in a normal mode.
      However, when the VREF change happens during the codec being in
      runtime PM suspend, the regmap access will skip and postpone the
      actual register change.  This ends up with the unchanged LED status
      until the next runtime PM resume even if you change the Master mute
      switch.  (Interestingly, the machine keeps the LED status even after
      the codec goes into D3 -- but it's another story.)
      
      For improving this usability, let the driver temporarily powering up /
      down only during the pin VREF change.  This can be achieved easily by
      wrapping the call with snd_hda_power_up_pm() / *_down_pm().
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199073
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e40bdb03
  8. 13 Mar, 2018 3 commits
  9. 12 Mar, 2018 5 commits
  10. 11 Mar, 2018 9 commits
    • Linus Torvalds's avatar
      Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ed58d66f
      Linus Torvalds authored
      Pull x86/pti updates from Thomas Gleixner:
       "Yet another pile of melted spectrum related updates:
      
         - Drop native vsyscall support finally as it causes more trouble than
           benefit.
      
         - Make microcode loading more robust. There were a few issues
           especially related to late loading which are now surfacing because
           late loading of the IB* microcodes addressing spectre issues has
           become more widely used.
      
         - Simplify and robustify the syscall handling in the entry code
      
         - Prevent kprobes on the entry trampoline code which lead to kernel
           crashes when the probe hits before CR3 is updated
      
         - Don't check microcode versions when running on hypervisors as they
           are considered as lying anyway.
      
         - Fix the 32bit objtool build and a coment typo"
      
      * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/kprobes: Fix kernel crash when probing .entry_trampoline code
        x86/pti: Fix a comment typo
        x86/microcode: Synchronize late microcode loading
        x86/microcode: Request microcode on the BSP
        x86/microcode/intel: Look into the patch cache first
        x86/microcode: Do not upload microcode if CPUs are offline
        x86/microcode/intel: Writeback and invalidate caches before updating microcode
        x86/microcode/intel: Check microcode revision before updating sibling threads
        x86/microcode: Get rid of struct apply_microcode_ctx
        x86/spectre_v2: Don't check microcode versions when running under hypervisors
        x86/vsyscall/64: Drop "native" vsyscalls
        x86/entry/64/compat: Save one instruction in entry_INT80_compat()
        x86/entry: Do not special-case clone(2) in compat entry
        x86/syscalls: Use COMPAT_SYSCALL_DEFINEx() macros for x86-only compat syscalls
        x86/syscalls: Use proper syscall definition for sys_ioperm()
        x86/entry: Remove stale syscall prototype
        x86/syscalls/32: Simplify $entry == $compat entries
        objtool: Fix 32-bit build
      ed58d66f
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1ad5daa6
      Linus Torvalds authored
      Pull timer fix from Thomas Gleixner:
       "Just a single fix which adds a missing Kconfig dependency to avoid
        unmet dependency warnings"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        clocksource/atmel-st: Add 'depends on HAS_IOMEM' to fix unmet dependency
      1ad5daa6
    • Linus Torvalds's avatar
      Merge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ebb3762e
      Linus Torvalds authored
      Pull RAS fixes from Thomas Gleixner:
       "Two small fixes for RAS/MCE:
      
         - Serialize sysfs changes to avoid concurrent modificaiton of
           underlying data
      
         - Add microcode revision to Machine Check records. This should have
           been there forever, but now with the broken microcode versions in
           the wild it has become important"
      
      * 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/MCE: Serialize sysfs changes
        x86/MCE: Save microcode revision in machine check records
      ebb3762e
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8ad44243
      Linus Torvalds authored
      Pull perf updates from Thomas Gleixner:
       "Another set of perf updates:
      
         - Fix a Skylake Uncore event format declaration
      
         - Prevent perf pipe mode from crahsing which was caused by a missing
           buffer allocation
      
         - Make the perf top popup message which tells the user that it uses
           fallback mode on older kernels a debug message.
      
         - Make perf context rescheduling work correcctly
      
         - Robustify the jump error drawing in perf browser mode so it does
           not try to create references to NULL initialized offset entries
      
         - Make trigger_on() robust so it does not enable the trigger before
           everything is set up correctly to handle it
      
         - Make perf auxtrace respect the --no-itrace option so it does not
           try to queue AUX data for decoding.
      
         - Prevent having different number of field separators in CVS output
           lines when a counter is not supported.
      
         - Make the perf kallsyms man page usage behave like it does for all
           other perf commands.
      
         - Synchronize the kernel headers"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/core: Fix ctx_event_type in ctx_resched()
        perf tools: Fix trigger class trigger_on()
        perf auxtrace: Prevent decoding when --no-itrace
        perf stat: Fix CVS output format for non-supported counters
        tools headers: Sync x86's cpufeatures.h
        tools headers: Sync copy of kvm UAPI headers
        perf record: Fix crash in pipe mode
        perf annotate browser: Be more robust when drawing jump arrows
        perf top: Fix annoying fallback message on older kernels
        perf kallsyms: Fix the usage on the man page
        perf/x86/intel/uncore: Fix Skylake UPI event format
      8ad44243
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 02bf0ef0
      Linus Torvalds authored
      Pull locking fix from Thomas Gleixner:
       "rt_mutex_futex_unlock() grew a new irq-off call site, but the function
        assumes that its always called from irq enabled context.
      
        Use (un)lock_irqsafe() to handle the new call site correctly"
      
      * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        rtmutex: Make rt_mutex_futex_unlock() safe for irq-off callsites
      02bf0ef0
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-fix-4.16-rc5' of git://git.infradead.org/users/vkoul/slave-dma · abeb7521
      Linus Torvalds authored
      Pull dmaengine fixes from Vinod Koul:
       "Two small fixes are for this cycle:
      
         - fix max_chunk_size for rcar-dmac for R-Car Gen3
      
         - fix clock resource of mv_xor_v2"
      
      * tag 'dmaengine-fix-4.16-rc5' of git://git.infradead.org/users/vkoul/slave-dma:
        dmaengine: mv_xor_v2: Fix clock resource by adding a register clock
        dmaengine: rcar-dmac: fix max_chunk_size for R-Car Gen3
      abeb7521
    • Linus Torvalds's avatar
      Merge tag 'gpio-v4.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio · d43be80a
      Linus Torvalds authored
      Pull GPIO fix from Linus Walleij:
       "This is a single GPIO fix for the v4.16 series affecting the Renesas
        driver, and fixes wakeup from external stuff"
      
      * tag 'gpio-v4.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
        gpio: rcar: Use wakeup_path i.s.o. explicit clock handling
      d43be80a
    • Gregory CLEMENT's avatar
      dmaengine: mv_xor_v2: Fix clock resource by adding a register clock · 3cd2c313
      Gregory CLEMENT authored
      On the CP110 components which are present on the Armada 7K/8K SoC we need
      to explicitly enable the clock for the registers. However it is not
      needed for the AP8xx component, that's why this clock is optional.
      
      With this patch both clock have now a name, but in order to be backward
      compatible, the name of the first clock is not used. It allows to still
      use this clock with a device tree using the old binding.
      Signed-off-by: default avatarGregory CLEMENT <gregory.clement@bootlin.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      3cd2c313
    • Takashi Iwai's avatar
      ALSA: pcm: Fix UAF in snd_pcm_oss_get_formats() · 01c0b426
      Takashi Iwai authored
      snd_pcm_oss_get_formats() has an obvious use-after-free around
      snd_mask_test() calls, as spotted by syzbot.  The passed format_mask
      argument is a pointer to the hw_params object that is freed before the
      loop.  What a surprise that it has been present since the original
      code of decades ago...
      
      Reported-by: syzbot+4090700a4f13fccaf648@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      01c0b426
  11. 10 Mar, 2018 2 commits