1. 03 Oct, 2011 40 commits
    • David S. Miller's avatar
      sparc64: Only Panther cheetah+ chips have POPC. · f7ae5caa
      David S. Miller authored
      commit 1a8e0da5 upstream.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f7ae5caa
    • Axel Lin's avatar
      regulator: tps65910: Add missing breaks in switch/case · 94dea720
      Axel Lin authored
      commit d04156bc upstream.
      
      Also add a default case in tps65910_list_voltage_dcdc to silence
      'volt' may be used uninitialized in this function warning.
      Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
      Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
      Cc: Johan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      94dea720
    • Kjetil Oftedal's avatar
      sparc32,sun4d: Change IPI IRQ level to prevent collision between IPI and timer interrupt · 8d537b9f
      Kjetil Oftedal authored
      commit 38f7f8f0 upstream.
      
      On Sun4d systems running in SMP mode, IRQ 14 is used for timer interrupts
      and has a specialized interrupt handler. IPI is currently set to use IRQ 14
      as well, which causes it to trigger the timer interrupt handler, and not the
      IPI interrupt handler.
      
      The IPI interrupt is therefore changed to IRQ 13, which is the highest
      normally handled interrupt. This IRQ is also used for SBUS interrupts,
      however there is nothing in the IPI/SBUS interrupt handlers that indicate
      that they will not handle sharing the interrupt.
      (IRQ 13 is indicated as audio interrupt, which is unlikely to be found in a
      sun4d system)
      Signed-off-by: default avatarKjetil Oftedal <oftedal@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8d537b9f
    • Ian Campbell's avatar
      sparc: fix array bounds error setting up PCIC NMI trap · d91d1dde
      Ian Campbell authored
      commit 4a0342ca upstream.
      
        CC      arch/sparc/kernel/pcic.o
      arch/sparc/kernel/pcic.c: In function 'pcic_probe':
      arch/sparc/kernel/pcic.c:359:33: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:359:8: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:360:33: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:360:8: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:361:33: error: array subscript is above array bounds [-Werror=array-bounds]
      arch/sparc/kernel/pcic.c:361:8: error: array subscript is above array bounds [-Werror=array-bounds]
      cc1: all warnings being treated as errors
      
      I'm not particularly familiar with sparc but t_nmi (defined in head_32.S via
      the TRAP_ENTRY macro) and pcic_nmi_trap_patch (defined in entry.S) both appear
      to be 4 instructions long and I presume from the usage that instructions are
      int sized.
      Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: sparclinux@vger.kernel.org
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d91d1dde
    • David S. Miller's avatar
      sparc64: Set HAVE_C_RECORDMCOUNT · 69c4ec5d
      David S. Miller authored
      [ Upstream commit 178a2960 ]
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      69c4ec5d
    • David S. Miller's avatar
      sparc: Allow handling signals when stack is corrupted. · a9d0a363
      David S. Miller authored
      commit 5598473a upstream.
      
      If we can't push the pending register windows onto the user's stack,
      we disallow signal delivery even if the signal would be delivered on a
      valid seperate signal stack.
      
      Add a register window save area in the signal frame, and store any
      unsavable windows there.
      
      On sigreturn, if any windows are still queued up in the signal frame,
      try to push them back onto the stack and if that fails we kill the
      process immediately.
      
      This allows the debug/tst-longjmp_chk2 glibc test case to pass.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a9d0a363
    • Mikael Pettersson's avatar
      sparc32: unbreak arch_write_unlock() · 7fe1e169
      Mikael Pettersson authored
      commit 3f6aa0b1 upstream.
      
      The sparc32 version of arch_write_unlock() is just a plain assignment.
      Unfortunately this allows the compiler to schedule side-effects in a
      protected region to occur after the HW-level unlock, which is broken.
      E.g., the following trivial test case gets miscompiled:
      
      	#include <linux/spinlock.h>
      	rwlock_t lock;
      	int counter;
      	void foo(void) { write_lock(&lock); ++counter; write_unlock(&lock); }
      
      Fixed by adding a compiler memory barrier to arch_write_unlock().  The
      sparc64 version combines the barrier and assignment into a single asm(),
      and implements the operation as a static inline, so that's what I did too.
      
      Compile-tested with sparc32_defconfig + CONFIG_SMP=y.
      Signed-off-by: default avatarMikael Pettersson <mikpe@it.uu.se>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      7fe1e169
    • Mikael Pettersson's avatar
      sparc64: remove unnecessary macros from spinlock_64.h · b60c440f
      Mikael Pettersson authored
      commit a0fba3eb upstream.
      
      The sparc64 spinlock_64.h contains a number of operations defined
      first as static inline functions, and then as macros with the same
      names and parameters as the functions.  Maybe this was needed at
      some point in the past, but now nothing seems to depend on these
      macros (checked with a recursive grep looking for ifdefs on these
      names).  Other archs don't define these identity-macros.
      
      So this patch deletes these unnecessary macros.
      
      Compile-tested with sparc64_defconfig.
      Signed-off-by: default avatarMikael Pettersson <mikpe@it.uu.se>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b60c440f
    • Stanislaw Gruszka's avatar
      rt2x00: fix crash in rt2800usb_get_txwi · d6b0fa55
      Stanislaw Gruszka authored
      commit 674db134 upstream.
      
      Patch should fix this oops:
      
      BUG: unable to handle kernel NULL pointer dereference at 000000a0
      IP: [<f81b30c9>] rt2800usb_get_txwi+0x19/0x70 [rt2800usb]
      *pdpt = 0000000000000000 *pde = f000ff53f000ff53
      Oops: 0000 [#1] SMP
      Pid: 198, comm: kworker/u:3 Tainted: G        W   3.0.0-wl+ #9 LENOVO 6369CTO/6369CTO
      EIP: 0060:[<f81b30c9>] EFLAGS: 00010283 CPU: 1
      EIP is at rt2800usb_get_txwi+0x19/0x70 [rt2800usb]
      EAX: 00000000 EBX: f465e140 ECX: f4494960 EDX: ef24c5f8
      ESI: 810f21f5 EDI: f1da9960 EBP: f4581e80 ESP: f4581e70
       DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      Process kworker/u:3 (pid: 198, ti=f4580000 task=f4494960 task.ti=f4580000)
      Call Trace:
       [<f804790f>] rt2800_txdone_entry+0x2f/0xf0 [rt2800lib]
       [<c045110d>] ? warn_slowpath_common+0x7d/0xa0
       [<f81b3a38>] ? rt2800usb_work_txdone+0x288/0x360 [rt2800usb]
       [<f81b3a38>] ? rt2800usb_work_txdone+0x288/0x360 [rt2800usb]
       [<f81b3a13>] rt2800usb_work_txdone+0x263/0x360 [rt2800usb]
       [<c046a8d6>] process_one_work+0x186/0x440
       [<c046a85a>] ? process_one_work+0x10a/0x440
       [<f81b37b0>] ? rt2800usb_probe_hw+0x120/0x120 [rt2800usb]
       [<c046c283>] worker_thread+0x133/0x310
       [<c04885db>] ? trace_hardirqs_on+0xb/0x10
       [<c046c150>] ? manage_workers+0x1e0/0x1e0
       [<c047054c>] kthread+0x7c/0x90
       [<c04704d0>] ? __init_kthread_worker+0x60/0x60
       [<c0826b42>] kernel_thread_helper+0x6/0x1
      
      Oops might happen because we check rt2x00queue_empty(queue) twice,
      but this condition can change and we can process entry in
      rt2800_txdone_entry(), which was already processed by
      rt2800usb_txdone_entry_check() -> rt2x00lib_txdone_noinfo() and
      has nullify entry->skb .
      Reported-by: default avatarJustin Piszcz <jpiszcz@lucidpixels.com>
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Acked-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d6b0fa55
    • Stanislaw Gruszka's avatar
      rt2x00: fix crash in rt2800usb_write_tx_desc · 341b1e99
      Stanislaw Gruszka authored
      commit 4b1bfb7d upstream.
      
      Patch should fix this oops:
      
      BUG: unable to handle kernel NULL pointer dereference at 000000a0
      IP: [<f8e06078>] rt2800usb_write_tx_desc+0x18/0xc0 [rt2800usb]
      *pdpt = 000000002408c001 *pde = 0000000024079067 *pte = 0000000000000000
      Oops: 0000 [#1] SMP
      EIP: 0060:[<f8e06078>] EFLAGS: 00010282 CPU: 0
      EIP is at rt2800usb_write_tx_desc+0x18/0xc0 [rt2800usb]
      EAX: 00000035 EBX: ef2bef10 ECX: 00000000 EDX: d40958a0
      ESI: ef1865f8 EDI: ef1865f8 EBP: d4095878 ESP: d409585c
       DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      Call Trace:
       [<f8da5e85>] rt2x00queue_write_tx_frame+0x155/0x300 [rt2x00lib]
       [<f8da424c>] rt2x00mac_tx+0x7c/0x370 [rt2x00lib]
       [<c04882b2>] ? mark_held_locks+0x62/0x90
       [<c081f645>] ? _raw_spin_unlock_irqrestore+0x35/0x60
       [<c04884ba>] ? trace_hardirqs_on_caller+0x5a/0x170
       [<c04885db>] ? trace_hardirqs_on+0xb/0x10
       [<f8d618ac>] __ieee80211_tx+0x5c/0x1e0 [mac80211]
       [<f8d631fc>] ieee80211_tx+0xbc/0xe0 [mac80211]
       [<f8d63163>] ? ieee80211_tx+0x23/0xe0 [mac80211]
       [<f8d632e1>] ieee80211_xmit+0xc1/0x200 [mac80211]
       [<f8d63220>] ? ieee80211_tx+0xe0/0xe0 [mac80211]
       [<c0487d45>] ? lock_release_holdtime+0x35/0x1b0
       [<f8d63986>] ? ieee80211_subif_start_xmit+0x446/0x5f0 [mac80211]
       [<f8d637dd>] ieee80211_subif_start_xmit+0x29d/0x5f0 [mac80211]
       [<f8d63924>] ? ieee80211_subif_start_xmit+0x3e4/0x5f0 [mac80211]
       [<c0760188>] ? sock_setsockopt+0x6a8/0x6f0
       [<c0760000>] ? sock_setsockopt+0x520/0x6f0
       [<c076daef>] dev_hard_start_xmit+0x2ef/0x650
      
      Oops might happen because we perform parallel putting new entries in a
      queue (rt2x00queue_write_tx_frame()) and removing entries after
      finishing transmitting (rt2800usb_work_txdone()). There are cases when
      _txdone may process an entry that was not fully send and nullify
      entry->skb .
      
      To fix check in _txdone if entry has flags that indicate pending
      transmission and wait until flags get cleared.
      Reported-by: default avatarJustin Piszcz <jpiszcz@lucidpixels.com>
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Acked-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      341b1e99
    • Daniel Schwierzeck's avatar
      atm: br2684: Fix oops due to skb->dev being NULL · bdfd59ed
      Daniel Schwierzeck authored
      commit fbe5e29e upstream.
      
      This oops have been already fixed with commit
      
          27141666
      
          atm: [br2684] Fix oops due to skb->dev being NULL
      
          It happens that if a packet arrives in a VC between the call to open it on
          the hardware and the call to change the backend to br2684, br2684_regvcc
          processes the packet and oopses dereferencing skb->dev because it is
          NULL before the call to br2684_push().
      
      but have been introduced again with commit
      
          b6211ae7
      
          atm: Use SKB queue and list helpers instead of doing it by-hand.
      Signed-off-by: default avatarDaniel Schwierzeck <daniel.schwierzeck@googlemail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      bdfd59ed
    • Tejun Heo's avatar
      pata_via: disable ATAPI DMA on AVERATEC 3200 · e4dd9ac2
      Tejun Heo authored
      commit 6d0e194d upstream.
      
      On AVERATEC 3200, pata_via causes memory corruption with ATAPI DMA,
      which often leads to random kernel oops.  The cause of the problem is
      not well understood yet and only small subset of machines using the
      controller seem affected.  Blacklist ATAPI DMA on the machine.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=11426Reported-and-tested-by: default avatarJim Bray <jimsantelmo@gmail.com>
      Cc: Alan Cox <alan@linux.intel.com>
      Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e4dd9ac2
    • John Stanley's avatar
      savagedb: Fix typo causing regression in savage4 series video chip detection · 088412ec
      John Stanley authored
      commit 4b00e4b3 upstream.
      
      Two additional savage4 variants were added, but the S3_SAVAGE4_SERIES
      macro was incompletely modified, resulting in a false positive detection
      of a savage4 card regardless of which savage card is actually present.
      
      For non-savage4 series cards, such as a Savage/IX-MV card, this results
      in garbled video and/or a hard-hang at boot time.  Fix this by changing
      an '||' to an '&&' in the S3_SAVAGE4_SERIES macro.
      Signed-off-by: default avatarJohn P. Stanley <jpsinthemix@verizon.net>
      Reviewed-by: default avatarTormod Volden <debian.tormod@gmail.com>
      [ The macros have incomplete parenthesis too, but whatever ..  -Linus ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      088412ec
    • Stanislaw Gruszka's avatar
      rt2x00: do not drop usb dev reference counter on suspend · dea59206
      Stanislaw Gruszka authored
      commit 543cc38c upstream.
      
      When hibernating ->resume may not be called by usb core, but disconnect
      and probe instead, so we do not increase the counter after decreasing
      it in ->supend. As a result we free memory early, and get crash when
      unplugging usb dongle.
      
      BUG: unable to handle kernel paging request at 6b6b6b9f
      IP: [<c06909b0>] driver_sysfs_remove+0x10/0x30
      *pdpt = 0000000034f21001 *pde = 0000000000000000
      Pid: 20, comm: khubd Not tainted 3.1.0-rc1-wl+ #20 LENOVO 6369CTO/6369CTO
      EIP: 0060:[<c06909b0>] EFLAGS: 00010202 CPU: 1
      EIP is at driver_sysfs_remove+0x10/0x30
      EAX: 6b6b6b6b EBX: f52bba34 ECX: 00000000 EDX: 6b6b6b6b
      ESI: 6b6b6b6b EDI: c0a0ea20 EBP: f61c9e68 ESP: f61c9e64
       DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      Process khubd (pid: 20, ti=f61c8000 task=f6138270 task.ti=f61c8000)
      Call Trace:
       [<c06909ef>] __device_release_driver+0x1f/0xa0
       [<c0690b20>] device_release_driver+0x20/0x40
       [<c068fd64>] bus_remove_device+0x84/0xe0
       [<c068e12a>] ? device_remove_attrs+0x2a/0x80
       [<c068e267>] device_del+0xe7/0x170
       [<c06d93d4>] usb_disconnect+0xd4/0x180
       [<c06d9d61>] hub_thread+0x691/0x1600
       [<c0473260>] ? wake_up_bit+0x30/0x30
       [<c0442a39>] ? complete+0x49/0x60
       [<c06d96d0>] ? hub_disconnect+0xd0/0xd0
       [<c06d96d0>] ? hub_disconnect+0xd0/0xd0
       [<c0472eb4>] kthread+0x74/0x80
       [<c0472e40>] ? kthread_worker_fn+0x150/0x150
       [<c0809b3e>] kernel_thread_helper+0x6/0x10
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Acked-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      dea59206
    • Senthil Balasubramanian's avatar
      ath9k_hw: Fix STA (AR9485) bringup issue due to incorrect MAC address · 6417bec1
      Senthil Balasubramanian authored
      commit b503c7a2 upstream.
      
      Due to some recent optimization done in the way the mac address
      bytes are written into the OTP memory, some AR9485 chipsets were
      forced to use the first byte from the eeprom template and the
      remaining bytes are read from OTP.
      
      AR9485 happens to use generic eeprom template which has 0x1 as
      the first byte causes issues in bringing up the card.
      
      So fixed the eeprom template accordingly to address the issue.
      
      Cc: Paul Stewart <pstew@google.com>
      Signed-off-by: default avatarSenthil Balasubramanian <senthilb@qca.qualcomm.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6417bec1
    • Alexey Khoroshilov's avatar
      carl9170: Fix mismatch in carl9170_op_set_key mutex lock-unlock · 8a9f335d
      Alexey Khoroshilov authored
      commit 66cb54bd upstream.
      
      If is_main_vif(ar, vif) reports that we have to fall back
      to software encryption, we goto err_softw; before locking ar->mutex.
      As a result, we have unprotected call to carl9170_set_operating_mode
      and unmatched mutex_unlock.
      
      The patch fix the issue by adding mutex_lock before goto.
      
      Found by Linux Driver Verification project (linuxtesting.org).
      Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
      Acked-By: default avatarChristian Lamparter <chunkeey@googlemail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8a9f335d
    • Anton Blanchard's avatar
      ibmveth: Fix leak when recycling skb and hypervisor returns error · 0b1511be
      Anton Blanchard authored
      commit c6f59d13 upstream.
      
      If h_add_logical_lan_buffer returns an error we need to free
      the skb.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0b1511be
    • Mohammed Shafi Shajakhan's avatar
      ath9k: Fix PS wrappers in ath9k_set_coverage_class · ec518b00
      Mohammed Shafi Shajakhan authored
      commit 8b2a3827 upstream.
      
      this callback is called during suspend/resume and also via iw command.
      it configures parameters like sifs, slottime, acktimeout in
      ath9k_hw_init_global_settings where few REG_READ, REG_RMW are also done
      and hence the need for PS wrappers
      Signed-off-by: default avatarMohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ec518b00
    • Mathieu Desnoyers's avatar
      sendmmsg/sendmsg: fix unsafe user pointer access · 5772ee1f
      Mathieu Desnoyers authored
      commit bc909d9d upstream.
      
      Dereferencing a user pointer directly from kernel-space without going
      through the copy_from_user family of functions is a bad idea. Two of
      such usages can be found in the sendmsg code path called from sendmmsg,
      added by
      
      commit c71d8ebe upstream.
      commit 5b47b803 in the 3.0-stable tree.
      
      Usages are performed through memcmp() and memcpy() directly. Fix those
      by using the already copied msg_sys structure instead of the __user *msg
      structure. Note that msg_sys can be set to NULL by verify_compat_iovec()
      or verify_iovec(), which requires additional NULL pointer checks.
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: default avatarDavid Goulet <dgoulet@ev0ke.net>
      CC: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      CC: Anton Blanchard <anton@samba.org>
      CC: David S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5772ee1f
    • Sarah Sharp's avatar
      xhci: Handle zero-length isochronous packets. · f1d44226
      Sarah Sharp authored
      commit 48df4a6f upstream.
      
      For a long time, the xHCI driver has had this note:
      	/* FIXME: Ignoring zero-length packets, can those happen? */
      
      It turns out that, yes, there are drivers that need to queue zero-length
      transfers for isochronous OUT transfers.  Without this patch, users will
      see kernel hang messages when a driver attempts to enqueue an isochronous
      URB with a zero length transfer (because count_isoc_trbs_needed will return
      zero for that TD, xhci_td->last_trb will never be set, and updating the
      dequeue pointer will cause an infinite loop).
      
      Matěj ran into this issue when using an NI Audio4DJ USB soundcard
      with the snd-usb-caiaq driver.  See
      	https://bugzilla.kernel.org/show_bug.cgi?id=40702
      
      Fix count_isoc_trbs_needed() to return 1 for zero-length transfers (thanks
      Alan on the math help).  Update the various TRB field calculations to deal
      with zero-length transfers.  We're still transferring one packet with a
      zero-length data payload, so the total_packet_count should be 1. The
      Transfer Burst Count (TBC) and Transfer Last Burst Packet Count (TLBPC)
      fields should be set to zero.
      
      This patch should be backported to kernels as old as 2.6.36.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: default avatarMatěj Laitl <matej@laitl.cz>
      Cc: Daniel Mack <zonque@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f1d44226
    • Sarah Sharp's avatar
      xhci: Remove TDs from TD lists when URBs are canceled. · 4343d2a2
      Sarah Sharp authored
      commit 585df1d9 upstream.
      
      When a driver tries to cancel an URB, and the host controller is dying,
      xhci_urb_dequeue will giveback the URB without removing the xhci_tds
      that comprise that URB from the td_list or the cancelled_td_list.  This
      can cause a race condition between the driver calling URB dequeue and
      the stop endpoint command watchdog timer.
      
      If the timer fires on a dying host, and a driver attempts to resubmit
      while the watchdog timer has dropped the xhci->lock to giveback a
      cancelled URB, URBs may be given back by the xhci_urb_dequeue() function.
      At that point, the URB's priv pointer will be freed and set to NULL, but
      the TDs will remain on the td_list.  This will cause an oops in
      xhci_giveback_urb_in_irq() when the watchdog timer attempts to loop
      through the endpoints' td_lists, giving back killed URBs.
      
      Make sure that xhci_urb_dequeue() removes TDs from the TD lists and
      canceled TD lists before it gives back the URB.
      
      This patch should be backported to kernels as old as 2.6.36.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Andiry Xu <andiry.xu@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      4343d2a2
    • Sarah Sharp's avatar
      xhci: Fix failed enqueue in the middle of isoch TD. · 8a8045bd
      Sarah Sharp authored
      commit 522989a2 upstream.
      
      When an isochronous transfer is enqueued, xhci_queue_isoc_tx_prepare()
      will ensure that there is enough room on the transfer rings for all of the
      isochronous TDs for that URB.  However, when xhci_queue_isoc_tx() is
      enqueueing individual isoc TDs, the prepare_transfer() function can fail
      if the endpoint state has changed to disabled, error, or some other
      unknown state.
      
      With the current code, if Nth TD (not the first TD) fails, the ring is
      left in a sorry state.  The partially enqueued TDs are left on the ring,
      and the first TRB of the TD is not given back to the hardware.  The
      enqueue pointer is left on the TRB after the last successfully enqueued
      TD.  This means the ring is basically useless.  Any new transfers will be
      enqueued after the failed TDs, which the hardware will never read because
      the cycle bit indicates it does not own them.  The ring will fill up with
      untransferred TDs, and the endpoint will be basically unusable.
      
      The untransferred TDs will also remain on the TD list.  Since the td_list
      is a FIFO, this basically means the ring handler will be waiting on TDs
      that will never be completed (or worse, dereference memory that doesn't
      exist any more).
      
      Change the code to clean up the isochronous ring after a failed transfer.
      If the first TD failed, simply return and allow the xhci_urb_enqueue
      function to free the urb_priv.  If the Nth TD failed, first remove the TDs
      from the td_list.  Then convert the TRBs that were enqueued into No-op
      TRBs.  Make sure to flip the cycle bit on all enqueued TRBs (including any
      link TRBs in the middle or between TDs), but leave the cycle bit of the
      first TRB (which will show software-owned) intact.  Then move the ring
      enqueue pointer back to the first TRB and make sure to change the
      xhci_ring's cycle state to what is appropriate for that ring segment.
      
      This ensures that the No-op TRBs will be overwritten by subsequent TDs,
      and the hardware will not start executing random TRBs because the cycle
      bit was left as hardware-owned.
      
      This bug is unlikely to be hit, but it was something I noticed while
      tracking down the watchdog timer issue.  I verified that the fix works by
      injecting some errors on the 250th isochronous URB queued, although I
      could not verify that the ring is in the correct state because uvcvideo
      refused to talk to the device after the first usb_submit_urb() failed.
      Ring debugging shows that the ring looks correct, however.
      
      This patch should be backported to kernels as old as 2.6.36.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Andiry Xu <andiry.xu@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8a8045bd
    • Sarah Sharp's avatar
      xhci: Fix memory leak during failed enqueue. · e0a45189
      Sarah Sharp authored
      commit d13565c1 upstream.
      
      When the isochronous transfer support was introduced, and the xHCI driver
      switched to using urb->hcpriv to store an "urb_priv" pointer, a couple of
      memory leaks were introduced into the URB enqueue function in its error
      handling paths.
      
      xhci_urb_enqueue allocates urb_priv, but it doesn't free it if changing
      the control endpoint's max packet size fails or the bulk endpoint is in
      the middle of allocating or deallocating streams.
      
      xhci_urb_enqueue also doesn't free urb_priv if any of the four endpoint
      types' enqueue functions fail.  Instead, it expects those functions to
      free urb_priv if an error occurs.  However, the bulk, control, and
      interrupt enqueue functions do not free urb_priv if the endpoint ring is
      NULL.  It will, however, get freed if prepare_transfer() fails in those
      enqueue functions.
      
      Several of the error paths in the isochronous endpoint enqueue function
      also fail to free it.  xhci_queue_isoc_tx_prepare() doesn't free urb_priv
      if prepare_ring() indicates there is not enough room for all the
      isochronous TDs in this URB.  If individual isochronous TDs fail to be
      queued (perhaps due to an endpoint state change), urb_priv is also leaked.
      
      This argues that the freeing of urb_priv should be done in the function
      that allocated it, xhci_urb_enqueue.
      
      This patch looks rather ugly, but refactoring the code will have to wait
      because this patch needs to be backported to stable kernels.
      
      This patch should be backported to kernels as old as 2.6.36.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Andiry Xu <andiry.xu@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e0a45189
    • Andiry Xu's avatar
      xHCI: report USB2 port in resuming as suspend · dbb2e00b
      Andiry Xu authored
      commit 8a8ff2f9 upstream.
      
      When a USB2 port initiate a remote wakeup, software shall ensure that
      resume is signaled for at least 20ms, and then write '0' to the PLS field.
      According to this, xhci driver do the following things:
      
      1. When receive a remote wakeup event in irq_handler, set the resume_done
         value as jiffies + 20ms, and modify rh_timer to poll root hub status at
         that time;
      2. When receive a GetPortStatus request, if the jiffies is after the
         resume_done value, clear the resume signal and resume_done.
      
      However, if usb_port_resume() is called before the rh_timer triggered, it
      will indicate the port as Suspend Cleared and skip the clear resume signal
      part. The device will fail the usb_get_status request in finish_port_resume(),
      and usbcore will try a reset-resume instead. Device will work OK after
      reset-resume, but resume_done value is not cleared in this case, and
      xhci_bus_suspend() will fail because when it finds a non-zero resume_done
      value, it will regard the port as resuming and return -EBUSY.
      
      This causes issue on some platforms that the system fail to suspend
      after remote wakeup from suspend by USB2 devices connected to xHCI port.
      
      To fix this issue, report the port status as suspend if the resume is
      signaling less that 20ms, and usb_port_resume() will wait 25ms and check
      port status again, so xHCI driver can clear the resume signaling and
      resume_done value.
      
      This should be backported to kernels as old as 2.6.37.
      Signed-off-by: default avatarAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      dbb2e00b
    • Andiry Xu's avatar
      xHCI: fix port U3 status check condition · eff52962
      Andiry Xu authored
      commit 5ac04bf1 upstream.
      
      Fix the port U3 status check when Clear PORT_SUSPEND Feature.
      The port status should be masked with PORT_PLS_MASK to check if it's in
      U3 state.
      
      This should be backported to kernels as old as 2.6.37.
      Signed-off-by: default avatarAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      eff52962
    • Wang Zhi's avatar
      USB: EHCI: Do not rely on PORT_SUSPEND to stop USB resuming in ehci_bus_resume(). · cde5eaf3
      Wang Zhi authored
      commit d0f2fb25 upstream.
      
      From EHCI Spec p.28 HC should clear PORT_SUSPEND when SW clears
      PORT_RESUME. In Intel Oaktrail platform, MPH (Multi-Port Host
      Controller) core clears PORT_SUSPEND directly when SW sets PORT_RESUME
      bit. If we rely on PORT_SUSPEND bit to stop USB resume, we will miss
      the action of clearing PORT_RESUME. This will cause unexpected long
      resume signal on USB bus.
      Signed-off-by: default avatarWang Zhi <zhi.wang@windriver.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      cde5eaf3
    • Per Forlin's avatar
      usb: musb: cppi: fix build errors due to DBG and missing musb variable · f91364f8
      Per Forlin authored
      commit f847a79a upstream.
      
      Replace DBG with dev_dbg and fix invalid access of musb->controller.
      With this patch cppi_dma builds successfully.
      Signed-off-by: default avatarPer Forlin <per.forlin@linaro.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f91364f8
    • Andrew Bird's avatar
      USB option driver K3765/K4505 avoid CDC_DATA interface · 6ab711f9
      Andrew Bird authored
      commit 6118514e upstream.
      
      Currently the Option driver avoids binding interface 1 on Huawei K3765
      and K4505 broadband modems as it should be handled by the cdc_ether
      driver instead. This patch ensures we don't bind the interface 2
      on those devices as that is CDC_DATA.
      Signed-off-by: default avatarAndrew Bird <ajb@spheresystems.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6ab711f9
    • Gavin.zhu's avatar
      USB: option: add YUGA device id to driver · 42dc061e
      Gavin.zhu authored
      commit c6eb2d75 upstream.
      Signed-off-by: default avatarGavin.zhu <gavin.kx@qq.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      42dc061e
    • Andrew Bird's avatar
      USB option driver add PID of Huawei Vodafone K4605 · f5cda959
      Andrew Bird authored
      commit 7e180584 upstream.
      
      This patch adds the product ID of Huawei's Vodafone K4605 mobile broadband
      modem to option.c. This is necessary so that the driver gets loaded on
      demand without the intervention of usb_modeswitch. This has the benefit of
      it becoming available faster and also ensures that the option driver is not
      bound to a network interface that should be claimed by suitable network
      driver.
      Signed-off-by: default avatarAndrew Bird <ajb@spheresystems.co.uk>
      Signed-off-by: default avatarAlex Chiang <achiang@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f5cda959
    • Andrew Bird's avatar
      USB option driver add PID of Huawei Vodafone K3806 · 04aac018
      Andrew Bird authored
      commit 0e69d75c upstream.
      
      This patch adds the product ID of Huawei's Vodafone K3806 mobile broadband
      modem to option.c. This is necessary so that the driver gets loaded on
      demand without the intervention of usb_modeswitch. This has the benefit of
      it becoming available faster and also ensures that the option driver is not
      bound to a network interface that should be claimed by cdc_ether.
      Signed-off-by: default avatarAndrew Bird <ajb@spheresystems.co.uk>
      Signed-off-by: default avatarAlex Chiang <achiang@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      04aac018
    • Yulgon Kim's avatar
      usb: s5p-ehci: fix a NULL pointer deference · b942664b
      Yulgon Kim authored
      commit e5d3d446 upstream.
      
      This patch fixes a NULL pointer deference. A NULL pointer
      dereference happens since s5p_ehci->hcd field is not initialized
      yet in probe function.
      
      [jg1.han@samsung.com: edit commit message]
      Signed-off-by: default avatarYulgon Kim <yulgon.kim@samsung.com>
      Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b942664b
    • Jean-Christophe PLAGNIOL-VILLARD's avatar
      USB: ftdi_sio: add Calao reference board support · 400e39dc
      Jean-Christophe PLAGNIOL-VILLARD authored
      commit c96fbdd0 upstream.
      
      Calao use on there dev kits a FT2232 where the port 0 is used for the JTAG and
      port 1 for the UART
      
      They use the same VID and PID as FTDI Chip but they program the manufacturer
      name in the eeprom
      
      So use this information to detect it
      Signed-off-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
      Cc: Gregory Hermant <gregory.hermant@calao-systems.com>
      Cc: Alan Cox <alan@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      400e39dc
    • Jiri Slaby's avatar
      TTY: pty, fix pty counting · a38df1a0
      Jiri Slaby authored
      commit 24d406a6 upstream.
      
      tty_operations->remove is normally called like:
      queue_release_one_tty
       ->tty_shutdown
         ->tty_driver_remove_tty
           ->tty_operations->remove
      
      However tty_shutdown() is called from queue_release_one_tty() only if
      tty_operations->shutdown is NULL. But for pty, it is not.
      pty_unix98_shutdown() is used there as ->shutdown.
      
      So tty_operations->remove of pty (i.e. pty_unix98_remove()) is never
      called. This results in invalid pty_count. I.e. what can be seen in
      /proc/sys/kernel/pty/nr.
      
      I see this was already reported at:
        https://lkml.org/lkml/2009/11/5/370
      But it was not fixed since then.
      
      This patch is kind of a hackish way. The problem lies in ->install. We
      allocate there another tty (so-called tty->link). So ->install is
      called once, but ->remove twice, for both tty and tty->link. The fix
      here is to count both tty and tty->link and divide the count by 2 for
      user.
      
      And to have ->remove called, let's make tty_driver_remove_tty() global
      and call that from pty_unix98_shutdown() (tty_operations->shutdown).
      
      While at it, let's document that when ->shutdown is defined,
      tty_shutdown() is not called.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Cc: Alan Cox <alan@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a38df1a0
    • Axel Lin's avatar
      tty: Add "spi:" prefix for spi modalias · 64da3499
      Axel Lin authored
      commit 8c4074cd upstream.
      
      Since commit e0626e38 (spi: prefix modalias with "spi:"),
      the spi modalias is prefixed with "spi:".
      
      This patch adds "spi:" prefix and removes "-spi" suffix in the modalias.
      Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      64da3499
    • Al Cooper's avatar
      8250: Fix race condition in serial8250_backup_timeout(). · db14205c
      Al Cooper authored
      commit dbb3b1ca upstream.
      
      This is to fix an issue where output will suddenly become very slow.
      The problem occurs on 8250 UARTS with the hardware bug UART_BUG_THRE.
      
      BACKGROUND
      For normal UARTs (without UART_BUG_THRE): When the serial core layer
      gets new transmit data and the transmitter is idle, it buffers the
      data and calls the 8250s' serial8250_start_tx() routine which will
      simply enable the TX interrupt in the IER register and return. This
      should immediately fire a THRE interrupt and begin transmitting the
      data.
      For buggy UARTs (with UART_BUG_THRE): merely enabling the TX interrupt
      in IER does not necessarily generate a new THRE interrupt.
      Therefore, a background timer periodically checks to see if there is
      pending data, and starts transmission if that is the case.
      
      The bug happens on SMP systems when the system has nothing to transmit,
      the transmit interrupt is disabled and the following sequence occurs:
      - CPU0: The background timer routine serial8250_backup_timeout()
        starts and saves the state of the interrupt enable register (IER)
        and then disables all interrupts in IER. NOTE: The transmit interrupt
        (TI) bit is saved as disabled.
      - CPU1: The serial core gets data to transmit, grabs the port lock and
        calls serial8250_start_tx() which enables the TI in IER.
      - CPU0: serial8250_backup_timeout() waits for the port lock.
      - CPU1: finishes (with TI enabled) and releases the port lock.
      - CPU0: serial8250_backup_timeout() calls the interrupt routine which
        will transmit the next fifo's worth of data and then restores the
        IER from the previously saved value (TI disabled).
      At this point, as long as the serial core has more transmit data
      buffered, it will not call serial8250_start_tx() again and the
      background timer routine will slowly transmit the data.
      
      The fix is to have serial8250_start_tx() get the port lock before
      it saves the IER state and release it after restoring IER. This will
      prevent serial8250_start_tx() from running in parallel.
      Signed-off-by: default avatarAl Cooper <alcooperx@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      db14205c
    • Eric Smith's avatar
      8250_pci: add support for Rosewill RC-305 4x serial port card · 48fb01de
      Eric Smith authored
      commit 44178176 upstream.
      
      This patch adds support for the Rosewill RC-305 four-port PCI serial
      card, and probably any other four-port serial cards based on the
      Moschip MCS9865 chip, assuming that the EEPROM on the card was
      programmed in accordance with Table 6 of the MCS9865 EEPROM
      Application Note version 0.3 dated 16-May-2008, available from the
      Moschip web site (registration required).
      
      This patch is based on an earlier patch [1] for the SYBA 6x serial
      port card by Ira W. Snyder.
      
      [1]: http://www.gossamer-threads.com/lists/linux/kernel/1162435Signed-off-by: default avatarEric Smith <eric@brouhaha.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      48fb01de
    • Bjorn Helgaas's avatar
      serial: 8250_pnp: add Intermec CV60 touchscreen device · ecc0d72d
      Bjorn Helgaas authored
      commit ab8ba3a2 upstream.
      
      It would have been nice if Intermec had supplied a PNP0501 _CID for the
      COM3 device, but they didn't, so we have to recognize it explicitly.
      
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=40612
      CC: Jeff Chua <jeff.chua.linux@gmail.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarAlan Cox <alan@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ecc0d72d
    • Nick Pelly's avatar
      omap-serial: Allow IXON and IXOFF to be disabled. · f64bd12b
      Nick Pelly authored
      commit b280a97d upstream.
      
      Fixes logic bug that software flow control cannot be disabled, because
      serial_omap_configure_xonxoff() is not called if both IXON and IXOFF bits
      are cleared.
      Signed-off-by: default avatarNick Pelly <npelly@google.com>
      Acked-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Tested-by: default avatarGovindraj.R <govindraj.raja@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f64bd12b
    • Scott Jiang's avatar
      ASoC: ad193x: fix dac word len setting · f794b763
      Scott Jiang authored
      commit 95c93d85 upstream.
      
      dac word len value should left shift before setting
      Signed-off-by: default avatarScott Jiang <scott.jiang.linux@gmail.com>
      Acked-by: default avatarBarry Song <21cnbao@gmail.com>
      Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f794b763