1. 02 Nov, 2017 6 commits
    • Baruch Siach's avatar
      spi: uapi: spidev: add missing ioctl header · 7d74eecc
      Baruch Siach authored
      commit a2b4a79b upstream.
      
      The SPI_IOC_MESSAGE() macro references _IOC_SIZEBITS. Add linux/ioctl.h
      to make sure this macro is defined. This fixes the following build
      failure of lcdproc with the musl libc:
      
      In file included from .../sysroot/usr/include/sys/ioctl.h:7:0,
                       from hd44780-spi.c:31:
      hd44780-spi.c: In function 'spi_transfer':
      hd44780-spi.c:89:24: error: '_IOC_SIZEBITS' undeclared (first use in this function)
        status = ioctl(p->fd, SPI_IOC_MESSAGE(1), &xfer);
                              ^
      Signed-off-by: default avatarBaruch Siach <baruch@tkos.co.il>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7d74eecc
    • Mayank Rana's avatar
      usb: xhci: Handle error condition in xhci_stop_device() · 3505478d
      Mayank Rana authored
      commit b3207c65 upstream.
      
      xhci_stop_device() calls xhci_queue_stop_endpoint() multiple times
      without checking the return value. xhci_queue_stop_endpoint() can
      return error if the HC is already halted or unable to queue commands.
      This can cause a deadlock condition as xhci_stop_device() would
      end up waiting indefinitely for a completion for the command that
      didn't get queued. Fix this by checking the return value and bailing
      out of xhci_stop_device() in case of error. This patch happens to fix
      potential memory leaks of the allocated command structures as well.
      
      Fixes: c311e391 ("xhci: rework command timeout and cancellation,")
      Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
      Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      3505478d
    • Jeff Layton's avatar
      ceph: unlock dangling spinlock in try_flush_caps() · da0345d7
      Jeff Layton authored
      commit 6c2838fb upstream.
      
      sparse warns:
      
        fs/ceph/caps.c:2042:9: warning: context imbalance in 'try_flush_caps' - wrong count at exit
      
      We need to exit this function with the lock unlocked, but a couple of
      cases leave it locked.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Reviewed-by: default avatar"Yan, Zheng" <zyan@redhat.com>
      Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      da0345d7
    • Hui Wang's avatar
      ALSA: hda - fix headset mic problem for Dell machines with alc236 · 5f1d33ab
      Hui Wang authored
      commit f265788c upstream.
      
      We have several Dell laptops which use the codec alc236, the headset
      mic can't work on these machines. Following the commit 736f20a7, we
      add the pin cfg table to make the headset mic work.
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f1d33ab
    • Kailang Yang's avatar
      ALSA: hda/realtek - Add support for ALC236/ALC3204 · 8c812f03
      Kailang Yang authored
      commit 736f20a7 upstream.
      
      Add support for ALC236/ALC3204.
      Add headset mode support for ALC236/ALC3204.
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c812f03
    • Tejun Heo's avatar
      workqueue: replace pool->manager_arb mutex with a flag · fce67b31
      Tejun Heo authored
      commit 692b4825 upstream.
      
      Josef reported a HARDIRQ-safe -> HARDIRQ-unsafe lock order detected by
      lockdep:
      
       [ 1270.472259] WARNING: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected
       [ 1270.472783] 4.14.0-rc1-xfstests-12888-g76833e8 #110 Not tainted
       [ 1270.473240] -----------------------------------------------------
       [ 1270.473710] kworker/u5:2/5157 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
       [ 1270.474239]  (&(&lock->wait_lock)->rlock){+.+.}, at: [<ffffffff8da253d2>] __mutex_unlock_slowpath+0xa2/0x280
       [ 1270.474994]
       [ 1270.474994] and this task is already holding:
       [ 1270.475440]  (&pool->lock/1){-.-.}, at: [<ffffffff8d2992f6>] worker_thread+0x366/0x3c0
       [ 1270.476046] which would create a new lock dependency:
       [ 1270.476436]  (&pool->lock/1){-.-.} -> (&(&lock->wait_lock)->rlock){+.+.}
       [ 1270.476949]
       [ 1270.476949] but this new dependency connects a HARDIRQ-irq-safe lock:
       [ 1270.477553]  (&pool->lock/1){-.-.}
       ...
       [ 1270.488900] to a HARDIRQ-irq-unsafe lock:
       [ 1270.489327]  (&(&lock->wait_lock)->rlock){+.+.}
       ...
       [ 1270.494735]  Possible interrupt unsafe locking scenario:
       [ 1270.494735]
       [ 1270.495250]        CPU0                    CPU1
       [ 1270.495600]        ----                    ----
       [ 1270.495947]   lock(&(&lock->wait_lock)->rlock);
       [ 1270.496295]                                local_irq_disable();
       [ 1270.496753]                                lock(&pool->lock/1);
       [ 1270.497205]                                lock(&(&lock->wait_lock)->rlock);
       [ 1270.497744]   <Interrupt>
       [ 1270.497948]     lock(&pool->lock/1);
      
      , which will cause a irq inversion deadlock if the above lock scenario
      happens.
      
      The root cause of this safe -> unsafe lock order is the
      mutex_unlock(pool->manager_arb) in manage_workers() with pool->lock
      held.
      
      Unlocking mutex while holding an irq spinlock was never safe and this
      problem has been around forever but it never got noticed because the
      only time the mutex is usually trylocked while holding irqlock making
      actual failures very unlikely and lockdep annotation missed the
      condition until the recent b9c16a0e ("locking/mutex: Fix
      lockdep_assert_held() fail").
      
      Using mutex for pool->manager_arb has always been a bit of stretch.
      It primarily is an mechanism to arbitrate managership between workers
      which can easily be done with a pool flag.  The only reason it became
      a mutex is that pool destruction path wants to exclude parallel
      managing operations.
      
      This patch replaces the mutex with a new pool flag POOL_MANAGER_ACTIVE
      and make the destruction path wait for the current manager on a wait
      queue.
      
      v2: Drop unnecessary flag clearing before pool destruction as
          suggested by Boqun.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarLai Jiangshan <jiangshanlai@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fce67b31
  2. 27 Oct, 2017 34 commits