1. 07 Oct, 2012 34 commits
  2. 02 Oct, 2012 6 commits
    • Greg Kroah-Hartman's avatar
      Linux 3.0.44 · b9a7985a
      Greg Kroah-Hartman authored
      b9a7985a
    • Will Deacon's avatar
      ARM: 7467/1: mutex: use generic xchg-based implementation for ARMv6+ · 54d4d42b
      Will Deacon authored
      commit a76d7bd9 upstream.
      
      The open-coded mutex implementation for ARMv6+ cores suffers from a
      severe lack of barriers, so in the uncontended case we don't actually
      protect any accesses performed during the critical section.
      
      Furthermore, the code is largely a duplication of the ARMv6+ atomic_dec
      code but optimised to remove a branch instruction, as the mutex fastpath
      was previously inlined. Now that this is executed out-of-line, we can
      reuse the atomic access code for the locking (in fact, we use the xchg
      code as this produces shorter critical sections).
      
      This patch uses the generic xchg based implementation for mutexes on
      ARMv6+, which introduces barriers to the lock/unlock operations and also
      has the benefit of removing a fair amount of inline assembly code.
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarNicolas Pitre <nico@linaro.org>
      Reported-by: default avatarShan Kang <kangshan0910@gmail.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      54d4d42b
    • Alan Stern's avatar
      USB: Fix race condition when removing host controllers · b15ab4ac
      Alan Stern authored
      commit 0d00dc26 upstream.
      
      This patch (as1607) fixes a race that can occur if a USB host
      controller is removed while a process is reading the
      /sys/kernel/debug/usb/devices file.
      
      The usb_device_read() routine uses the bus->root_hub pointer to
      determine whether or not the root hub is registered.  The is not a
      valid test, because the pointer is set before the root hub gets
      registered and remains set even after the root hub is unregistered and
      deallocated.  As a result, usb_device_read() or usb_device_dump() can
      access freed memory, causing an oops.
      
      The patch changes the test to use the hcd->rh_registered flag, which
      does get set and cleared at the appropriate times.  It also makes sure
      to hold the usb_bus_list_lock mutex while setting the flag, so that
      usb_device_read() will become aware of new root hubs as soon as they
      are registered.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarDon Zickus <dzickus@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b15ab4ac
    • Andi Kleen's avatar
      MCE: Fix vm86 handling for 32bit mce handler · 8ef8fa74
      Andi Kleen authored
      commit a129a7c8 upstream.
      
      When running on 32bit the mce handler could misinterpret
      vm86 mode as ring 0. This can affect whether it does recovery
      or not; it was possible to panic when recovery was actually
      possible.
      
      Fix this by always forcing vm86 to look like ring 3.
      
      [ Backport to 3.0 notes:
      Things changed there slightly:
         - move mce_get_rip() up. It fills up m->cs and m->ip values which
           are evaluated in mce_severity(). Therefore move it up right before
           the mce_severity call. This seem to be another bug in 3.0?
         - Place the backport (fix m->cs in V86 case) to where m->cs gets
           filled which is mce_get_rip() in 3.0
      ]
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
      Reviewed-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ef8fa74
    • Yasunori Goto's avatar
      sched: Fix ancient race in do_exit() · ca465bac
      Yasunori Goto authored
      commit b5740f4b upstream.
      
      try_to_wake_up() has a problem which may change status from TASK_DEAD to
      TASK_RUNNING in race condition with SMI or guest environment of virtual
      machine. As a result, exited task is scheduled() again and panic occurs.
      
      Here is the sequence how it occurs:
      
       ----------------------------------+-----------------------------
                                         |
                  CPU A                  |             CPU B
       ----------------------------------+-----------------------------
      
      TASK A calls exit()....
      
      do_exit()
      
        exit_mm()
          down_read(mm->mmap_sem);
      
          rwsem_down_failed_common()
      
            set TASK_UNINTERRUPTIBLE
            set waiter.task <= task A
            list_add to sem->wait_list
                 :
            raw_spin_unlock_irq()
            (I/O interruption occured)
      
                                            __rwsem_do_wake(mmap_sem)
      
                                              list_del(&waiter->list);
                                              waiter->task = NULL
                                              wake_up_process(task A)
                                                try_to_wake_up()
                                                   (task is still
                                                     TASK_UNINTERRUPTIBLE)
                                                    p->on_rq is still 1.)
      
                                                    ttwu_do_wakeup()
                                                       (*A)
                                                         :
           (I/O interruption handler finished)
      
            if (!waiter.task)
                schedule() is not called
                due to waiter.task is NULL.
      
            tsk->state = TASK_RUNNING
      
                :
                                                    check_preempt_curr();
                                                        :
        task->state = TASK_DEAD
                                                    (*B)
                                              <---    set TASK_RUNNING (*C)
      
           schedule()
           (exit task is running again)
           BUG_ON() is called!
       --------------------------------------------------------
      
      The execution time between (*A) and (*B) is usually very short,
      because the interruption is disabled, and setting TASK_RUNNING at (*C)
      must be executed before setting TASK_DEAD.
      
      HOWEVER, if SMI is interrupted between (*A) and (*B),
      (*C) is able to execute AFTER setting TASK_DEAD!
      Then, exited task is scheduled again, and BUG_ON() is called....
      
      If the system works on guest system of virtual machine, the time
      between (*A) and (*B) may be also long due to scheduling of hypervisor,
      and same phenomenon can occur.
      
      By this patch, do_exit() waits for releasing task->pi_lock which is used
      in try_to_wake_up(). It guarantees the task becomes TASK_DEAD after
      waking up.
      Signed-off-by: default avatarYasunori Goto <y-goto@jp.fujitsu.com>
      Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20120117174031.3118.E1E9C6FF@jp.fujitsu.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: Michal Hocko <mhocko@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ca465bac
    • Herton Ronaldo Krzesinski's avatar
      spi/spi-fsl-spi: reference correct pdata in fsl_spi_cs_control · 81e80587
      Herton Ronaldo Krzesinski authored
      commit 067aa481 upstream.
      
      Commit 178db7d3, "spi: Fix device unregistration when unregistering
      the bus master", changed spi device initialization of dev.parent pointer
      to be the master's device pointer instead of his parent.
      
      This introduced a bug in spi-fsl-spi, since its usage of spi device
      pointer was not updated accordingly. This was later fixed by commit
      5039a869, "spi/mpc83xx: fix NULL pdata dereference bug", but it missed
      another spot on fsl_spi_cs_control function where we also need to update
      usage of spi device pointer. This change address that.
      Signed-off-by: default avatarHerton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
      Acked-by: default avatarJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
      Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Cc: Alfredo Capella <alfredo.capella@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      81e80587