1. 03 Jan, 2014 5 commits
    • Julius Werner's avatar
      usb: hub: Clear Port Reset Change during init/resume · 40c8b4ee
      Julius Werner authored
      commit e92aee33 upstream.
      
      This patch adds the Port Reset Change flag to the set of bits that are
      preemptively cleared on init/resume of a hub. In theory this bit should
      never be set unexpectedly... in practice it can still happen if BIOS,
      SMM or ACPI code plays around with USB devices without cleaning up
      correctly. This is especially dangerous for XHCI root hubs, which don't
      generate any more Port Status Change Events until all change bits are
      cleared, so this is a good precaution to have (similar to how it's
      already done for the Warm Port Reset Change flag).
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2:
       - Adjust context
       - s/usb_clear_port_feature/clear_port_feature/]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      40c8b4ee
    • Sarah Sharp's avatar
      usb: Disable USB 2.0 Link PM before device reset. · 7e6337b6
      Sarah Sharp authored
      commit dcc01c08 upstream.
      
      Before the USB core resets a device, we need to disable the L1 timeout
      for the roothub, if USB 2.0 Link PM is enabled.  Otherwise the port may
      transition into L1 in between descriptor fetches, before we know if the
      USB device descriptors changed.  LPM will be re-enabled after the
      full device descriptors are fetched, and we can confirm the device still
      supports USB 2.0 LPM after the reset.
      
      We don't need to wait for the USB device to exit L1 before resetting the
      device, since the xHCI roothub port diagrams show a transition to the
      Reset state from any of the Ux states (see Figure 34 in the 2012-08-14
      xHCI specification update).
      
      This patch should be backported to kernels as old as 3.2, that contain
      the commit 65580b43 "xHCI: set USB2
      hardware LPM".  That was the first commit to enable USB 2.0
      hardware-driven Link Power Management.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      7e6337b6
    • Johan Hovold's avatar
      USB: mos7840: fix tiocmget error handling · 86827266
      Johan Hovold authored
      commit a91ccd26 upstream.
      
      Make sure to return errors from tiocmget rather than rely on
      uninitialised stack data.
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      86827266
    • Trond Myklebust's avatar
      NFSv4: Fix a use-after-free situation in _nfs4_proc_getlk() · 92036229
      Trond Myklebust authored
      commit a6f951dd upstream.
      
      In nfs4_proc_getlk(), when some error causes a retry of the call to
      _nfs4_proc_getlk(), we can end up with Oopses of the form
      
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000134
       IP: [<ffffffff8165270e>] _raw_spin_lock+0xe/0x30
      <snip>
       Call Trace:
        [<ffffffff812f287d>] _atomic_dec_and_lock+0x4d/0x70
        [<ffffffffa053c4f2>] nfs4_put_lock_state+0x32/0xb0 [nfsv4]
        [<ffffffffa053c585>] nfs4_fl_release_lock+0x15/0x20 [nfsv4]
        [<ffffffffa0522c06>] _nfs4_proc_getlk.isra.40+0x146/0x170 [nfsv4]
        [<ffffffffa052ad99>] nfs4_proc_lock+0x399/0x5a0 [nfsv4]
      
      The problem is that we don't clear the request->fl_ops after the first
      try and so when we retry, nfs4_set_lock_state() exits early without
      setting the lock stateid.
      Regression introduced by commit 70cc6487
      (locks: make ->lock release private data before returning in GETLK case)
      Reported-by: default avatarWeston Andros Adamson <dros@netapp.com>
      Reported-by: default avatarJorge Mora <mora@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      92036229
    • Paul Moore's avatar
      selinux: correct locking in selinux_netlbl_socket_connect) · b18bcfee
      Paul Moore authored
      commit 42d64e1a upstream.
      
      The SELinux/NetLabel glue code has a locking bug that affects systems
      with NetLabel enabled, see the kernel error message below.  This patch
      corrects this problem by converting the bottom half socket lock to a
      more conventional, and correct for this call-path, lock_sock() call.
      
       ===============================
       [ INFO: suspicious RCU usage. ]
       3.11.0-rc3+ #19 Not tainted
       -------------------------------
       net/ipv4/cipso_ipv4.c:1928 suspicious rcu_dereference_protected() usage!
      
       other info that might help us debug this:
      
       rcu_scheduler_active = 1, debug_locks = 0
       2 locks held by ping/731:
        #0:  (slock-AF_INET/1){+.-...}, at: [...] selinux_netlbl_socket_connect
        #1:  (rcu_read_lock){.+.+..}, at: [<...>] netlbl_conn_setattr
      
       stack backtrace:
       CPU: 1 PID: 731 Comm: ping Not tainted 3.11.0-rc3+ #19
       Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
        0000000000000001 ffff88006f659d28 ffffffff81726b6a ffff88003732c500
        ffff88006f659d58 ffffffff810e4457 ffff88006b845a00 0000000000000000
        000000000000000c ffff880075aa2f50 ffff88006f659d90 ffffffff8169bec7
       Call Trace:
        [<ffffffff81726b6a>] dump_stack+0x54/0x74
        [<ffffffff810e4457>] lockdep_rcu_suspicious+0xe7/0x120
        [<ffffffff8169bec7>] cipso_v4_sock_setattr+0x187/0x1a0
        [<ffffffff8170f317>] netlbl_conn_setattr+0x187/0x190
        [<ffffffff8170f195>] ? netlbl_conn_setattr+0x5/0x190
        [<ffffffff8131ac9e>] selinux_netlbl_socket_connect+0xae/0xc0
        [<ffffffff81303025>] selinux_socket_connect+0x135/0x170
        [<ffffffff8119d127>] ? might_fault+0x57/0xb0
        [<ffffffff812fb146>] security_socket_connect+0x16/0x20
        [<ffffffff815d3ad3>] SYSC_connect+0x73/0x130
        [<ffffffff81739a85>] ? sysret_check+0x22/0x5d
        [<ffffffff810e5e2d>] ? trace_hardirqs_on_caller+0xfd/0x1c0
        [<ffffffff81373d4e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
        [<ffffffff815d52be>] SyS_connect+0xe/0x10
        [<ffffffff81739a59>] system_call_fastpath+0x16/0x1b
      Signed-off-by: default avatarPaul Moore <pmoore@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b18bcfee
  2. 28 Nov, 2013 35 commits