1. 10 Oct, 2014 8 commits
    • Will Deacon's avatar
      arm64: ptrace: fix compat hardware watchpoint reporting · 0577a3e7
      Will Deacon authored
      I'm not sure what I was on when I wrote this, but when iterating over
      the hardware watchpoint array (hbp_watch_array), our index is off by
      ARM_MAX_BRP, so we walk off the end of our thread_struct...
      
      ... except, a dodgy condition in the loop means that it never executes
      at all (bp cannot be NULL).
      
      This patch fixes the code so that we remove the bp check and use the
      correct index for accessing the watchpoint structures.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      
      (cherry picked from commit 27d7ff27)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0577a3e7
    • Steven Rostedt (Red Hat)'s avatar
      ftrace: Use current addr when converting to nop in __ftrace_replace_code() · bc53142d
      Steven Rostedt (Red Hat) authored
      In __ftrace_replace_code(), when converting the call to a nop in a function
      it needs to compare against the "curr" (current) value of the ftrace ops, and
      not the "new" one. It currently does not affect x86 which is the only arch
      to do the trampolines with function graph tracer, but when other archs that do
      depend on this code implement the function graph trampoline, it can crash.
      
      Here's an example when ARM uses the trampolines (in the future):
      
       ------------[ cut here ]------------
       WARNING: CPU: 0 PID: 9 at kernel/trace/ftrace.c:1716 ftrace_bug+0x17c/0x1f4()
       Modules linked in: omap_rng rng_core ipv6
       CPU: 0 PID: 9 Comm: migration/0 Not tainted 3.16.0-test-10959-gf0094b28-dirty #52
       [<c02188f4>] (unwind_backtrace) from [<c021343c>] (show_stack+0x20/0x24)
       [<c021343c>] (show_stack) from [<c095a674>] (dump_stack+0x78/0x94)
       [<c095a674>] (dump_stack) from [<c02532a0>] (warn_slowpath_common+0x7c/0x9c)
       [<c02532a0>] (warn_slowpath_common) from [<c02532ec>] (warn_slowpath_null+0x2c/0x34)
       [<c02532ec>] (warn_slowpath_null) from [<c02cbac4>] (ftrace_bug+0x17c/0x1f4)
       [<c02cbac4>] (ftrace_bug) from [<c02cc44c>] (ftrace_replace_code+0x80/0x9c)
       [<c02cc44c>] (ftrace_replace_code) from [<c02cc658>] (ftrace_modify_all_code+0xb8/0x164)
       [<c02cc658>] (ftrace_modify_all_code) from [<c02cc718>] (__ftrace_modify_code+0x14/0x1c)
       [<c02cc718>] (__ftrace_modify_code) from [<c02c7244>] (multi_cpu_stop+0xf4/0x134)
       [<c02c7244>] (multi_cpu_stop) from [<c02c6e90>] (cpu_stopper_thread+0x54/0x130)
       [<c02c6e90>] (cpu_stopper_thread) from [<c0271cd4>] (smpboot_thread_fn+0x1ac/0x1bc)
       [<c0271cd4>] (smpboot_thread_fn) from [<c026ddf0>] (kthread+0xe0/0xfc)
       [<c026ddf0>] (kthread) from [<c020f318>] (ret_from_fork+0x14/0x20)
       ---[ end trace dc9ce72c5b617d8f ]---
      [   65.047264] ftrace failed to modify [<c0208580>] asm_do_IRQ+0x10/0x1c
      [   65.054070]  actual: 85:1b:00:eb
      
      Fixes: 7413af1f "ftrace: Make get_ftrace_addr() and get_ftrace_addr_old() global"
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      
      (cherry picked from commit 39b5552c)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      bc53142d
    • Simon Lindgren's avatar
      i2c: at91: Fix a race condition during signal handling in at91_do_twi_xfer. · b2353214
      Simon Lindgren authored
      There is a race condition in at91_do_twi_xfer when signals arrive.
      If a signal is recieved while waiting for a transfer to complete
      wait_for_completion_interruptible_timeout() will return -ERESTARTSYS.
      This is not handled correctly resulting in interrupts still being
      enabled and a transfer being in flight when we return.
      
      Symptoms include a range of oopses and bus lockups. Oopses can happen
      when the transfer completes because the interrupt handler will corrupt
      the stack. If a new transfer is started before the interrupt fires
      the controller will start a new transfer in the middle of the old one,
      resulting in confused slaves and a locked bus.
      
      To avoid this, use wait_for_completion_io_timeout instead so that we
      don't have to deal with gracefully shutting down the transfer and
      disabling the interrupts.
      Signed-off-by: default avatarSimon Lindgren <simon@aqwary.com>
      Acked-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org
      
      (cherry picked from commit 6721f28a)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b2353214
    • Marek Roszko's avatar
      i2c: at91: add bound checking on SMBus block length bytes · 194ad722
      Marek Roszko authored
      The driver was not bound checking the received length byte to ensure it was within the
      the buffer size that is allocated for SMBus blocks. This resulted in buffer overflows
      whenever an invalid length byte was received.
      It also failed to ensure the length byte was not zero. If it received zero, it would end up
      in an infinite loop as the at91_twi_read_next_byte function returned immediately without
      allowing RHR to be read to clear the RXRDY interrupt.
      
      Tested agaisnt a SMBus compliant battery.
      Signed-off-by: default avatarMarek Roszko <mark.roszko@gmail.com>
      Acked-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org
      
      (cherry picked from commit 75b81f33)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      194ad722
    • Will Deacon's avatar
      arm64: flush TLS registers during exec · 8792a30b
      Will Deacon authored
      Nathan reports that we leak TLS information from the parent context
      during an exec, as we don't clear the TLS registers when flushing the
      thread state.
      
      This patch updates the flushing code so that we:
      
        (1) Unconditionally zero the tpidr_el0 register (since this is fully
            context switched for native tasks and zeroed for compat tasks)
      
        (2) Zero the tp_value state in thread_info before clearing the
            tpidrr0_el0 register for compat tasks (since this is only writable
            by the set_tls compat syscall and therefore not fully switched).
      
      A missing compiler barrier is also added to the compat set_tls syscall.
      
      Cc: <stable@vger.kernel.org>
      Acked-by: default avatarNathan Lynch <Nathan_Lynch@mentor.com>
      Reported-by: default avatarNathan Lynch <Nathan_Lynch@mentor.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      
      (cherry picked from commit eb35bdd7)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8792a30b
    • James Ralston's avatar
      ahci: Add Device IDs for Intel 9 Series PCH · a0ea9ace
      James Ralston authored
      This patch adds the AHCI mode SATA Device IDs for the Intel 9 Series PCH.
      Signed-off-by: default avatarJames Ralston <james.d.ralston@intel.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 1b071a09)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a0ea9ace
    • Tetsuo Handa's avatar
      drm/ttm: Choose a pool to shrink correctly in ttm_dma_pool_shrink_scan(). · f586a311
      Tetsuo Handa authored
      We can use "unsigned int" instead of "atomic_t" by updating start_pool
      variable under _manager->lock. This patch will make it possible to avoid
      skipping when choosing a pool to shrink in round-robin style, after next
      patch changes mutex_lock(_manager->lock) to !mutex_trylock(_manager->lork).
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: stable <stable@kernel.org> [3.3+]
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      (cherry picked from commit 46c2df68)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f586a311
    • Tetsuo Handa's avatar
      drm/ttm: Fix possible division by 0 in ttm_dma_pool_shrink_scan(). · 7357b0ff
      Tetsuo Handa authored
      list_empty(&_manager->pools) being false before taking _manager->lock
      does not guarantee that _manager->npools != 0 after taking _manager->lock
      because _manager->npools is updated under _manager->lock.
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: stable <stable@kernel.org> [3.3+]
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      (cherry picked from commit 11e504cc)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      7357b0ff
  2. 26 Sep, 2014 32 commits