1. 01 Sep, 2016 12 commits
    • Kent Overstreet's avatar
      bcache: RESERVE_PRIO is too small by one when prio_buckets() is a power of two. · 3dd120f4
      Kent Overstreet authored
      [ Upstream commit acc9cf8c ]
      
      This patch fixes a cachedev registration-time allocation deadlock.
      This can deadlock on boot if your initrd auto-registeres bcache devices:
      
      Allocator thread:
      [  720.727614] INFO: task bcache_allocato:3833 blocked for more than 120 seconds.
      [  720.732361]  [<ffffffff816eeac7>] schedule+0x37/0x90
      [  720.732963]  [<ffffffffa05192b8>] bch_bucket_alloc+0x188/0x360 [bcache]
      [  720.733538]  [<ffffffff810e6950>] ? prepare_to_wait_event+0xf0/0xf0
      [  720.734137]  [<ffffffffa05302bd>] bch_prio_write+0x19d/0x340 [bcache]
      [  720.734715]  [<ffffffffa05190bf>] bch_allocator_thread+0x3ff/0x470 [bcache]
      [  720.735311]  [<ffffffff816ee41c>] ? __schedule+0x2dc/0x950
      [  720.735884]  [<ffffffffa0518cc0>] ? invalidate_buckets+0x980/0x980 [bcache]
      
      Registration thread:
      [  720.710403] INFO: task bash:3531 blocked for more than 120 seconds.
      [  720.715226]  [<ffffffff816eeac7>] schedule+0x37/0x90
      [  720.715805]  [<ffffffffa05235cd>] __bch_btree_map_nodes+0x12d/0x150 [bcache]
      [  720.716409]  [<ffffffffa0522d30>] ? bch_btree_insert_check_key+0x1c0/0x1c0 [bcache]
      [  720.717008]  [<ffffffffa05236e4>] bch_btree_insert+0xf4/0x170 [bcache]
      [  720.717586]  [<ffffffff810e6950>] ? prepare_to_wait_event+0xf0/0xf0
      [  720.718191]  [<ffffffffa0527d9a>] bch_journal_replay+0x14a/0x290 [bcache]
      [  720.718766]  [<ffffffff810cc90d>] ? ttwu_do_activate.constprop.94+0x5d/0x70
      [  720.719369]  [<ffffffff810cf684>] ? try_to_wake_up+0x1d4/0x350
      [  720.719968]  [<ffffffffa05317d0>] run_cache_set+0x580/0x8e0 [bcache]
      [  720.720553]  [<ffffffffa053302e>] register_bcache+0xe2e/0x13b0 [bcache]
      [  720.721153]  [<ffffffff81354cef>] kobj_attr_store+0xf/0x20
      [  720.721730]  [<ffffffff812a2dad>] sysfs_kf_write+0x3d/0x50
      [  720.722327]  [<ffffffff812a225a>] kernfs_fop_write+0x12a/0x180
      [  720.722904]  [<ffffffff81225177>] __vfs_write+0x37/0x110
      [  720.723503]  [<ffffffff81228048>] ? __sb_start_write+0x58/0x110
      [  720.724100]  [<ffffffff812cedb3>] ? security_file_permission+0x23/0xa0
      [  720.724675]  [<ffffffff812258a9>] vfs_write+0xa9/0x1b0
      [  720.725275]  [<ffffffff8102479c>] ? do_audit_syscall_entry+0x6c/0x70
      [  720.725849]  [<ffffffff81226755>] SyS_write+0x55/0xd0
      [  720.726451]  [<ffffffff8106a390>] ? do_page_fault+0x30/0x80
      [  720.727045]  [<ffffffff816f2cae>] system_call_fastpath+0x12/0x71
      
      The fifo code in upstream bcache can't use the last element in the buffer,
      which was the cause of the bug: if you asked for a power of two size,
      it'd give you a fifo that could hold one less than what you asked for
      rather than allocating a buffer twice as big.
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
      Tested-by: default avatarEric Wheeler <bcache@linux.ewheeler.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      3dd120f4
    • Eric Wheeler's avatar
      bcache: register_bcache(): call blkdev_put() when cache_alloc() fails · 472ea0f4
      Eric Wheeler authored
      [ Upstream commit d9dc1702 ]
      
      register_cache() is supposed to return an error string on error so that
      register_bcache() will will blkdev_put and cleanup other user counters,
      but it does not set 'char *err' when cache_alloc() fails (eg, due to
      memory pressure) and thus register_bcache() performs no cleanup.
      
      register_bcache() <----------\  <- no jump to err_close, no blkdev_put()
         |                         |
         +->register_cache()       |  <- fails to set char *err
               |                   |
               +->cache_alloc() ---/  <- returns error
      
      This patch sets `char *err` for this failure case so that register_cache()
      will cause register_bcache() to correctly jump to err_close and do
      cleanup.  This was tested under OOM conditions that triggered the bug.
      Signed-off-by: default avatarEric Wheeler <bcache@linux.ewheeler.net>
      Cc: Kent Overstreet <kent.overstreet@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      472ea0f4
    • Christian König's avatar
      drm/radeon: only apply the SS fractional workaround to RS[78]80 · d1d55bb7
      Christian König authored
      [ Upstream commit ae5b80d2 ]
      
      Looks like some RV6xx have problems with that.
      
      bug:
      https://bugs.freedesktop.org/show_bug.cgi?id=97099Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      d1d55bb7
    • Christian König's avatar
      drm/radeon: don't use fractional dividers on RS[78]80 if SS is enabled · ffdb240a
      Christian König authored
      [ Upstream commit 9ef8537e ]
      
      Seems to cause problems for some older hardware. Kudos to Thom Kouwenhoven
      for working a lot with the PLLs and figuring this out.
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      ffdb240a
    • Oleg Nesterov's avatar
      uprobes: Fix the memcg accounting · f98192b6
      Oleg Nesterov authored
      [ Upstream commit 6c4687cc ]
      
      __replace_page() wronlgy calls mem_cgroup_cancel_charge() in "success" path,
      it should only do this if page_check_address() fails.
      
      This means that every enable/disable leads to unbalanced mem_cgroup_uncharge()
      from put_page(old_page), it is trivial to underflow the page_counter->count
      and trigger OOM.
      Reported-and-tested-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Reviewed-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarMichal Hocko <mhocko@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
      Cc: stable@vger.kernel.org # 3.17+
      Fixes: 00501b53 ("mm: memcontrol: rewrite charge API")
      Link: http://lkml.kernel.org/r/20160817153629.GB29724@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      f98192b6
    • Sasha Levin's avatar
      ARC: Elide redundant setup of DMA callbacks · cc2082d1
      Sasha Levin authored
      [ Upstream commit 45c3b08a ]
      
      For resources shared by all cores such as SLC and IOC, only the master
      core needs to do any setups / enabling / disabling etc.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      cc2082d1
    • Sasha Levin's avatar
      ARC: Call trace_hardirqs_on() before enabling irqs · 63998a4d
      Sasha Levin authored
      [ Upstream commit 18b43e89 ]
      
      trace_hardirqs_on_caller() in lockdep.c expects to be called before, not
      after interrupts are actually enabled.
      
      The following comment in kernel/locking/lockdep.c substantiates this
      claim:
      
      "
      /*
       * We're enabling irqs and according to our state above irqs weren't
       * already enabled, yet we find the hardware thinks they are in fact
       * enabled.. someone messed up their IRQ state tracing.
       */
      "
      
      An example can be found in include/linux/irqflags.h:
      
      	do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
      
      Without this change, we hit the following DEBUG_LOCKS_WARN_ON.
      
      [    7.760000] ------------[ cut here ]------------
      [    7.760000] WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:2711 resume_user_mode_begin+0x48/0xf0
      [    7.770000] DEBUG_LOCKS_WARN_ON(!irqs_disabled())
      [    7.780000] Modules linked in:
      [    7.780000] CPU: 0 PID: 1 Comm: init Not tainted 4.7.0-00003-gc668bb9-dirty #366
      [    7.790000]
      [    7.790000] Stack Trace:
      [    7.790000]   arc_unwind_core.constprop.1+0xa4/0x118
      [    7.800000]   warn_slowpath_fmt+0x72/0x158
      [    7.800000]   resume_user_mode_begin+0x48/0xf0
      [    7.810000] ---[ end trace 6f6a7a8fae20d2f0 ]---
      Signed-off-by: default avatarDaniel Mentz <danielmentz@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      63998a4d
    • Jim Lin's avatar
      usb: xhci: Fix panic if disconnect · 8501430b
      Jim Lin authored
      [ Upstream commit 88716a93 ]
      
      After a device is disconnected, xhci_stop_device() will be invoked
      in xhci_bus_suspend().
      Also the "disconnect" IRQ will have ISR to invoke
      xhci_free_virt_device() in this sequence.
      xhci_irq -> xhci_handle_event -> handle_cmd_completion ->
      xhci_handle_cmd_disable_slot -> xhci_free_virt_device
      
      If xhci->devs[slot_id] has been assigned to NULL in
      xhci_free_virt_device(), then virt_dev->eps[i].ring in
      xhci_stop_device() may point to an invlid address to cause kernel
      panic.
      
      virt_dev = xhci->devs[slot_id];
      :
      if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue)
      
      [] Unable to handle kernel paging request at virtual address 00001a68
      [] pgd=ffffffc001430000
      [] [00001a68] *pgd=000000013c807003, *pud=000000013c807003,
      *pmd=000000013c808003, *pte=0000000000000000
      [] Internal error: Oops: 96000006 [#1] PREEMPT SMP
      [] CPU: 0 PID: 39 Comm: kworker/0:1 Tainted: G     U
      [] Workqueue: pm pm_runtime_work
      [] task: ffffffc0bc0e0bc0 ti: ffffffc0bc0ec000 task.ti:
      ffffffc0bc0ec000
      [] PC is at xhci_stop_device.constprop.11+0xb4/0x1a4
      
      This issue is found when running with realtek ethernet device
      (0bda:8153).
      Signed-off-by: default avatarJim Lin <jilin@nvidia.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      8501430b
    • Mathias Nyman's avatar
      xhci: always handle "Command Ring Stopped" events · d7fb5c37
      Mathias Nyman authored
      [ Upstream commit 33be1265 ]
      
      Fix "Command completion event does not match command" errors by always
      handling the command ring stopped events.
      
      The command ring stopped event is generated as a result of aborting
      or stopping the command ring with a register write. It is not caused
      by a command in the command queue, and thus won't have a matching command
      in the comman list.
      
      Solve it by handling the command ring stopped event before checking for a
      matching command.
      
      In most command time out cases we abort the command ring, and get
      a command ring stopped event. The events command pointer will point at
      the current command ring dequeue, which in most cases matches the timed
      out command in the command list, and no error messages are seen.
      
      If we instead get a command aborted event before the command ring stopped
      event, the abort event will increse the command ring dequeue pointer, and
      the following command ring stopped events command pointer will point at the
      next, not yet queued command. This case triggered the error message
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      CC: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      d7fb5c37
    • Gavin Li's avatar
      cdc-acm: fix wrong pipe type on rx interrupt xfers · cc29c033
      Gavin Li authored
      [ Upstream commit add12505 ]
      
      This fixes the "BOGUS urb xfer" warning logged by usb_submit_urb().
      Signed-off-by: default avatarGavin Li <git@thegavinli.com>
      Acked-by: default avatarOliver Neukum <oneukum@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      cc29c033
    • Lu Baolu's avatar
      usb: misc: usbtest: add fix for driver hang · 868f1a48
      Lu Baolu authored
      [ Upstream commit 53958751 ]
      
      In sg_timeout(), req->status is set to "-ETIMEDOUT" before calling
      into usb_sg_cancel(). usb_sg_cancel() will do nothing and return
      directly if req->status has been set to a non-zero value. This will
      cause driver hang whenever transfer time out is triggered.
      
      This patch fixes this issue. It could be backported to stable kernel
      with version later than v3.15.
      
      Cc: stable@vger.kernel.org # 3.15+
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Suggested-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      868f1a48
    • Matthew Auld's avatar
      drm/i915: fix aliasing_ppgtt leak · 4b72a58f
      Matthew Auld authored
      [ Upstream commit 3871f42a ]
      
      In i915_ggtt_cleanup_hw we need to remember to free aliasing_ppgtt. This
      fixes the following kmemleak message:
      
      unreferenced object 0xffff880213cca000 (size 8192):
        comm "modprobe", pid 1298, jiffies 4294745402 (age 703.930s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffff817c808e>] kmemleak_alloc+0x4e/0xb0
          [<ffffffff8121f9c2>] kmem_cache_alloc_trace+0x142/0x1d0
          [<ffffffffa06d11ef>] i915_gem_init_ggtt+0x10f/0x210 [i915]
          [<ffffffffa06d71bb>] i915_gem_init+0x5b/0xd0 [i915]
          [<ffffffffa069749a>] i915_driver_load+0x97a/0x1460 [i915]
          [<ffffffffa06a26ef>] i915_pci_probe+0x4f/0x70 [i915]
          [<ffffffff81423015>] local_pci_probe+0x45/0xa0
          [<ffffffff81424463>] pci_device_probe+0x103/0x150
          [<ffffffff81515e6c>] driver_probe_device+0x22c/0x440
          [<ffffffff81516151>] __driver_attach+0xd1/0xf0
          [<ffffffff8151379c>] bus_for_each_dev+0x6c/0xc0
          [<ffffffff8151555e>] driver_attach+0x1e/0x20
          [<ffffffff81514fa3>] bus_add_driver+0x1c3/0x280
          [<ffffffff81516aa0>] driver_register+0x60/0xe0
          [<ffffffff8142297c>] __pci_register_driver+0x4c/0x50
          [<ffffffffa013605b>] 0xffffffffa013605b
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Fixes: b18b6bde ("drm/i915/bdw: Free PPGTT struct")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1470420280-21417-1-git-send-email-matthew.auld@intel.com
      (cherry picked from commit cb7f2760)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      4b72a58f
  2. 31 Aug, 2016 13 commits
  3. 24 Aug, 2016 1 commit
  4. 23 Aug, 2016 1 commit
    • Andrew Donnellan's avatar
      powerpc/eeh: eeh_pci_enable(): fix checking of post-request state · 399a4563
      Andrew Donnellan authored
      [ Upstream commit 949e9b82 ]
      
      In eeh_pci_enable(), after making the request to set the new options, we
      call eeh_ops->wait_state() to check that the request finished successfully.
      
      At the moment, if eeh_ops->wait_state() returns 0, we return 0 without
      checking that it reflects the expected outcome. This can lead to callers
      further up the chain incorrectly assuming the slot has been successfully
      unfrozen and continuing to attempt recovery.
      
      On powernv, this will occur if pnv_eeh_get_pe_state() or
      pnv_eeh_get_phb_state() return 0, which in turn occurs if the relevant OPAL
      call returns OPAL_EEH_STOPPED_MMIO_DMA_FREEZE or
      OPAL_EEH_PHB_ERROR respectively.
      
      On pseries, this will occur if pseries_eeh_get_state() returns 0, which in
      turn occurs if RTAS reports that the PE is in the MMIO Stopped and DMA
      Stopped states.
      
      Obviously, none of these cases represent a successful completion of a
      request to thaw MMIO or DMA.
      
      Fix the check so that a wait_state() return value of 0 won't be considered
      successful for the EEH_OPT_THAW_MMIO or EEH_OPT_THAW_DMA cases.
      Signed-off-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Acked-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Reviewed-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      399a4563
  5. 22 Aug, 2016 13 commits