20 Jan, 2021

3 commits

  • This is the 5.10.9 stable release

    * tag 'v5.10.9': (153 commits)
    Linux 5.10.9
    netfilter: nf_nat: Fix memleak in nf_nat_init
    netfilter: conntrack: fix reading nf_conntrack_buckets
    ...

    Signed-off-by: Jason Liu

    Jason Liu
     
  • This is the 5.10.7 stable release

    * tag 'v5.10.7': (144 commits)
    Linux 5.10.7
    scsi: target: Fix XCOPY NAA identifier lookup
    rtlwifi: rise completion at the last step of firmware callback
    ...

    Signed-off-by: Jason Liu

    Jason Liu
     
  • [ Upstream commit 41952a66015466c3208aac96b14ffd92e0943589 ]

    The name of the module for the NVIDIA alt-mode is incorrect as it
    looks to be a copy-paste error from the entry above, update it to
    the correct typec_nvidia module name.

    Cc: Ajay Gupta
    Cc: Heikki Krogerus
    Signed-off-by: Peter Robinson
    Link: https://lore.kernel.org/r/20210106001605.167917-1-pbrobinson@gmail.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Peter Robinson
     

13 Jan, 2021

29 commits

  • Remove an unused variable which was mistakingly left by commit
    37faf5061541 ("USB: serial: keyspan_pda: fix write-wakeup
    use-after-free") and only removed by a later change.

    This is needed to suppress a W=1 warning about the unused variable in
    the stable trees that the build bots triggers.

    Reported-by: kernel test robot
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 64e6bbfff52db4bf6785fab9cffab850b2de6870 upstream.

    There is a use-after-free issue, if access udc_name
    in function gadget_dev_desc_UDC_store after another context
    free udc_name in function unregister_gadget.

    Context 1:
    gadget_dev_desc_UDC_store()->unregister_gadget()->
    free udc_name->set udc_name to NULL

    Context 2:
    gadget_dev_desc_UDC_show()-> access udc_name

    Call trace:
    dump_backtrace+0x0/0x340
    show_stack+0x14/0x1c
    dump_stack+0xe4/0x134
    print_address_description+0x78/0x478
    __kasan_report+0x270/0x2ec
    kasan_report+0x10/0x18
    __asan_report_load1_noabort+0x18/0x20
    string+0xf4/0x138
    vsnprintf+0x428/0x14d0
    sprintf+0xe4/0x12c
    gadget_dev_desc_UDC_show+0x54/0x64
    configfs_read_file+0x210/0x3a0
    __vfs_read+0xf0/0x49c
    vfs_read+0x130/0x2b4
    SyS_read+0x114/0x208
    el0_svc_naked+0x34/0x38

    Add mutex_lock to protect this kind of scenario.

    Signed-off-by: Eddie Hung
    Signed-off-by: Macpaul Lin
    Reviewed-by: Peter Chen
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/1609239215-21819-1-git-send-email-macpaul.lin@mediatek.com
    Signed-off-by: Greg Kroah-Hartman

    Eddie Hung
     
  • commit 6cd0fe91387917be48e91385a572a69dfac2f3f7 upstream.

    When binding the ConfigFS gadget to a UDC, the functions in each
    configuration are added in list order. However, if usb_add_function()
    fails, the failed function is put back on its configuration's
    func_list and purge_configs_funcs() is called to further clean up.

    purge_configs_funcs() iterates over the configurations and functions
    in forward order, calling unbind() on each of the previously added
    functions. But after doing so, each function gets moved to the
    tail of the configuration's func_list. This results in reshuffling
    the original order of the functions within a configuration such
    that the failed function now appears first even though it may have
    originally appeared in the middle or even end of the list. At this
    point if the ConfigFS gadget is attempted to re-bind to the UDC,
    the functions will be added in a different order than intended,
    with the only recourse being to remove and relink the functions all
    over again.

    An example of this as follows:

    ln -s functions/mass_storage.0 configs/c.1
    ln -s functions/ncm.0 configs/c.1
    ln -s functions/ffs.adb configs/c.1 # oops, forgot to start adbd
    echo "" > UDC # fails
    start adbd
    echo "" > UDC # now succeeds, but...
    # bind order is
    # "ADB", mass_storage, ncm

    [30133.118289] configfs-gadget gadget: adding 'Mass Storage Function'/ffffff810af87200 to config 'c'/ffffff817d6a2520
    [30133.119875] configfs-gadget gadget: adding 'cdc_network'/ffffff80f48d1a00 to config 'c'/ffffff817d6a2520
    [30133.119974] using random self ethernet address
    [30133.120002] using random host ethernet address
    [30133.139604] usb0: HOST MAC 3e:27:46:ba:3e:26
    [30133.140015] usb0: MAC 6e:28:7e:42:66:6a
    [30133.140062] configfs-gadget gadget: adding 'Function FS Gadget'/ffffff80f3868438 to config 'c'/ffffff817d6a2520
    [30133.140081] configfs-gadget gadget: adding 'Function FS Gadget'/ffffff80f3868438 --> -19
    [30133.140098] configfs-gadget gadget: unbind function 'Mass Storage Function'/ffffff810af87200
    [30133.140119] configfs-gadget gadget: unbind function 'cdc_network'/ffffff80f48d1a00
    [30133.173201] configfs-gadget a600000.dwc3: failed to start g1: -19
    [30136.661933] init: starting service 'adbd'...
    [30136.700126] read descriptors
    [30136.700413] read strings
    [30138.574484] configfs-gadget gadget: adding 'Function FS Gadget'/ffffff80f3868438 to config 'c'/ffffff817d6a2520
    [30138.575497] configfs-gadget gadget: adding 'Mass Storage Function'/ffffff810af87200 to config 'c'/ffffff817d6a2520
    [30138.575554] configfs-gadget gadget: adding 'cdc_network'/ffffff80f48d1a00 to config 'c'/ffffff817d6a2520
    [30138.575631] using random self ethernet address
    [30138.575660] using random host ethernet address
    [30138.595338] usb0: HOST MAC 2e:cf:43:cd:ca:c8
    [30138.597160] usb0: MAC 6a:f0:9f:ee:82:a0
    [30138.791490] configfs-gadget gadget: super-speed config #1: c

    Fix this by reversing the iteration order of the functions in
    purge_config_funcs() when unbinding them, and adding them back to
    the config's func_list at the head instead of the tail. This
    ensures that we unbind and unwind back to the original list order.

    Fixes: 88af8bbe4ef7 ("usb: gadget: the start of the configfs interface")
    Signed-off-by: Chandana Kishori Chiluveru
    Signed-off-by: Jack Pham
    Reviewed-by: Peter Chen
    Link: https://lore.kernel.org/r/20201229224443.31623-1-jackp@codeaurora.org
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Chandana Kishori Chiluveru
     
  • commit 5cc35c224a80aa5a5a539510ef049faf0d6ed181 upstream.

    There is a spinlock lockup as part of composite_disconnect
    when it tries to acquire cdev->lock as part of usb_gadget_deactivate.
    This is because the usb_gadget_deactivate is called from
    usb_function_deactivate with the same spinlock held.

    This would result in the below call stack and leads to stall.

    rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
    rcu: 3-...0: (1 GPs behind) idle=162/1/0x4000000000000000
    softirq=10819/10819 fqs=2356
    (detected by 2, t=5252 jiffies, g=20129, q=3770)
    Task dump for CPU 3:
    task:uvc-gadget_wlhe state:R running task stack: 0 pid: 674 ppid:
    636 flags:0x00000202
    Call trace:
    __switch_to+0xc0/0x170
    _raw_spin_lock_irqsave+0x84/0xb0
    composite_disconnect+0x28/0x78
    configfs_composite_disconnect+0x68/0x70
    usb_gadget_disconnect+0x10c/0x128
    usb_gadget_deactivate+0xd4/0x108
    usb_function_deactivate+0x6c/0x80
    uvc_function_disconnect+0x20/0x58
    uvc_v4l2_release+0x30/0x88
    v4l2_release+0xbc/0xf0
    __fput+0x7c/0x230
    ____fput+0x14/0x20
    task_work_run+0x88/0x140
    do_notify_resume+0x240/0x6f0
    work_pending+0x8/0x200

    Fix this by doing an unlock on cdev->lock before the usb_gadget_deactivate
    call from usb_function_deactivate.

    The same lockup can happen in the usb_gadget_activate path. Fix that path
    as well.

    Reported-by: Peter Chen
    Link: https://lore.kernel.org/linux-usb/20201102094936.GA29581@b29397-desktop/
    Tested-by: Peter Chen
    Signed-off-by: Sriharsha Allenki
    Cc: stable
    Link: https://lore.kernel.org/r/20201202130220.24926-1-sallenki@codeaurora.org
    Signed-off-by: Greg Kroah-Hartman

    Sriharsha Allenki
     
  • commit c91d3a6bcaa031f551ba29a496a8027b31289464 upstream.

    If usb_otg_descriptor_alloc() failed, it need return ENOMEM.

    Fixes: 578aa8a2b12c ("usb: gadget: acm_ms: allocate and init otg descriptor by otg capabilities")
    Reported-by: Hulk Robot
    Signed-off-by: Yang Yingliang
    Cc: stable
    Link: https://lore.kernel.org/r/20201117092955.4102785-1-yangyingliang@huawei.com
    Signed-off-by: Greg Kroah-Hartman

    Yang Yingliang
     
  • commit 0a88fa221ce911c331bf700d2214c5b2f77414d3 upstream.

    Fix the MTU size issue with RX packet size as the host sends the packet
    with extra bytes containing ethernet header. This causes failure when
    user sets the MTU size to the maximum i.e. 15412. In this case the
    ethernet packet received will be of length 15412 plus the ethernet header
    length. This patch fixes the issue where there is a check that RX packet
    length must not be more than max packet length.

    Fixes: bba787a860fa ("usb: gadget: ether: Allow jumbo frames")
    Signed-off-by: Manish Narani
    Cc: stable
    Link: https://lore.kernel.org/r/1605597215-122027-1-git-send-email-manish.narani@xilinx.com
    Signed-off-by: Greg Kroah-Hartman

    Manish Narani
     
  • commit 2cc332e4ee4febcbb685e2962ad323fe4b3b750a upstream.

    When printer driver is loaded, the printer_func_bind function is called, in
    this function, the interface descriptor be allocated memory, if after that,
    the error occurred, the interface descriptor memory need to be free.

    Reviewed-by: Peter Chen
    Cc:
    Signed-off-by: Zqiang
    Link: https://lore.kernel.org/r/20201210020148.6691-1-qiang.zhang@windriver.com
    Signed-off-by: Greg Kroah-Hartman

    Zqiang
     
  • commit 9389044f27081d6ec77730c36d5bf9a1288bcda2 upstream.

    With commit 913e4a90b6f9 ("usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth")
    wMaxPacketSize is computed dynamically but the value is never reset.

    Because of this, the actual maximum packet size can only decrease each time
    the audio gadget is instantiated.

    Reset the endpoint maximum packet size and mark wMaxPacketSize as dynamic
    to solve the problem.

    Fixes: 913e4a90b6f9 ("usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth")
    Signed-off-by: Jerome Brunet
    Cc: stable
    Link: https://lore.kernel.org/r/20201221173531.215169-2-jbrunet@baylibre.com
    Signed-off-by: Greg Kroah-Hartman

    Jerome Brunet
     
  • commit c318840fb2a42ce25febc95c4c19357acf1ae5ca upstream.

    The dummy-hcd driver was written under the assumption that all the
    parameters in URBs sent to its root hub would be valid. With URBs
    sent from userspace via usbfs, that assumption can be violated.

    In particular, the driver doesn't fully check the port-feature values
    stored in the wValue entry of Clear-Port-Feature and Set-Port-Feature
    requests. Values that are too large can cause the driver to perform
    an invalid left shift of more than 32 bits. Ironically, two of those
    left shifts are unnecessary, because they implement Set-Port-Feature
    requests that hubs are not required to support, according to section
    11.24.2.13 of the USB-2.0 spec.

    This patch adds the appropriate checks for the port feature selector
    values and removes the unnecessary feature settings. It also rejects
    requests to set the TEST feature or to set or clear the INDICATOR and
    C_OVERCURRENT features, as none of these are relevant to dummy-hcd's
    root-hub emulation.

    CC:
    Reported-and-tested-by: syzbot+5925509f78293baa7331@syzkaller.appspotmail.com
    Signed-off-by: Alan Stern
    Link: https://lore.kernel.org/r/20201230162044.GA727759@rowland.harvard.edu
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • commit d7889c2020e08caab0d7e36e947f642d91015bd0 upstream.

    Without crc32 support, this driver fails to link:

    arm-linux-gnueabi-ld: drivers/usb/gadget/function/f_eem.o: in function `eem_unwrap':
    f_eem.c:(.text+0x11cc): undefined reference to `crc32_le'
    arm-linux-gnueabi-ld: drivers/usb/gadget/function/f_ncm.o:f_ncm.c:(.text+0x1e40):
    more undefined references to `crc32_le' follow

    Fixes: 6d3865f9d41f ("usb: gadget: NCM: Add transmit multi-frame.")
    Signed-off-by: Arnd Bergmann
    Cc: stable
    Link: https://lore.kernel.org/r/20210103214224.1996535-1-arnd@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit 020a1f453449294926ca548d8d5ca970926e8dfd upstream.

    Stack-allocated buffers cannot be used for DMA (on all architectures).

    Replace the HP-channel macro with a helper function that allocates a
    dedicated transfer buffer so that it can continue to be used with
    arguments from the stack.

    Note that the buffer is cleared on allocation as usblp_ctrl_msg()
    returns success also on short transfers (the buffer is only used for
    debugging).

    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold
    Link: https://lore.kernel.org/r/20210104145302.2087-1-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 372c93131998c0622304bed118322d2a04489e63 upstream.

    Make sure to always cancel the control URB in write() so that it can be
    reused after a timeout or spurious CMD_ACK.

    Currently any further write requests after a timeout would fail after
    triggering a WARN() in usb_submit_urb() when attempting to submit the
    already active URB.

    Reported-by: syzbot+e87ebe0f7913f71f2ea5@syzkaller.appspotmail.com
    Fixes: 6bc235a2e24a ("USB: add driver for Meywa-Denki & Kayac YUREX")
    Cc: stable # 2.6.37
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit d6c1ddd938d84a1adef7e19e8efc10e1b4df5034 upstream.

    New modem using ff/ff/30 for QCDM, ff/00/00 for AT and NMEA,
    and ff/ff/ff for RMNET/QMI.

    T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=5000 MxCh= 0
    D: Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs= 1
    P: Vendor=2c7c ProdID=0620 Rev= 4.09
    S: Manufacturer=Quectel
    S: Product=EM160R-GL
    S: SerialNumber=e31cedc1
    C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none)
    E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
    E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
    E: Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
    E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
    E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
    E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
    E: Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms
    E: Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E: Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms

    Cc: stable@vger.kernel.org
    Signed-off-by: Bjørn Mork
    [ johan: add model comment ]
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Bjørn Mork
     
  • commit 0e2d6795e8dbe91c2f5473564c6b25d11df3778b upstream.

    Add a device-id entry for the LongSung M5710 module.

    T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0
    D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=2df3 ProdID=9d03 Rev= 1.00
    S: Manufacturer=Marvell
    S: Product=Mobile Composite Device Bus
    S: SerialNumber=
    C:* #Ifs= 5 Cfg#= 1 Atr=c0 MxPwr=500mA
    A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
    E: Ad=87(I) Atr=03(Int.) MxPS= 64 Ivl=4096ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
    E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E: Ad=0c(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E: Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=4096ms
    E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E: Ad=88(I) Atr=03(Int.) MxPS= 64 Ivl=4096ms
    E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E: Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    Signed-off-by: Daniel Palmer
    https://lore.kernel.org/r/20201227031716.1343300-1-daniel@0x0f.com
    [ johan: drop id defines, only bind to vendor class ]
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Daniel Palmer
     
  • commit 54d0a3ab80f49f19ee916def62fe067596833403 upstream.

    Stack-allocated buffers cannot be used for DMA (on all architectures) so
    allocate the flush command buffer using kmalloc().

    Fixes: 60a8fc017103 ("USB: add iuu_phoenix driver")
    Cc: stable # 2.6.25
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 96ebc9c871d8a28fb22aa758dd9188a4732df482 upstream.

    Here's another variant PNY Pro Elite USB 3.1 Gen 2 portable SSD that
    hangs and doesn't respond to ATA_1x pass-through commands. If it doesn't
    support these commands, it should respond properly to the host. Add it
    to the unusual uas list to be able to move forward with other
    operations.

    Cc: stable@vger.kernel.org
    Reviewed-by: Hans de Goede
    Acked-by: Oliver Neukum
    Signed-off-by: Thinh Nguyen
    Link: https://lore.kernel.org/r/2edc7af892d0913bf06f5b35e49ec463f03d5ed8.1609819418.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman

    Thinh Nguyen
     
  • commit 718bf42b119de652ebcc93655a1f33a9c0d04b3c upstream.

    Fix shift out-of-bounds in vhci_hcd.c:

    UBSAN: shift-out-of-bounds in ../drivers/usb/usbip/vhci_hcd.c:399:41
    shift exponent 768 is too large for 32-bit type 'int'

    Fixes: 03cd00d538a6 ("usbip: vhci-hcd: Set the vhci structure up to work")
    Signed-off-by: Randy Dunlap
    Reported-by: syzbot+297d20e437b79283bf6d@syzkaller.appspotmail.com
    Cc: Yuyang Du
    Cc: Shuah Khan
    Cc: Greg Kroah-Hartman
    Cc: linux-usb@vger.kernel.org
    Cc: stable
    Link: https://lore.kernel.org/r/20201229071309.18418-1-rdunlap@infradead.org
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     
  • commit 5d5323a6f3625f101dbfa94ba3ef7706cce38760 upstream.

    The commit 0472bf06c6fd ("xhci: Prevent U1/U2 link pm states if exit
    latency is too long") was constraining the xhci code not to allow U1/U2
    sleep states if the latency to wake up from the U-states reached the
    service interval of an periodic endpoint. This fix was not taking into
    account that in case the quirk XHCI_INTEL_HOST is set, the wakeup time
    will be calculated and configured differently.

    It checks for u1_params.mel/u2_params.mel as a limit. But the code could
    decide to write another MEL into the hardware. This leads to broken
    cases where not enough bandwidth is available for other devices:

    usb 1-2: can't set config #1, error -28

    This patch is fixing that case by checking for timeout_ns after the
    wakeup time was calculated depending on the quirks.

    Fixes: 0472bf06c6fd ("xhci: Prevent U1/U2 link pm states if exit latency is too long")
    Signed-off-by: Michael Grzeschik
    Cc: stable
    Link: https://lore.kernel.org/r/20201215193147.11738-1-m.grzeschik@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Michael Grzeschik
     
  • commit 83a43ff80a566de8718dfc6565545a0080ec1fb5 upstream.

    if of_find_device_by_node() succeed, usbmisc_get_init_data() doesn't have
    a corresponding put_device(). Thus add put_device() to fix the exception
    handling for this function implementation.

    Fixes: ef12da914ed6 ("usb: chipidea: imx: properly check for usbmisc")
    Signed-off-by: Yu Kuai
    Cc: stable
    Link: https://lore.kernel.org/r/20201117011430.642589-1-yukuai3@huawei.com
    Signed-off-by: Greg Kroah-Hartman

    Yu Kuai
     
  • commit e5f4ca3fce90a37b23a77bfcc86800d484a80514 upstream.

    First of all the commit e0082698b689 ("usb: dwc3: ulpi: conditionally
    resume ULPI PHY") introduced the Suspend USB2.0 HS/FS/LS PHY regression,
    as by design of the fix any attempt to read/write from/to the PHY control
    registers will completely disable the PHY suspension, which consequently
    will increase the USB bus power consumption. Secondly the fix won't work
    well for the very first attempt of the ULPI PHY control registers IO,
    because after disabling the USB2.0 PHY suspension functionality it will
    still take some time for the bus to resume from the sleep state if one has
    been reached before it. So the very first PHY register read/write
    operation will take more time than the busy-loop provides and the IO
    timeout error might be returned anyway.

    Here we suggest to fix the denoted problems in the following way. First of
    all let's not disable the Suspend USB2.0 HS/FS/LS PHY functionality so to
    make the controller and the USB2.0 bus more power efficient. Secondly
    instead of that we'll extend the PHY IO op wait procedure with 1 - 1.2 ms
    sleep if the PHY suspension is enabled (1ms should be enough as by LPM
    specification it is at most how long it takes for the USB2.0 bus to resume
    from L1 (Sleep) state). Finally in case if the USB2.0 PHY suspension
    functionality has been disabled on the DWC USB3 controller setup procedure
    we'll compensate the USB bus resume process latency by extending the
    busy-loop attempts counter.

    Fixes: e0082698b689 ("usb: dwc3: ulpi: conditionally resume ULPI PHY")
    Acked-by: Heikki Krogerus
    Signed-off-by: Serge Semin
    Link: https://lore.kernel.org/r/20201210085008.13264-4-Sergey.Semin@baikalelectronics.ru
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Serge Semin
     
  • commit fca3f138105727c3a22edda32d02f91ce1bf11c9 upstream.

    Originally the procedure of the ULPI transaction finish detection has been
    developed as a simple busy-loop with just decrementing counter and no
    delays. It's wrong since on different systems the loop will take a
    different time to complete. So if the system bus and CPU are fast enough
    to overtake the ULPI bus and the companion PHY reaction, then we'll get to
    take a false timeout error. Fix this by converting the busy-loop procedure
    to take the standard bus speed, address value and the registers access
    mode into account for the busy-loop delay calculation.

    Here is the way the fix works. It's known that the ULPI bus is clocked
    with 60MHz signal. In accordance with [1] the ULPI bus protocol is created
    so to spend 5 and 6 clock periods for immediate register write and read
    operations respectively, and 6 and 7 clock periods - for the extended
    register writes and reads. Based on that we can easily pre-calculate the
    time which will be needed for the controller to perform a requested IO
    operation. Note we'll still preserve the attempts counter in case if the
    DWC USB3 controller has got some internals delays.

    [1] UTMI+ Low Pin Interface (ULPI) Specification, Revision 1.1,
    October 20, 2004, pp. 30 - 36.

    Fixes: 88bc9d194ff6 ("usb: dwc3: add ULPI interface support")
    Acked-by: Heikki Krogerus
    Signed-off-by: Serge Semin
    Link: https://lore.kernel.org/r/20201210085008.13264-3-Sergey.Semin@baikalelectronics.ru
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Serge Semin
     
  • commit ce722da66d3e9384aa2de9d33d584ee154e5e157 upstream.

    In accordance with [1] the DWC_usb3 core sets the GUSB2PHYACCn.VStsDone
    bit when the PHY vendor control access is done and clears it when the
    application initiates a new transaction. The doc doesn't say anything
    about the GUSB2PHYACCn.VStsBsy flag serving for the same purpose. Moreover
    we've discovered that the VStsBsy flag can be cleared before the VStsDone
    bit. So using the former as a signal of the PHY control registers
    completion might be dangerous. Let's have the VStsDone flag utilized
    instead then.

    [1] Synopsys DesignWare Cores SuperSpeed USB 3.0 xHCI Host Controller
    Databook, 2.70a, December 2013, p.388

    Fixes: 88bc9d194ff6 ("usb: dwc3: add ULPI interface support")
    Acked-by: Heikki Krogerus
    Signed-off-by: Serge Semin
    Link: https://lore.kernel.org/r/20201210085008.13264-2-Sergey.Semin@baikalelectronics.ru
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Serge Semin
     
  • commit a5c7682aaaa10e42928d73de1c9e1e02d2b14c2e upstream.

    If an active transfer is dequeued, then the endpoint is freed to start a
    new transfer. Make sure to clear the endpoint's transfer wait flag for
    this case.

    Fixes: e0d19563eb6c ("usb: dwc3: gadget: Wait for transfer completion")
    Cc: stable@vger.kernel.org
    Acked-by: Felipe Balbi
    Signed-off-by: Thinh Nguyen
    Link: https://lore.kernel.org/r/b81cd5b5281cfbfdadb002c4bcf5c9be7c017cfd.1609828485.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman

    Thinh Nguyen
     
  • commit a1383b3537a7bea1c213baa7878ccc4ecf4413b5 upstream.

    usb_gadget_deactivate/usb_gadget_activate does not execute the UDC start
    operation, which may leave EP0 disabled and event IRQs disabled when
    re-activating the function. Move the enabling/disabling of USB EP0 and
    device event IRQs to be performed in the pullup routine.

    Fixes: ae7e86108b12 ("usb: dwc3: Stop active transfers before halting the controller")
    Tested-by: Michael Tretter
    Cc: stable
    Reported-by: Michael Tretter
    Signed-off-by: Wesley Cheng
    Link: https://lore.kernel.org/r/1609282837-21666-1-git-send-email-wcheng@codeaurora.org
    Signed-off-by: Greg Kroah-Hartman

    Wesley Cheng
     
  • commit a5ada3dfe6a20f41f91448b9034a1ef8da3dc87d upstream.

    dwc3_meson_g12a_probe() does not invoke clk_bulk_disable_unprepare()
    on one error handling path. This patch fixes that.

    Fixes: 347052e3bf1b ("usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs")
    Reported-by: Hulk Robot
    Signed-off-by: Zheng Zengkai
    Cc: stable
    Reviewed-by: Martin Blumenstingl
    Link: https://lore.kernel.org/r/20201215025459.91794-1-zhengzengkai@huawei.com
    Signed-off-by: Greg Kroah-Hartman

    Zheng Zengkai
     
  • commit 0f041b8592daaaea46e91a8ebb3b47e6e0171fd8 upstream.

    Warm reboot scenarios some times type C Mux driver gets Mux configuration
    request as HPD=1,IRQ=1. In that scenario typeC Mux driver need to configure
    Mux as follows as per IOM requirement:
    (1). Confgiure Mux HPD = 1, IRQ = 0
    (2). Configure Mux with HPD = 1, IRQ = 1

    IOM expects TypeC Mux configuration as follows:
    (1). HPD=1, IRQ=0
    (2). HPD=1, IRQ=1
    if IOM gets mux config request (2) without configuring (1), it will ignore
    the request. The impact of this is there is no DP_alt mode display.

    Fixes: 43d596e32276 ("usb: typec: intel_pmc_mux: Check the port status before connect")
    Cc: stable@vger.kernel.org
    Reviewed-by: Heikki Krogerus
    Signed-off-by: Madhusudanarao Amara
    Link: https://lore.kernel.org/r/20201216140918.49197-1-madhusudanarao.amara@intel.com
    Signed-off-by: Greg Kroah-Hartman

    Madhusudanarao Amara
     
  • commit 5e5ff0b4b6bcb4d17b7a26ec8bcfc7dd4651684f upstream.

    syzbot is reporting UAF at usb_submit_urb() [1], for
    service_outstanding_interrupt() is not checking WDM_DISCONNECTING
    before calling usb_submit_urb(). Close the race by doing same checks
    wdm_read() does upon retry.

    Also, while wdm_read() checks WDM_DISCONNECTING with desc->rlock held,
    service_interrupt_work() does not hold desc->rlock. Thus, it is possible
    that usb_submit_urb() is called from service_outstanding_interrupt() from
    service_interrupt_work() after WDM_DISCONNECTING was set and kill_urbs()
    from wdm_disconnect() completed. Thus, move kill_urbs() in
    wdm_disconnect() to after cancel_work_sync() (which makes sure that
    service_interrupt_work() is no longer running) completed.

    Although it seems to be safe to dereference desc->intf->dev in
    service_outstanding_interrupt() even if WDM_DISCONNECTING was already set
    because desc->rlock or cancel_work_sync() prevents wdm_disconnect() from
    reaching list_del() before service_outstanding_interrupt() completes,
    let's not emit error message if WDM_DISCONNECTING is set by
    wdm_disconnect() while usb_submit_urb() is in progress.

    [1] https://syzkaller.appspot.com/bug?extid=9e04e2df4a32fb661daf

    Reported-by: syzbot
    Signed-off-by: Tetsuo Handa
    Cc: stable
    Link: https://lore.kernel.org/r/620e2ee0-b9a3-dbda-a25b-a93e0ed03ec5@i-love.sakura.ne.jp
    Signed-off-by: Greg Kroah-Hartman

    Tetsuo Handa
     
  • commit 0ffc76539e6e8d28114f95ac25c167c37b5191b3 upstream.

    This device is supported by the IR Toy driver.

    Reported-by: Georgi Bakalski
    Signed-off-by: Sean Young
    Acked-by: Oliver Neukum
    Cc: stable
    Link: https://lore.kernel.org/r/20201227134502.4548-2-sean@mess.org
    Signed-off-by: Greg Kroah-Hartman

    Sean Young
     
  • commit e2459108b5a0604c4b472cae2b3cb8d3444c77fb upstream.

    Enable Super speed plus in configfs to support USB3.1 Gen2.
    This ensures that when a USB gadget is plugged in, it is
    enumerated as Gen 2 and connected at 10 Gbps if the host and
    cable are capable of it.

    Many in-tree gadget functions (fs, midi, acm, ncm, mass_storage,
    etc.) already have SuperSpeed Plus support.

    Tested: plugged gadget into Linux host and saw:
    [284907.385986] usb 8-2: new SuperSpeedPlus Gen 2 USB device number 3 using xhci_hcd

    Tested-by: Lorenzo Colitti
    Acked-by: Felipe Balbi
    Signed-off-by: taehyun.cho
    Signed-off-by: Lorenzo Colitti
    Link: https://lore.kernel.org/r/20210106154625.2801030-1-lorenzo@google.com
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    taehyun.cho
     

12 Jan, 2021

6 commits

  • As we use bvalid for vbus wakeup source, to save power when
    suspend, turn off the vbus comparator for imx7d and imx8mm.

    Below is this bit description from RM of iMX8MM
    "VBUS Valid Comparator Enable:
    This signal controls the USB OTG PHY VBUS Valid comparator which
    indicates whether the voltage on the USB_OTG*_VBUS pin is below
    the VBUS Valid threshold. The VBUS Valid threshold is nominally
    4.75V on this USB PHY. The VBUS Valid threshold can be adjusted
    using the USBNC_OTGn_PHY_CFG1[OTGTUNE0] bit field. Status of the
    VBUS Valid comparator, when it is enabled, is reported on the
    USBNC_OTGn_PHY_STATUS[VBUS_VLD] bit.
    When OTGDISABLE0 (USBNC_USB_OTGx_PHY_CFG2[10])is set to 1'b0 and
    DRVVBUS0 is set to 1'b1, the Bandgap circuitry and VBUS Valid
    comparator are powered, even in Suspend or Sleep mode.
    DRVVBUS0 should be reset to 1'b0 when the internal VBUS Valid comparator
    is not required, to reduce quiescent current in Suspend or Sleep mode.
    - 0 The VBUS Valid comparator is disabled
    - 1 The VBUS Valid comparator is enabled"

    Reviewed-by: Peter Chen
    Signed-off-by: Li Jun
    (cherry picked from commit dc5f8b1958cf0b9a01813e65c8b8e084c6d1b208)

    Li Jun
     
  • Rremove one definition of MX7D_USB_OTG_PHY_CFG1.

    Reviewed-by: Peter Chen
    Signed-off-by: Li Jun

    Li Jun
     
  • For imx7ulp, the power of USB controller may be lost, add power_lost_check
    API for USB recovery.

    (This is a reworked cherry-pick patch of MLK-13638-5)

    Signed-off-by: Peter Chen
    Signed-off-by: Li Jun
    (cherry picked from commit 64a3e0c3eb5b884862459ce9ae003df35ef29405)
    (cherry picked from commit 5fab364d5ab4577e4b16e1efc53fe67dde4016a4)

    Peter Chen
     
  • Add power lost check implementation for i.MX7D.

    (This is a reworked cherry-pick patch of MLK-10510-3)

    Acked-by: Peter Chen
    Signed-off-by: Li Jun
    (cherry picked from commit 59102c3b9756923f1c8cdba8bcab7b8611685321)
    (cherry picked from commit cf5e629825d1cc97d32deddbf452424c704f97f0)

    Li Jun
     
  • i.MX6SX mega off can shutdown domain power supply if none of peripheral
    in this domain is registered as wakeup source, this patch adds usb controller
    imx specific re-init after resume from such power lost during system sleep.

    (This is a reworked cherry-pick patch of MLK-10102-1)

    Signed-off-by: Li Jun
    (cherry picked from commit cd37f9b7157322e28c1d336e42813d441eb1f778)
    Signed-off-by: Peter Chen
    (cherry picked from commit bd6e7339b6137fe4af490f6647e2cb6338cc88b5)

    Li Jun
     
  • As there maybe more APIs of usbmisc for suspend and resume, group
    them into imx_usbmisc_suspend/resume, no function change.

    (This is reworked cherry-pick patch of MLK-21900-1)

    Reviewed-by: Peter Chen
    Signed-off-by: Li Jun
    (cherry picked from commit 29f824ce614ac2c932eab6d97493ce350db74d50)

    Li Jun
     

09 Jan, 2021

1 commit

  • KASAN complains about the stack-out-of-bounds access as the following.
    The reason is that the const char* name of sw_desc was not initialized,
    which leaves the name is wild and bring in illegal access and KASAN err.
    The fix is to explicitly initialized const char* name = NULL of sw_desc.

    [ 5.930564] BUG: KASAN: stack-out-of-bounds in string_nocheck+0xd8/0x140
    [ 5.930594] Read of size 1 at addr ffff0000c0bef9f0 by task kworker/2:1/33

    [ 5.944526] CPU: 2 PID: 33 Comm: kworker/2:1 Not tainted 5.10.4-00832-g9b9f5dcc807a #212
    [ 5.944539] Hardware name: NXP i.MX8MPlus EVK board (DT)
    [ 5.944575] Workqueue: events deferred_probe_work_func
    [ 5.977344] Call trace:
    [ 5.979833] dump_backtrace+0x0/0x2b8
    [ 5.983535] show_stack+0x18/0x68
    [ 5.986885] dump_stack+0x100/0x168
    [ 5.990413] print_address_description.constprop.0+0x70/0x4e4
    [ 5.996193] kasan_report+0x134/0x200
    [ 5.999883] __asan_load1+0xa8/0xb8
    [ 6.003406] string_nocheck+0xd8/0x140
    [ 6.007183] string+0xe4/0xf0
    [ 6.010189] vsnprintf+0x238/0x990
    [ 6.013623] kvasprintf+0xb0/0x1b0
    [ 6.017055] kvasprintf_const+0xc8/0x178
    [ 6.021017] kobject_set_name_vargs+0x54/0xf0
    [ 6.025406] dev_set_name+0xa4/0xd8
    [ 6.028926] typec_switch_register+0x11c/0x1c8
    [ 6.033402] typec_switch_gpio_probe+0x13c/0x1d0
    [ 6.038055] platform_drv_probe+0x70/0xd0
    [ 6.042092] really_probe+0x148/0x518
    [ 6.045784] driver_probe_device+0x78/0xe8
    [ 6.049911] __device_attach_driver+0xcc/0xf8
    [ 6.054297] bus_for_each_drv+0xf0/0x160
    [ 6.058247] __device_attach+0x184/0x1f0
    [ 6.062200] device_initial_probe+0x14/0x20
    [ 6.066411] bus_probe_device+0xec/0x100
    [ 6.070362] deferred_probe_work_func+0xac/0xf0
    [ 6.074922] process_one_work+0x3e0/0x668
    [ 6.078961] worker_thread+0x3d0/0x670
    [ 6.082748] kthread+0x21c/0x228
    [ 6.086005] ret_from_fork+0x10/0x34

    [ 6.091109] The buggy address belongs to the page:
    [ 6.095931] page:(____ptrval____) refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x100bef
    [ 6.105356] flags: 0xbfffc0000000000()
    [ 6.109148] raw: 0bfffc0000000000 fffffe0002e2fbc8 fffffe0002e2fbc8 0000000000000000
    [ 6.116923] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
    [ 6.124689] page dumped because: kasan: bad access detected

    [ 6.131793] addr ffff0000c0bef9f0 is located in stack of task kworker/2:1/33 at offset 64 in frame:
    [ 6.140869] typec_switch_gpio_probe+0x0/0x1d0

    [ 6.146837] this frame has 1 object:
    [ 6.150435] [32, 64) 'sw_desc'

    [ 6.155101] Memory state around the buggy address:
    [ 6.159922] ffff0000c0bef880: f1 f1 f1 f1 00 00 00 00 f3 f3 f3 f3 00 00 00 00
    [ 6.167174] ffff0000c0bef900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [ 6.174424] >ffff0000c0bef980: 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 f3 f3
    [ 6.181665] ^
    [ 6.188567] ffff0000c0befa00: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [ 6.195817] ffff0000c0befa80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [ 6.203061] ==================================================================

    Signed-off-by: Jason Liu
    Reviewed-by: Jun Li

    Jason Liu
     

04 Jan, 2021

1 commit

  • This is the 5.10.4 stable release

    * tag 'v5.10.4': (717 commits)
    Linux 5.10.4
    x86/CPU/AMD: Save AMD NodeId as cpu_die_id
    drm/edid: fix objtool warning in drm_cvt_modes()
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    drivers/gpu/drm/imx/dcss/dcss-plane.c
    drivers/media/i2c/ov5640.c

    Jason Liu