1. 13 Nov, 2014 40 commits
    • Yu Zhao's avatar
      mm: free compound page with correct order · ce55507d
      Yu Zhao authored
      commit 5ddacbe9 upstream.
      
      Compound page should be freed by put_page() or free_pages() with correct
      order.  Not doing so will cause tail pages leaked.
      
      The compound order can be obtained by compound_order() or use
      HPAGE_PMD_ORDER in our case.  Some people would argue the latter is
      faster but I prefer the former which is more general.
      
      This bug was observed not just on our servers (the worst case we saw is
      11G leaked on a 48G machine) but also on our workstations running Ubuntu
      based distro.
      
        $ cat /proc/vmstat  | grep thp_zero_page_alloc
        thp_zero_page_alloc 55
        thp_zero_page_alloc_failed 0
      
      This means there is (thp_zero_page_alloc - 1) * (2M - 4K) memory leaked.
      
      Fixes: 97ae1749 ("thp: implement refcounting for huge zero page")
      Signed-off-by: default avatarYu Zhao <yuzhao@google.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Bob Liu <lliubbo@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      ce55507d
    • Johan Hovold's avatar
      USB: kobil_sct: fix non-atomic allocation in write path · b67eae08
      Johan Hovold authored
      commit 19125283 upstream.
      
      Write may be called from interrupt context so make sure to use
      GFP_ATOMIC for all allocations in write.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      b67eae08
    • Hans de Goede's avatar
      usb: Do not allow usb_alloc_streams on unconfigured devices · bfdb4179
      Hans de Goede authored
      commit 90a646c7 upstream.
      
      This commit fixes the following oops:
      
      [10238.622067] scsi host3: uas_eh_bus_reset_handler start
      [10240.766164] usb 3-4: reset SuperSpeed USB device number 3 using xhci_hcd
      [10245.779365] usb 3-4: device descriptor read/8, error -110
      [10245.883331] usb 3-4: reset SuperSpeed USB device number 3 using xhci_hcd
      [10250.897603] usb 3-4: device descriptor read/8, error -110
      [10251.058200] BUG: unable to handle kernel NULL pointer dereference at  0000000000000040
      [10251.058244] IP: [<ffffffff815ac6e1>] xhci_check_streams_endpoint+0x91/0x140
      <snip>
      [10251.059473] Call Trace:
      [10251.059487]  [<ffffffff815aca6c>] xhci_calculate_streams_and_bitmask+0xbc/0x130
      [10251.059520]  [<ffffffff815aeb5f>] xhci_alloc_streams+0x10f/0x5a0
      [10251.059548]  [<ffffffff810a4685>] ? check_preempt_curr+0x75/0xa0
      [10251.059575]  [<ffffffff810a46dc>] ? ttwu_do_wakeup+0x2c/0x100
      [10251.059601]  [<ffffffff810a49e6>] ? ttwu_do_activate.constprop.111+0x66/0x70
      [10251.059635]  [<ffffffff815779ab>] usb_alloc_streams+0xab/0xf0
      [10251.059662]  [<ffffffffc0616b48>] uas_configure_endpoints+0x128/0x150 [uas]
      [10251.059694]  [<ffffffffc0616bac>] uas_post_reset+0x3c/0xb0 [uas]
      [10251.059722]  [<ffffffff815727d9>] usb_reset_device+0x1b9/0x2a0
      [10251.059749]  [<ffffffffc0616f42>] uas_eh_bus_reset_handler+0xb2/0x190 [uas]
      [10251.059781]  [<ffffffff81514293>] scsi_try_bus_reset+0x53/0x110
      [10251.059808]  [<ffffffff815163b7>] scsi_eh_bus_reset+0xf7/0x270
      <snip>
      
      The problem is the following call sequence (simplified):
      
      1) usb_reset_device
      2)  usb_reset_and_verify_device
      2)   hub_port_init
      3)    hub_port_finish_reset
      3)     xhci_discover_or_reset_device
              This frees xhci->devs[slot_id]->eps[ep_index].ring for all eps but 0
      4)    usb_get_device_descriptor
             This fails
      5)   hub_port_init fails
      6)  usb_reset_and_verify_device fails, does not restore device config
      7)  uas_post_reset
      8)   xhci_alloc_streams
            NULL deref on the free-ed ring
      
      This commit fixes this by not allowing usb_alloc_streams to continue if
      the device is not configured.
      
      Note that we do allow usb_free_streams to continue after a (logical)
      disconnect, as it is necessary to explicitly free the streams at the xhci
      controller level.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      bfdb4179
    • Johan Hovold's avatar
      USB: opticon: fix non-atomic allocation in write path · b7b72e58
      Johan Hovold authored
      commit e681286d upstream.
      
      Write may be called from interrupt context so make sure to use
      GFP_ATOMIC for all allocations in write.
      
      Fixes: 0d930e51 ("USB: opticon: Add Opticon OPN2001 write support")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      b7b72e58
    • Alan Stern's avatar
      usb-storage: handle a skipped data phase · 2aa22734
      Alan Stern authored
      commit 93c9bf4d upstream.
      
      Sometimes mass-storage devices using the Bulk-only transport will
      mistakenly skip the data phase of a command.  Rather than sending the
      data expected by the host or sending a zero-length packet, they go
      directly to the status phase and send the CSW.
      
      This causes problems for usb-storage, for obvious reasons.  The driver
      will interpret the CSW as a short data transfer and will wait to
      receive a CSW.  The device won't have anything left to send, so the
      command eventually times out.
      
      The SCSI layer doesn't retry commands after they time out (this is a
      relatively recent change).  Therefore we should do our best to detect
      a skipped data phase and handle it promptly.
      
      This patch adds code to do that.  If usb-storage receives a short
      13-byte data transfer from the device, and if the first four bytes of
      the data match the CSW signature, the driver will set the residue to
      the full transfer length and interpret the data as a CSW.
      
      This fixes Bugzilla #86611.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Tested-by: default avatarPaul Osmialowski <newchief@king.net.pl>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      2aa22734
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix device_del() sysfs warnings at disconnect · 2dbb38ff
      Takashi Iwai authored
      commit 0725dda2 upstream.
      
      Some USB-audio devices show weird sysfs warnings at disconnecting the
      devices, e.g.
       usb 1-3: USB disconnect, device number 3
       ------------[ cut here ]------------
       WARNING: CPU: 0 PID: 973 at fs/sysfs/group.c:216 device_del+0x39/0x180()
       sysfs group ffffffff8183df40 not found for kobject 'midiC1D0'
       Call Trace:
        [<ffffffff814a3e38>] ? dump_stack+0x49/0x71
        [<ffffffff8103cb72>] ? warn_slowpath_common+0x82/0xb0
        [<ffffffff8103cc55>] ? warn_slowpath_fmt+0x45/0x50
        [<ffffffff813521e9>] ? device_del+0x39/0x180
        [<ffffffff81352339>] ? device_unregister+0x9/0x20
        [<ffffffff81352384>] ? device_destroy+0x34/0x40
        [<ffffffffa00ba29f>] ? snd_unregister_device+0x7f/0xd0 [snd]
        [<ffffffffa025124e>] ? snd_rawmidi_dev_disconnect+0xce/0x100 [snd_rawmidi]
        [<ffffffffa00c0192>] ? snd_device_disconnect+0x62/0x90 [snd]
        [<ffffffffa00c025c>] ? snd_device_disconnect_all+0x3c/0x60 [snd]
        [<ffffffffa00bb574>] ? snd_card_disconnect+0x124/0x1a0 [snd]
        [<ffffffffa02e54e8>] ? usb_audio_disconnect+0x88/0x1c0 [snd_usb_audio]
        [<ffffffffa015260e>] ? usb_unbind_interface+0x5e/0x1b0 [usbcore]
        [<ffffffff813553e9>] ? __device_release_driver+0x79/0xf0
        [<ffffffff81355485>] ? device_release_driver+0x25/0x40
        [<ffffffff81354e11>] ? bus_remove_device+0xf1/0x130
        [<ffffffff813522b9>] ? device_del+0x109/0x180
        [<ffffffffa01501d5>] ? usb_disable_device+0x95/0x1f0 [usbcore]
        [<ffffffffa014634f>] ? usb_disconnect+0x8f/0x190 [usbcore]
        [<ffffffffa0149179>] ? hub_thread+0x539/0x13a0 [usbcore]
        [<ffffffff810669f5>] ? sched_clock_local+0x15/0x80
        [<ffffffff81066c98>] ? sched_clock_cpu+0xb8/0xd0
        [<ffffffff81070730>] ? bit_waitqueue+0xb0/0xb0
        [<ffffffffa0148c40>] ? usb_port_resume+0x430/0x430 [usbcore]
        [<ffffffffa0148c40>] ? usb_port_resume+0x430/0x430 [usbcore]
        [<ffffffff8105973e>] ? kthread+0xce/0xf0
        [<ffffffff81059670>] ? kthread_create_on_node+0x1c0/0x1c0
        [<ffffffff814a8b7c>] ? ret_from_fork+0x7c/0xb0
        [<ffffffff81059670>] ? kthread_create_on_node+0x1c0/0x1c0
       ---[ end trace 40b1928d1136b91e ]---
      
      This comes from the fact that usb-audio driver may receive the
      disconnect callback multiple times, per each usb interface.  When a
      device has both audio and midi interfaces, it gets called twice, and
      currently the driver tries to release resources at the last call.
      At this point, the first parent interface has been already deleted,
      thus deleting a child of the first parent hits such a warning.
      
      For fixing this problem, we need to call snd_card_disconnect() and
      cancel pending operations at the very first disconnect while the
      release of the whole objects waits until the last disconnect call.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80931Reported-and-tested-by: default avatarTomas Gayoso <tgayoso@gmail.com>
      Reported-and-tested-by: default avatarChris J Arges <chris.j.arges@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      2dbb38ff
    • Adel Gadllah's avatar
      HID: usbhid: enable always-poll quirk for Elan Touchscreen 016f · 07c1ac29
      Adel Gadllah authored
      commit 1af39588 upstream.
      
      This device needs the quirk as well.
      Tested-by: default avatarKevin Fenzi <kevin@scrye.com>
      Signed-off-by: default avatarAdel Gadllah <adel.gadllah@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      07c1ac29
    • Adel Gadllah's avatar
      HID: usbhid: enable always-poll quirk for Elan Touchscreen 009b · 51925e17
      Adel Gadllah authored
      commit 29d05c2e upstream.
      
      This device needs the quirk as well.
      Signed-off-by: default avatarAdel Gadllah <adel.gadllah@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      51925e17
    • Johan Hovold's avatar
      HID: usbhid: enable always-poll quirk for Elan Touchscreen · 12127f7f
      Johan Hovold authored
      commit bfe3c873 upstream.
      
      Enable the always-poll quirk for Elan Touchscreens found on some recent
      Samsung laptops.
      
      Without this quirk the device keeps disconnecting from the bus (and is
      re-enumerated) unless opened (and kept open, should an input event
      occur).
      
      Note that while the device can be run-time suspended, the autosuspend
      timeout must be high enough to allow the device to be polled at least
      once before being suspended. Specifically, using autosuspend_delay_ms=0
      will still cause the device to disconnect on input events.
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      12127f7f
    • Johan Hovold's avatar
      HID: usbhid: add always-poll quirk · 972b69a5
      Johan Hovold authored
      commit 0b750b3b upstream.
      
      Add quirk to make sure that a device is always polled for input events
      even if it hasn't been opened.
      
      This is needed for devices that disconnects from the bus unless the
      interrupt endpoint has been polled at least once or when not responding
      to an input event (e.g. after having shut down X).
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      972b69a5
    • Adel Gadllah's avatar
      USB: quirks: enable device-qualifier quirk for yet another Elan touchscreen · 605e3548
      Adel Gadllah authored
      commit d7499475 upstream.
      
      Yet another device affected by this.
      Tested-by: default avatarKevin Fenzi <kevin@scrye.com>
      Signed-off-by: default avatarAdel Gadllah <adel.gadllah@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      605e3548
    • Adel Gadllah's avatar
      USB: quirks: enable device-qualifier quirk for another Elan touchscreen · 21748d8c
      Adel Gadllah authored
      commit 876af5d4 upstream.
      
      Currently this quirk is enabled for the model with the device id 0x0089, it
      is needed for the 0x009b model, which is found on the Fujitsu Lifebook u904
      as well.
      Signed-off-by: default avatarAdel Gadllah <adel.gadllah@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      21748d8c
    • Johan Hovold's avatar
      USB: quirks: enable device-qualifier quirk for Elan Touchscreen · 08972217
      Johan Hovold authored
      commit c68929f7 upstream.
      
      Enable device-qualifier quirk for Elan Touchscreen, which often fails to
      handle requests for the device_descriptor.
      
      Note that the device sometimes do respond properly with a Request Error
      (three times as USB core retries), but usually fails to respond at all.
      When this happens any further descriptor requests also fails, for
      example:
      
      [ 1528.688934] usb 2-7: new full-speed USB device number 4 using xhci_hcd
      [ 1530.945588] usb 2-7: unable to read config index 0 descriptor/start: -71
      [ 1530.945592] usb 2-7: can't read configurations, error -71
      
      This has been observed repeating for over a minute before eventual
      successful enumeration.
      Reported-by: default avatarDrew Von Spreecken <drewvs@gmail.com>
      Reported-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      08972217
    • Johan Hovold's avatar
      USB: core: add device-qualifier quirk · 856cb361
      Johan Hovold authored
      commit 2a159389 upstream.
      
      Add new quirk for devices that cannot handle requests for the
      device_qualifier descriptor.
      
      A USB-2.0 compliant device must respond to requests for the
      device_qualifier descriptor (even if it's with a request error), but at
      least one device is known to misbehave after such a request.
      Suggested-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      856cb361
    • Thomas Gleixner's avatar
      usb: musb: cppi41: restart hrtimer only if not yet done · cd4386a9
      Thomas Gleixner authored
      commit d2e6d62c upstream.
      
      commit c58d80f5 ("usb: musb: Ensure that cppi41 timer gets armed on
      premature DMA TX irq") fixed hrtimer scheduling bug. There is one left
      which does not trigger that often.
      The following scenario is still possible:
      
          lock(&x->lock);
          hrtimer_start(&x->t);
          unlock(&x->lock);
      
      expires:
          t->function();
                                      lock(&x->lock);
          lock(&x->lock);             if (!hrtimer_queued(&x->t))
                                              hrtimer_start(&x->t);
                                      unlock(&x->lock);
      
          if (!list_empty(x->early_tx_list))
                 ret = HRTIMER_RESTART;
      ->         hrtimer_forward_now(...)
          } else
                 ret = HRTIMER_NORESTART;
      
          unlock(&x->lock);
      
      and the timer callback returns HRTIMER_RESTART for an armed timer. This
      is wrong and we run into the BUG_ON() in __run_hrtimer().
      This can happens on SMP or PREEMPT-RT.
      The patch fixes the problem by only starting the timer if the timer is
      not yet queued.
      Reported-by: default avatarTorben Hohn <torbenh@linutronix.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      [bigeasy: collected information and created a patch + description based
                on it]
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      cd4386a9
    • Dmitry Eremin-Solenikov's avatar
      spi: pxa2xx: toggle clocks on suspend if not disabled by runtime PM · 45b5df58
      Dmitry Eremin-Solenikov authored
      commit 2b9375b9 upstream.
      
      If PM_RUNTIME is enabled, it is easy to trigger the following backtrace
      on pxa2xx hosts:
      
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 1 at /home/lumag/linux/arch/arm/mach-pxa/clock.c:35 clk_disable+0xa0/0xa8()
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-00007-g1b3d2ee-dirty #104
      [<c000de68>] (unwind_backtrace) from [<c000c078>] (show_stack+0x10/0x14)
      [<c000c078>] (show_stack) from [<c001d75c>] (warn_slowpath_common+0x6c/0x8c)
      [<c001d75c>] (warn_slowpath_common) from [<c001d818>] (warn_slowpath_null+0x1c/0x24)
      [<c001d818>] (warn_slowpath_null) from [<c0015e80>] (clk_disable+0xa0/0xa8)
      [<c0015e80>] (clk_disable) from [<c02507f8>] (pxa2xx_spi_suspend+0x2c/0x34)
      [<c02507f8>] (pxa2xx_spi_suspend) from [<c0200360>] (platform_pm_suspend+0x2c/0x54)
      [<c0200360>] (platform_pm_suspend) from [<c0207fec>] (dpm_run_callback.isra.14+0x2c/0x74)
      [<c0207fec>] (dpm_run_callback.isra.14) from [<c0209254>] (__device_suspend+0x120/0x2f8)
      [<c0209254>] (__device_suspend) from [<c0209a94>] (dpm_suspend+0x50/0x208)
      [<c0209a94>] (dpm_suspend) from [<c00455ac>] (suspend_devices_and_enter+0x8c/0x3a0)
      [<c00455ac>] (suspend_devices_and_enter) from [<c0045ad4>] (pm_suspend+0x214/0x2a8)
      [<c0045ad4>] (pm_suspend) from [<c04b5c34>] (test_suspend+0x14c/0x1dc)
      [<c04b5c34>] (test_suspend) from [<c000880c>] (do_one_initcall+0x8c/0x1fc)
      [<c000880c>] (do_one_initcall) from [<c04aecfc>] (kernel_init_freeable+0xf4/0x1b4)
      [<c04aecfc>] (kernel_init_freeable) from [<c0378078>] (kernel_init+0x8/0xec)
      [<c0378078>] (kernel_init) from [<c0009590>] (ret_from_fork+0x14/0x24)
      ---[ end trace 46524156d8faa4f6 ]---
      
      This happens because suspend function tries to disable a clock that is
      already disabled by runtime_suspend callback. Add if
      (!pm_runtime_suspended()) checks to suspend/resume path.
      
      Fixes: 7d94a505 (spi/pxa2xx: add support for runtime PM)
      Signed-off-by: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Reported-by: default avatarAndrea Adami <andrea.adami@gmail.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      45b5df58
    • Alexander Stein's avatar
      spi: fsl-dspi: Fix CTAR selection · 35a3997b
      Alexander Stein authored
      commit 5cc7b047 upstream.
      
      There are only 4 CTAR registers (CTAR0 - CTAR3) so we can only use the
      lower 2 bits of the chip select to select a CTAR register.
      SPI_PUSHR_CTAS used the lower 3 bits which would result in wrong bit values
      if the chip selects 4/5 are used. For those chip selects SPI_CTAR even
      calculated offsets of non-existing registers.
      Signed-off-by: default avatarAlexander Stein <alexander.stein@systec-electronic.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      35a3997b
    • Ray Jui's avatar
      spi: pl022: Fix incorrect dma_unmap_sg · d0ef4acc
      Ray Jui authored
      commit 3ffa6158 upstream.
      
      When mapped RX DMA entries are unmapped in an error condition when DMA
      is firstly configured in the driver, the number of TX DMA entries was
      passed in, which is incorrect
      Signed-off-by: default avatarRay Jui <rjui@broadcom.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      d0ef4acc
    • Jack Pham's avatar
      usb: dwc3: gadget: Properly initialize LINK TRB · 37529c72
      Jack Pham authored
      commit 1200a82a upstream.
      
      On ISOC endpoints the last trb_pool entry used as a
      LINK TRB is not getting zeroed out correctly due to
      memset being called incorrectly and in the wrong place.
      If pool allocated from DMA was not zero-initialized
      to begin with this will result in the size and ctrl
      values being random garbage. Call memset correctly after
      assignment of the trb_link pointer.
      
      Fixes: f6bafc6a ("usb: dwc3: convert TRBs into bitshifts")
      Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      37529c72
    • Cyril Brulebois's avatar
      wireless: rt2x00: add new rt2800usb device · 28af2ea5
      Cyril Brulebois authored
      commit 664d6a79 upstream.
      
      0x1b75 0xa200 AirLive WN-200USB wireless 11b/g/n dongle
      
      References: https://bugs.debian.org/766802Reported-by: default avatarMartin Mokrejs <mmokrejs@fold.natur.cuni.cz>
      Signed-off-by: default avatarCyril Brulebois <kibi@debian.org>
      Acked-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      28af2ea5
    • Xose Vazquez Perez's avatar
      wireless: rt2x00: add new rt2800usb devices · 538563b0
      Xose Vazquez Perez authored
      commit 6a06e554 upstream.
      
      0x0b05 0x17e8 RT5372 USB 2.0  bgn 2x2 ASUS USB-N14
      0x0411 0x0253 RT5572 USB 2.0 abgn 2x2 BUFFALO WLP-U2-300D
      0x0df6 0x0078 RT???? Sitecom N300
      
      Cc: Ivo van Doorn <IvDoorn@gmail.com>
      Cc: Helmut Schaa <helmut.schaa@googlemail.com>
      Cc: John W. Linville <linville@tuxdriver.com>
      Cc: users@rt2x00.serialmonkey.com
      Cc: linux-wireless@vger.kernel.org
      Signed-off-by: default avatarXose Vazquez Perez <xose.vazquez@gmail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      538563b0
    • Canek Peláez Valdés's avatar
      rt2x00: support Ralink 5362. · 8237ba54
      Canek Peláez Valdés authored
      commit ac0372ab upstream.
      Signed-off-by: default avatarCanek Peláez Valdés <canek@ciencias.unam.mx>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      8237ba54
    • Dan Williams's avatar
      USB: option: add Haier CE81B CDMA modem · ced7ff3a
      Dan Williams authored
      commit 012eee15 upstream.
      
      Port layout:
      
      0: QCDM/DIAG
      1: NMEA
      2: AT
      3: AT/PPP
      Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      ced7ff3a
    • Daniele Palmas's avatar
      usb: option: add support for Telit LE910 · fab757e5
      Daniele Palmas authored
      commit 2d0eb862 upstream.
      
      Add VID/PID for Telit LE910 modem. Interfaces description is almost the
      same than LE920, except that the qmi interface is number 2 (instead than
      5).
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      fab757e5
    • Johan Hovold's avatar
      USB: cdc-acm: only raise DTR on transitions from B0 · fca03f32
      Johan Hovold authored
      commit 4473d054 upstream.
      
      Make sure to only raise DTR on transitions from B0 in set_termios.
      
      Also allow set_termios to be called from open with a termios_old of
      NULL. Note that DTR will not be raised prematurely in this case.
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      fca03f32
    • Johan Hovold's avatar
      USB: cdc-acm: add device id for GW Instek AFG-2225 · 4a776e6a
      Johan Hovold authored
      commit cf84a691 upstream.
      
      Add device-id entry for GW Instek AFG-2225, which has a byte swapped
      bInterfaceSubClass (0x20).
      Reported-by: default avatarKarl Palsson <karlp@tweak.net.au>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      4a776e6a
    • Perry Hung's avatar
      usb: serial: ftdi_sio: add "bricked" FTDI device PID · 0de57c08
      Perry Hung authored
      commit 7f2719f0 upstream.
      
      An official recent Windows driver from FTDI detects counterfeit devices
      and reprograms the internal EEPROM containing the USB PID to 0, effectively
      bricking the device.
      
      Add support for this VID/PID pair to correctly bind the driver on these
      devices.
      
      See:
      http://hackaday.com/2014/10/22/watch-that-windows-update-ftdi-drivers-are-killing-fake-chips/Signed-off-by: default avatarPerry Hung <iperry@gmail.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      0de57c08
    • Frans Klaver's avatar
      usb: serial: ftdi_sio: add Awinda Station and Dongle products · ff8aff4d
      Frans Klaver authored
      commit edd74ffa upstream.
      
      Add new IDs for the Xsens Awinda Station and Awinda Dongle.
      
      While at it, order the definitions by PID and add a logical separation
      between devices using Xsens' VID and those using FTDI's VID.
      Signed-off-by: default avatarFrans Klaver <frans.klaver@xsens.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      ff8aff4d
    • Nathaniel Ting's avatar
      USB: serial: cp210x: add Silicon Labs 358x VID and PID · 088cfbaf
      Nathaniel Ting authored
      commit 35cc83ea upstream.
      
      Enable Silicon Labs Ember VID chips to enumerate with the cp210x usb serial
      driver. EM358x devices operating with the Ember Z-Net 5.1.2 stack may now
      connect to host PCs over a USB serial link.
      Signed-off-by: default avatarNathaniel Ting <nathaniel.ting@silabs.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      088cfbaf
    • Peter Hurley's avatar
      serial: Fix divide-by-zero fault in uart_get_divisor() · 7261d5fa
      Peter Hurley authored
      commit 547039ec upstream.
      
      uart_get_baud_rate() will return baud == 0 if the max rate is set
      to the "magic" 38400 rate and the SPD_* flags are also specified.
      On the first iteration, if the current baud rate is higher than the
      max, the baud rate is clamped at the max (which in the degenerate
      case is 38400). On the second iteration, the now-"magic" 38400 baud
      rate selects the possibly higher alternate baud rate indicated by
      the SPD_* flag. Since only two loop iterations are performed, the
      loop is exited, a kernel WARNING is generated and a baud rate of
      0 is returned.
      
      Reproducible with:
       setserial /dev/ttyS0 spd_hi base_baud 38400
      
      Only perform the "magic" 38400 -> SPD_* baud transform on the first
      loop iteration, which prevents the degenerate case from recognizing
      the clamped baud rate as the "magic" 38400 value.
      Reported-by: default avatarRobert Święcki <robert@swiecki.net>
      Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      7261d5fa
    • Lars-Peter Clausen's avatar
      staging:iio:ade7758: Remove "raw" from channel name · 9f9387ff
      Lars-Peter Clausen authored
      commit b598aacc upstream.
      
      "raw" is a property of a channel, but should not be part of the name of
      channel.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      9f9387ff
    • Lars-Peter Clausen's avatar
      staging:iio:ade7758: Fix check if channels are enabled in prenable · 4cf866e1
      Lars-Peter Clausen authored
      commit 79fa64eb upstream.
      
      We should check if a channel is enabled, not if no channels are enabled.
      
      Fixes: 550268ca ("staging:iio: scrap scan_count and ensure all drivers use active_scan_mask")
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      4cf866e1
    • Lars-Peter Clausen's avatar
      staging:iio:ade7758: Fix NULL pointer deref when enabling buffer · ca313dd3
      Lars-Peter Clausen authored
      commit e1055473 upstream.
      
      In older versions of the IIO framework it was possible to pass a completely
      different set of channels to iio_buffer_register() as the one that is
      assigned to the IIO device. Commit 959d2952 ("staging:iio: make
      iio_sw_buffer_preenable much more general.") introduced a restriction that
      requires that the set of channels that is passed to iio_buffer_register() is
      a subset of the channels assigned to the IIO device as the IIO core will use
      the list of channels that is assigned to the device to lookup a channel by
      scan index in iio_compute_scan_bytes(). If it can not find the channel the
      function will crash. This patch fixes the issue by making sure that the same
      set of channels is assigned to the IIO device and passed to
      iio_buffer_register().
      
      Note that we need to remove the IIO_CHAN_INFO_RAW and IIO_CHAN_INFO_SCALE
      info attributes from the channels since we don't actually want those to be
      registered.
      
      Fixes the following crash:
      	Unable to handle kernel NULL pointer dereference at virtual address 00000016
      	pgd = d2094000
      	[00000016] *pgd=16e39831, *pte=00000000, *ppte=00000000
      	Internal error: Oops: 17 [#1] PREEMPT SMP ARM
      	Modules linked in:
      	CPU: 1 PID: 1695 Comm: bash Not tainted 3.17.0-06329-g29461ee #9686
      	task: d7768040 ti: d5bd4000 task.ti: d5bd4000
      	PC is at iio_compute_scan_bytes+0x38/0xc0
      	LR is at iio_compute_scan_bytes+0x34/0xc0
      	pc : [<c0316de8>]    lr : [<c0316de4>]    psr: 60070013
      	sp : d5bd5ec0  ip : 00000000  fp : 00000000
      	r10: d769f934  r9 : 00000000  r8 : 00000001
      	r7 : 00000000  r6 : c8fc6240  r5 : d769f800  r4 : 00000000
      	r3 : d769f800  r2 : 00000000  r1 : ffffffff  r0 : 00000000
      	Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      	Control: 18c5387d  Table: 1209404a  DAC: 00000015
      	Process bash (pid: 1695, stack limit = 0xd5bd4240)
      	Stack: (0xd5bd5ec0 to 0xd5bd6000)
      	5ec0: d769f800 d7435640 c8fc6240 d769f984 00000000 c03175a4 d7435690 d7435640
      	5ee0: d769f990 00000002 00000000 d769f800 d5bd4000 00000000 000b43a8 c03177f4
      	5f00: d769f810 0162b8c8 00000002 c8fc7e00 d77f1d08 d77f1da8 c8fc7e00 c01faf1c
      	5f20: 00000002 c010694c c010690c d5bd5f88 00000002 c8fc6840 c8fc684c c0105e08
      	5f40: 00000000 00000000 d20d1580 00000002 000af408 d5bd5f88 c000de84 c00b76d4
      	5f60: d20d1580 000af408 00000002 d20d1580 d20d1580 00000002 000af408 c000de84
      	5f80: 00000000 c00b7a44 00000000 00000000 00000002 b6ebea78 00000002 000af408
      	5fa0: 00000004 c000dd00 b6ebea78 00000002 00000001 000af408 00000002 00000000
      	5fc0: b6ebea78 00000002 000af408 00000004 bee96a4c 000a6094 00000000 000b43a8
      	5fe0: 00000000 bee969cc b6e2eb77 b6e6525c 40070010 00000001 00000000 00000000
      	[<c0316de8>] (iio_compute_scan_bytes) from [<c03175a4>] (__iio_update_buffers+0x248/0x438)
      	[<c03175a4>] (__iio_update_buffers) from [<c03177f4>] (iio_buffer_store_enable+0x60/0x7c)
      	[<c03177f4>] (iio_buffer_store_enable) from [<c01faf1c>] (dev_attr_store+0x18/0x24)
      	[<c01faf1c>] (dev_attr_store) from [<c010694c>] (sysfs_kf_write+0x40/0x4c)
      	[<c010694c>] (sysfs_kf_write) from [<c0105e08>] (kernfs_fop_write+0x110/0x154)
      	[<c0105e08>] (kernfs_fop_write) from [<c00b76d4>] (vfs_write+0xbc/0x170)
      	[<c00b76d4>] (vfs_write) from [<c00b7a44>] (SyS_write+0x40/0x78)
      	[<c00b7a44>] (SyS_write) from [<c000dd00>] (ret_fast_syscall+0x0/0x30)
      
      Fixes: 959d2952 ("staging:iio: make iio_sw_buffer_preenable much more general.")
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      ca313dd3
    • Lars-Peter Clausen's avatar
      staging:iio:ad5933: Drop "raw" from channel names · 0a63bb30
      Lars-Peter Clausen authored
      commit 6822ee34 upstream.
      
      "raw" is the name of a channel property, but should not be part of the
      channel name itself.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      0a63bb30
    • Lars-Peter Clausen's avatar
      staging:iio:ad5933: Fix NULL pointer deref when enabling buffer · 5cb3a556
      Lars-Peter Clausen authored
      commit 824269c5 upstream.
      
      In older versions of the IIO framework it was possible to pass a
      completely different set of channels to iio_buffer_register() as the one
      that is assigned to the IIO device. Commit 959d2952 ("staging:iio: make
      iio_sw_buffer_preenable much more general.") introduced a restriction that
      requires that the set of channels that is passed to iio_buffer_register() is
      a subset of the channels assigned to the IIO device as the IIO core will use
      the list of channels that is assigned to the device to lookup a channel by
      scan index in iio_compute_scan_bytes(). If it can not find the channel the
      function will crash. This patch fixes the issue by making sure that the same
      set of channels is assigned to the IIO device and passed to
      iio_buffer_register().
      
      Fixes the follow NULL pointer derefernce kernel crash:
      	Unable to handle kernel NULL pointer dereference at virtual address 00000016
      	pgd = d53d0000
      	[00000016] *pgd=1534e831, *pte=00000000, *ppte=00000000
      	Internal error: Oops: 17 [#1] PREEMPT SMP ARM
      	Modules linked in:
      	CPU: 1 PID: 1626 Comm: bash Not tainted 3.15.0-19969-g2a180eb-dirty #9545
      	task: d6c124c0 ti: d539a000 task.ti: d539a000
      	PC is at iio_compute_scan_bytes+0x34/0xa8
      	LR is at iio_compute_scan_bytes+0x34/0xa8
      	pc : [<c03052e4>]    lr : [<c03052e4>]    psr: 60070013
      	sp : d539beb8  ip : 00000001  fp : 00000000
      	r10: 00000002  r9 : 00000000  r8 : 00000001
      	r7 : 00000000  r6 : d6dc8800  r5 : d7571000  r4 : 00000002
      	r3 : d7571000  r2 : 00000044  r1 : 00000001  r0 : 00000000
      	Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      	Control: 18c5387d  Table: 153d004a  DAC: 00000015
      	Process bash (pid: 1626, stack limit = 0xd539a240)
      	Stack: (0xd539beb8 to 0xd539c000)
      	bea0:                                                       c02fc0e4 d7571000
      	bec0: d76c1640 d6dc8800 d757117c 00000000 d757112c c0305b04 d76c1690 d76c1640
      	bee0: d7571188 00000002 00000000 d7571000 d539a000 00000000 000dd1c8 c0305d54
      	bf00: d7571010 0160b868 00000002 c69d3900 d7573278 d7573308 c69d3900 c01ece90
      	bf20: 00000002 c0103fac c0103f6c d539bf88 00000002 c69d3b00 c69d3b0c c0103468
      	bf40: 00000000 00000000 d7694a00 00000002 000af408 d539bf88 c000dd84 c00b2f94
      	bf60: d7694a00 000af408 00000002 d7694a00 d7694a00 00000002 000af408 c000dd84
      	bf80: 00000000 c00b32d0 00000000 00000000 00000002 b6f1aa78 00000002 000af408
      	bfa0: 00000004 c000dc00 b6f1aa78 00000002 00000001 000af408 00000002 00000000
      	bfc0: b6f1aa78 00000002 000af408 00000004 be806a4c 000a6094 00000000 000dd1c8
      	bfe0: 00000000 be8069cc b6e8ab77 b6ec125c 40070010 00000001 22940489 154a5007
      	[<c03052e4>] (iio_compute_scan_bytes) from [<c0305b04>] (__iio_update_buffers+0x248/0x438)
      	[<c0305b04>] (__iio_update_buffers) from [<c0305d54>] (iio_buffer_store_enable+0x60/0x7c)
      	[<c0305d54>] (iio_buffer_store_enable) from [<c01ece90>] (dev_attr_store+0x18/0x24)
      	[<c01ece90>] (dev_attr_store) from [<c0103fac>] (sysfs_kf_write+0x40/0x4c)
      	[<c0103fac>] (sysfs_kf_write) from [<c0103468>] (kernfs_fop_write+0x110/0x154)
      	[<c0103468>] (kernfs_fop_write) from [<c00b2f94>] (vfs_write+0xd0/0x160)
      	[<c00b2f94>] (vfs_write) from [<c00b32d0>] (SyS_write+0x40/0x78)
      	[<c00b32d0>] (SyS_write) from [<c000dc00>] (ret_fast_syscall+0x0/0x30)
      	Code: ea00000e e1a01008 e1a00005 ebfff6fc (e5d0a016)
      
      Fixes: 959d2952 ("staging:iio: make iio_sw_buffer_preenable much more general.")
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      5cb3a556
    • Robin van der Gracht's avatar
      iio: st_sensors: Fix buffer copy · 3d375f0e
      Robin van der Gracht authored
      commit 4250c90b upstream.
      
      Use byte_for_channel as iterator to properly initialize the buffer.
      Signed-off-by: default avatarRobin van der Gracht <robin@protonic.nl>
      Acked-by: default avatarDenis Ciocca <denis.ciocca@st.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      3d375f0e
    • Michal Hocko's avatar
      OOM, PM: OOM killed task shouldn't escape PM suspend · b76e0469
      Michal Hocko authored
      commit 5695be14 upstream.
      
      PM freezer relies on having all tasks frozen by the time devices are
      getting frozen so that no task will touch them while they are getting
      frozen. But OOM killer is allowed to kill an already frozen task in
      order to handle OOM situtation. In order to protect from late wake ups
      OOM killer is disabled after all tasks are frozen. This, however, still
      keeps a window open when a killed task didn't manage to die by the time
      freeze_processes finishes.
      
      Reduce the race window by checking all tasks after OOM killer has been
      disabled. This is still not race free completely unfortunately because
      oom_killer_disable cannot stop an already ongoing OOM killer so a task
      might still wake up from the fridge and get killed without
      freeze_processes noticing. Full synchronization of OOM and freezer is,
      however, too heavy weight for this highly unlikely case.
      
      Introduce and check oom_kills counter which gets incremented early when
      the allocator enters __alloc_pages_may_oom path and only check all the
      tasks if the counter changes during the freezing attempt. The counter
      is updated so early to reduce the race window since allocator checked
      oom_killer_disabled which is set by PM-freezing code. A false positive
      will push the PM-freezer into a slow path but that is not a big deal.
      
      Changes since v1
      - push the re-check loop out of freeze_processes into
        check_frozen_processes and invert the condition to make the code more
        readable as per Rafael
      
      Fixes: f660daac (oom: thaw threads if oom killed thread is frozen before deferring)
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.cz>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      b76e0469
    • Cong Wang's avatar
      freezer: Do not freeze tasks killed by OOM killer · a8b7bdea
      Cong Wang authored
      commit 51fae6da upstream.
      
      Since f660daac (oom: thaw threads if oom killed thread is frozen
      before deferring) OOM killer relies on being able to thaw a frozen task
      to handle OOM situation but a3201227 (freezer: make freezing() test
      freeze conditions in effect instead of TIF_FREEZE) has reorganized the
      code and stopped clearing freeze flag in __thaw_task. This means that
      the target task only wakes up and goes into the fridge again because the
      freezing condition hasn't changed for it. This reintroduces the bug
      fixed by f660daac.
      
      Fix the issue by checking for TIF_MEMDIE thread flag in
      freezing_slow_path and exclude the task from freezing completely. If a
      task was already frozen it would get woken by __thaw_task from OOM killer
      and get out of freezer after rechecking freezing().
      
      Changes since v1
      - put TIF_MEMDIE check into freezing_slowpath rather than in __refrigerator
        as per Oleg
      - return __thaw_task into oom_scan_process_thread because
        oom_kill_process will not wake task in the fridge because it is
        sleeping uninterruptible
      
      [mhocko@suse.cz: rewrote the changelog]
      Fixes: a3201227 (freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE)
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.cz>
      Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      a8b7bdea
    • Libin Yang's avatar
      ALSA: hda - add codec ID for Braswell display audio codec · 64118eaa
      Libin Yang authored
      commit d1585c89 upstream.
      
      This patch adds codec ID (0x80862883) and module alias for Braswell
      display codec.
      Signed-off-by: default avatarLibin Yang <libin.yang@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      64118eaa
    • Libin Yang's avatar
      ALSA: hda - add PCI IDs for Intel Braswell · 7e5b9724
      Libin Yang authored
      commit f31b2ffc upstream.
      
      Add HD Audio Device PCI ID for the Intel Braswell platform.
      It is an HDA Intel PCH controller.
      
      AZX_DCAPS_ALIGN_BUFSIZE is not necessary for this controller.
      Signed-off-by: default avatarLibin Yang <libin.yang@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      7e5b9724