1. 25 1月, 2015 24 次提交
  2. 15 1月, 2015 2 次提交
    • A
      usb: dwc3: gadget: Stop TRB preparation after limit is reached · 39e60635
      Amit Virdi 提交于
      DWC3 gadget sets up a pool of 32 TRBs for each EP during initialization. This
      means, the max TRBs that can be submitted for an EP is fixed to 32. Since the
      request queue for an EP is a linked list, any number of requests can be queued
      to it by the gadget layer.  However, the dwc3 driver must not submit TRBs more
      than the pool it has created for. This limit wasn't respected when SG was used
      resulting in submitting more than the max TRBs, eventually leading to
      non-transfer of the TRBs submitted over the max limit.
      
      Root cause:
      When SG is used, there are two loops iterating to prepare TRBs:
       - Outer loop over the request_list
       - Inner loop over the SG list
      The code was missing break to get out of the outer loop.
      
      Fixes: eeb720fb (usb: dwc3: gadget: add support for SG lists)
      Cc: <stable@vger.kernel.org> # v3.9+
      Signed-off-by: NAmit Virdi <amit.virdi@st.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      39e60635
    • A
      usb: dwc3: gadget: Fix TRB preparation during SG · ec512fb8
      Amit Virdi 提交于
      When scatter gather (SG) is used, multiple TRBs are prepared from one DWC3
      request (dwc3_request). So while preparing TRBs, the 'last' flag should be set
      only when it is the last TRB being prepared from the last dwc3_request entry.
      
      The current implementation uses list_is_last to check if the dwc3_request is the
      last entry from the request_list. However, list_is_last returns false for the
      last entry too. This is because, while preparing the first TRB from a request,
      the function dwc3_prepare_one_trb modifies the request's next and prev pointers
      while moving the URB to req_queued. Hence, list_is_last always returns false no
      matter what.
      
      The correct way is not to access the modified pointers of dwc3_request but to
      use list_empty macro instead.
      
      Fixes: e5ba5ec8 (usb: dwc3: gadget: fix scatter gather implementation)
      Signed-off-by: NAmit Virdi <amit.virdi@st.com>
      Cc: <stable@vger.kernel.org> # v3.9+
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ec512fb8
  3. 13 1月, 2015 1 次提交
    • A
      usb: phy: mv-usb: fix usb_phy build errors · 90bdf403
      Arnd Bergmann 提交于
      The driver was recently adapted to a core API change, but the
      change was incomplete, missing out the suspend helper and
      leaving an extraneous local variable around:
      
      usb/phy/phy-mv-usb.c: In function 'mv_otg_update_state':
      usb/phy/phy-mv-usb.c:341:18: warning: unused variable 'phy' [-Wunused-variable]
      
      usb/phy/phy-mv-usb.c: In function 'mv_otg_suspend':
      usb/phy/phy-mv-usb.c:861:16: error: 'struct usb_phy' has no member named 'state'
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Fixes: e47d9254 ("usb: move the OTG state from the USB PHY to the OTG structure")
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      90bdf403
  4. 12 1月, 2015 2 次提交
  5. 10 1月, 2015 11 次提交
    • J
      USB: console: fix potential use after free · 32a4bf2e
      Johan Hovold 提交于
      Use tty kref to release the fake tty in usb_console_setup to avoid use
      after free if the underlying serial driver has acquired a reference.
      
      Note that using the tty destructor release_one_tty requires some more
      state to be initialised.
      
      Fixes: 4a90f09b ("tty: usb-serial krefs")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      32a4bf2e
    • J
      USB: console: fix uninitialised ldisc semaphore · d269d443
      Johan Hovold 提交于
      The USB console currently allocates a temporary fake tty which is used
      to pass terminal settings to the underlying serial driver.
      
      The tty struct is not fully initialised, something which can lead to a
      lockdep warning (or worse) if a serial driver tries to acquire a
      line-discipline reference:
      
      	usbserial: USB Serial support registered for pl2303
      	pl2303 1-2.1:1.0: pl2303 converter detected
      	usb 1-2.1: pl2303 converter now attached to ttyUSB0
      	INFO: trying to register non-static key.
      	the code is fine but needs lockdep annotation.
      	turning off the locking correctness validator.
      	CPU: 0 PID: 68 Comm: udevd Tainted: G        W      3.18.0-rc5 #10
      	[<c0016f04>] (unwind_backtrace) from [<c0013978>] (show_stack+0x20/0x24)
      	[<c0013978>] (show_stack) from [<c0449794>] (dump_stack+0x24/0x28)
      	[<c0449794>] (dump_stack) from [<c006f730>] (__lock_acquire+0x1e50/0x2004)
      	[<c006f730>] (__lock_acquire) from [<c0070128>] (lock_acquire+0xe4/0x18c)
      	[<c0070128>] (lock_acquire) from [<c027c6f8>] (ldsem_down_read_trylock+0x78/0x90)
      	[<c027c6f8>] (ldsem_down_read_trylock) from [<c027a1cc>] (tty_ldisc_ref+0x24/0x58)
      	[<c027a1cc>] (tty_ldisc_ref) from [<c0340760>] (usb_serial_handle_dcd_change+0x48/0xe8)
      	[<c0340760>] (usb_serial_handle_dcd_change) from [<bf000484>] (pl2303_read_int_callback+0x210/0x220 [pl2303])
      	[<bf000484>] (pl2303_read_int_callback [pl2303]) from [<c031624c>] (__usb_hcd_giveback_urb+0x80/0x140)
      	[<c031624c>] (__usb_hcd_giveback_urb) from [<c0316fc0>] (usb_giveback_urb_bh+0x98/0xd4)
      	[<c0316fc0>] (usb_giveback_urb_bh) from [<c0042e44>] (tasklet_hi_action+0x9c/0x108)
      	[<c0042e44>] (tasklet_hi_action) from [<c0042380>] (__do_softirq+0x148/0x42c)
      	[<c0042380>] (__do_softirq) from [<c00429cc>] (irq_exit+0xd8/0x114)
      	[<c00429cc>] (irq_exit) from [<c007ae58>] (__handle_domain_irq+0x84/0xdc)
      	[<c007ae58>] (__handle_domain_irq) from [<c000879c>] (omap_intc_handle_irq+0xd8/0xe0)
      	[<c000879c>] (omap_intc_handle_irq) from [<c0014544>] (__irq_svc+0x44/0x7c)
      	Exception stack(0xdf4e7f08 to 0xdf4e7f50)
      	7f00:                   debc0b80 df4e7f5c 00000000 00000000 debc0b80 be8da96c
      	7f20: 00000000 00000128 c000fc84 df4e6000 00000000 df4e7f94 00000004 df4e7f50
      	7f40: c038ebc0 c038d74c 600f0013 ffffffff
      	[<c0014544>] (__irq_svc) from [<c038d74c>] (___sys_sendmsg.part.29+0x0/0x2e0)
      	[<c038d74c>] (___sys_sendmsg.part.29) from [<c038ec08>] (SyS_sendmsg+0x18/0x1c)
      	[<c038ec08>] (SyS_sendmsg) from [<c000fa00>] (ret_fast_syscall+0x0/0x48)
      	console [ttyUSB0] enabled
      
      Fixes: 36697529 ("tty: Replace ldisc locking with ldisc_sem")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      d269d443
    • S
      usb: gadget: udc: atmel: fix possible oops when unloading module · 5fb694f9
      Songjun Wu 提交于
      When unloading the module 'g_hid.ko', the urb request will be dequeued and the
      completion routine will be excuted. If there is no urb packet, the urb request
      will not be added to the endpoint queue and the completion routine pointer in
      urb request is NULL.
      
      Accessing to this NULL function pointer will cause the Oops issue reported
      below.
      
      Add the code to check if the urb request is in the endpoint queue
      or not. If the urb request is not in the endpoint queue, a negative
      error code will be returned.
      
      Here is the Oops log:
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000000
      pgd = dedf0000
      [00000000] *pgd=3ede5831, *pte=00000000, *ppte=00000000
      Internal error: Oops: 80000007 [#1] ARM
      Modules linked in: g_hid(-) usb_f_hid libcomposite
      CPU: 0 PID: 923 Comm: rmmod Not tainted 3.18.0+ #2
      Hardware name: Atmel SAMA5 (Device Tree)
      task: df6b1100 ti: dedf6000 task.ti: dedf6000
      PC is at 0x0
      LR is at usb_gadget_giveback_request+0xc/0x10
      pc : [<00000000>]    lr : [<c02ace88>]    psr: 60000093
      sp : dedf7eb0  ip : df572634  fp : 00000000
      r10: 00000000  r9 : df52e210  r8 : 60000013
      r7 : df6a9858  r6 : df52e210  r5 : df6a9858  r4 : df572600
      r3 : 00000000  r2 : ffffff98  r1 : df572600  r0 : df6a9868
      Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
      Control: 10c53c7d  Table: 3edf0059  DAC: 00000015
      Process rmmod (pid: 923, stack limit = 0xdedf6230)
      Stack: (0xdedf7eb0 to 0xdedf8000)
      7ea0:                                     00000000 c02adbbc df572580 deced608
      7ec0: df572600 df6a9868 df572634 c02aed3c df577c00 c01b8608 00000000 df6be27c
      7ee0: 00200200 00100100 bf0162f4 c000e544 dedf6000 00000000 00000000 bf010c00
      7f00: bf0162cc bf00159c 00000000 df572980 df52e218 00000001 df5729b8 bf0031d0
      [..]
      [<c02ace88>] (usb_gadget_giveback_request) from [<c02adbbc>] (request_complete+0x64/0x88)
      [<c02adbbc>] (request_complete) from [<c02aed3c>] (usba_ep_dequeue+0x70/0x128)
      [<c02aed3c>] (usba_ep_dequeue) from [<bf010c00>] (hidg_unbind+0x50/0x7c [usb_f_hid])
      [<bf010c00>] (hidg_unbind [usb_f_hid]) from [<bf00159c>] (remove_config.isra.6+0x98/0x9c [libcomposite])
      [<bf00159c>] (remove_config.isra.6 [libcomposite]) from [<bf0031d0>] (__composite_unbind+0x34/0x98 [libcomposite])
      [<bf0031d0>] (__composite_unbind [libcomposite]) from [<c02acee0>] (usb_gadget_remove_driver+0x50/0x78)
      [<c02acee0>] (usb_gadget_remove_driver) from [<c02ad570>] (usb_gadget_unregister_driver+0x64/0x94)
      [<c02ad570>] (usb_gadget_unregister_driver) from [<bf0160c0>] (hidg_cleanup+0x10/0x34 [g_hid])
      [<bf0160c0>] (hidg_cleanup [g_hid]) from [<c0056748>] (SyS_delete_module+0x118/0x19c)
      [<c0056748>] (SyS_delete_module) from [<c000e3c0>] (ret_fast_syscall+0x0/0x30)
      Code: bad PC value
      Signed-off-by: NSongjun Wu <songjun.wu@atmel.com>
      [nicolas.ferre@atmel.com: reworked the commit message]
      Signed-off-by: NNicolas Ferre <nicolas.ferre@atmel.com>
      Fixes: 914a3f3b ("USB: add atmel_usba_udc driver")
      Cc: <stable@vger.kernel.org> # 2.6.x-ish
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      5fb694f9
    • D
      usb: gadget: gadgetfs: fix an oops in ep_write() · 42d6cfa0
      Dan Carpenter 提交于
      We try to free an ERR_PTR on this error path.
      
      Fixes: b44be246 ('usb: gadget: gadgetfs: Free memory allocated by memdup_user()')
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      42d6cfa0
    • M
      usb: phy: Fix deferred probing · 9c9d8249
      Maxime Ripard 提交于
      Commit 1290a958 ("usb: phy: propagate __of_usb_find_phy()'s error on
      failure") actually broke the deferred probing mechanism, since it now returns
      EPROBE_DEFER only when the try_module_get call fails, but not when the phy
      lookup does.
      
      All the other similar functions seem to return ENODEV when try_module_get
      fails, and the error code of either __usb_find_phy or __of_usb_find_phy
      otherwise.
      
      In order to have a consistent behaviour, and a meaningful EPROBE_DEFER, always
      return EPROBE_DEFER when __(of_)usb_find_phy fails to look up the requested
      phy, that will be propagated by the caller, and ENODEV if try_module_get fails.
      Signed-off-by: NMaxime Ripard <maxime.ripard@free-electrons.com>
      Tested-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c9d8249
    • A
      OHCI: add a quirk for ULi M5237 blocking on reset · 56abcab8
      Arseny Solokha 提交于
      Commit 8dccddbc2368 ("OHCI: final fix for NVIDIA problems (I hope)")
      introduced into 3.1.9 broke boot on e.g. Freescale P2020DS development
      board. The code path that was previously specific to NVIDIA controllers
      had then become taken for all chips.
      
      However, the M5237 installed on the board wedges solid when accessing
      its base+OHCI_FMINTERVAL register, making it impossible to boot any
      kernel newer than 3.1.8 on this particular and apparently other similar
      machines.
      
      Don't readl() and writel() base+OHCI_FMINTERVAL on PCI ID 10b9:5237.
      
      The patch is suitable for the -next tree as well as all maintained
      kernels up to 3.2 inclusive.
      Signed-off-by: NArseny Solokha <asolokha@kb.kras.ru>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org> # 3.2
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56abcab8
    • W
      usb: host: drop owner assignment from platform_drivers · 1d978691
      Wolfram Sang 提交于
      These platform_drivers do not need to set an owner, it will be populated by the
      driver core.
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d978691
    • W
      usb: gadget: udc: bdc: drop owner assignment from platform_drivers · f1161256
      Wolfram Sang 提交于
      This platform_driver does not need to set an owner, it will be populated by the
      driver core.
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f1161256
    • A
      USB: host: Remove hard-coded octeon platform information for ehci/ohci · a95cfa6b
      Andreas Herrmann 提交于
      Instead rely on device tree information for ehci and ohci.
      
      This was suggested with
      http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=1401358203-60225-4-git-send-email-alex.smith%40imgtec.com
      
        "The device tree will *always* have correct ehci/ohci clock
        configuration, so use it.  This allows us to remove a big chunk of
        platform configuration code from octeon-platform.c."
      
      More or less I rebased that patch on Alan's work to remove ehci-octeon
      and ohci-octeon drivers.
      
      Cc: David Daney <david.daney@cavium.com>
      Cc: Alex Smith <alex.smith@imgtec.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NAndreas Herrmann <andreas.herrmann@caviumnetworks.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Tested-by: NAaro Koskinen <aaro.koskinen@iki.fi>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a95cfa6b
    • W
      USB: ehci-platform: Support ehci reset after resume quirk · 314b41b1
      Wu Liang feng 提交于
      The Rockchip rk3288 EHCI controller doesn't properly detect
      the case when a device is removed during suspend. Specifically,
      when usb resume from suspend, the EHCI controller maintaining
      the USB state (FLAG_CF is 1, Current Connect Status is 1),
      but a USB device (like a USB camera on rk3288) may have been
      disconnected actually.
      
      Let's add a quirk to force ehci to go into the
      usb_root_hub_lost_power() path and reset after resume.
      This should generally reset the whole controller and all
      ports and initialize everything cleanly again, and bring
      the devices back up.
      
      As part of this, rename the "hibernation" paramter of
      ehci_resume() to force_reset since hibernation is simply
      another case where we can't trust the autodetected status
      and need to force a reset of devices.
      Signed-off-by: NWu Liang feng <wulf@rock-chips.com>
      Reviewed-by: NJulius Werner <jwerner@google.com>
      Reviewed-by: NDoug Anderson <dianders@google.com>
      Reviewed-by: NTomasz Figa <tfiga@google.com>
      Reviewed-by: NPawel Osciak <posciak@google.com>
      Reviewed-by: NSonny Rao <sonnyrao@google.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NDoug Anderson <dianders@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      314b41b1
    • J
      usb: isp1760: Use setup_timer · b7aa4cc3
      Julia Lawall 提交于
      Convert a call to init_timer and accompanying intializations of
      the timer's data and function fields to a call to setup_timer.
      
      A simplified version of the semantic match that fixes this problem is as
      follows: (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression t,f,d;
      @@
      
      -init_timer(&t);
      +setup_timer(&t,f,d);
      -t.function = f;
      -t.data = d;
      // </smpl>
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7aa4cc3