18 Mar, 2021

1 commit


25 Jan, 2021

2 commits


20 Jan, 2021

4 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
     
  • Changes in 5.10.9
    btrfs: reloc: fix wrong file extent type check to avoid false ENOENT
    btrfs: prevent NULL pointer dereference in extent_io_tree_panic
    ALSA: hda/realtek: fix right sounds and mute/micmute LEDs for HP machines
    ALSA: doc: Fix reference to mixart.rst
    ASoC: AMD Renoir - add DMI entry for Lenovo ThinkPad X395
    ASoC: dapm: remove widget from dirty list on free
    x86/hyperv: check cpu mask after interrupt has been disabled
    drm/amdgpu: add green_sardine device id (v2)
    drm/amdgpu: fix DRM_INFO flood if display core is not supported (bug 210921)
    Revert "drm/amd/display: Fixed Intermittent blue screen on OLED panel"
    drm/amdgpu: add new device id for Renior
    drm/i915: Allow the sysadmin to override security mitigations
    drm/i915/gt: Limit VFE threads based on GT
    drm/i915/backlight: fix CPU mode backlight takeover on LPT
    drm/bridge: sii902x: Refactor init code into separate function
    dt-bindings: display: sii902x: Add supply bindings
    drm/bridge: sii902x: Enable I/O and core VCC supplies if present
    tracing/kprobes: Do the notrace functions check without kprobes on ftrace
    tools/bootconfig: Add tracing_on support to helper scripts
    ext4: use IS_ERR instead of IS_ERR_OR_NULL and set inode null when IS_ERR
    ext4: fix wrong list_splice in ext4_fc_cleanup
    ext4: fix bug for rename with RENAME_WHITEOUT
    cifs: check pointer before freeing
    cifs: fix interrupted close commands
    riscv: Drop a duplicated PAGE_KERNEL_EXEC
    riscv: return -ENOSYS for syscall -1
    riscv: Fixup CONFIG_GENERIC_TIME_VSYSCALL
    riscv: Fix KASAN memory mapping.
    mips: fix Section mismatch in reference
    mips: lib: uncached: fix non-standard usage of variable 'sp'
    MIPS: boot: Fix unaligned access with CONFIG_MIPS_RAW_APPENDED_DTB
    MIPS: Fix malformed NT_FILE and NT_SIGINFO in 32bit coredumps
    MIPS: relocatable: fix possible boot hangup with KASLR enabled
    RDMA/ocrdma: Fix use after free in ocrdma_dealloc_ucontext_pd()
    ACPI: scan: Harden acpi_device_add() against device ID overflows
    xen/privcmd: allow fetching resource sizes
    compiler.h: Raise minimum version of GCC to 5.1 for arm64
    mm/vmalloc.c: fix potential memory leak
    mm/hugetlb: fix potential missing huge page size info
    mm/process_vm_access.c: include compat.h
    dm raid: fix discard limits for raid1
    dm snapshot: flush merged data before committing metadata
    dm integrity: fix flush with external metadata device
    dm integrity: fix the maximum number of arguments
    dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq
    dm crypt: do not wait for backlogged crypto request completion in softirq
    dm crypt: do not call bio_endio() from the dm-crypt tasklet
    dm crypt: defer decryption to a tasklet if interrupts disabled
    stmmac: intel: change all EHL/TGL to auto detect phy addr
    r8152: Add Lenovo Powered USB-C Travel Hub
    btrfs: tree-checker: check if chunk item end overflows
    ext4: don't leak old mountpoint samples
    io_uring: don't take files/mm for a dead task
    io_uring: drop mm and files after task_work_run
    ARC: build: remove non-existing bootpImage from KBUILD_IMAGE
    ARC: build: add uImage.lzma to the top-level target
    ARC: build: add boot_targets to PHONY
    ARC: build: move symlink creation to arch/arc/Makefile to avoid race
    ARM: omap2: pmic-cpcap: fix maximum voltage to be consistent with defaults on xt875
    ath11k: fix crash caused by NULL rx_channel
    netfilter: ipset: fixes possible oops in mtype_resize
    ath11k: qmi: try to allocate a big block of DMA memory first
    btrfs: fix async discard stall
    btrfs: merge critical sections of discard lock in workfn
    btrfs: fix transaction leak and crash after RO remount caused by qgroup rescan
    regulator: bd718x7: Add enable times
    ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram
    ARM: dts: ux500/golden: Set display max brightness
    habanalabs: adjust pci controller init to new firmware
    habanalabs/gaudi: retry loading TPC f/w on -EINTR
    habanalabs: register to pci shutdown callback
    staging: spmi: hisi-spmi-controller: Fix some error handling paths
    spi: altera: fix return value for altera_spi_txrx()
    habanalabs: Fix memleak in hl_device_reset
    hwmon: (pwm-fan) Ensure that calculation doesn't discard big period values
    lib/raid6: Let $(UNROLL) rules work with macOS userland
    kconfig: remove 'kvmconfig' and 'xenconfig' shorthands
    spi: fix the divide by 0 error when calculating xfer waiting time
    io_uring: drop file refs after task cancel
    bfq: Fix computation of shallow depth
    arch/arc: add copy_user_page() to to fix build error on ARC
    misdn: dsp: select CONFIG_BITREVERSE
    net: ethernet: fs_enet: Add missing MODULE_LICENSE
    selftests: fix the return value for UDP GRO test
    nvme-pci: mark Samsung PM1725a as IGNORE_DEV_SUBNQN
    nvme: avoid possible double fetch in handling CQE
    nvmet-rdma: Fix list_del corruption on queue establishment failure
    drm/amd/display: fix sysfs amdgpu_current_backlight_pwm NULL pointer issue
    drm/amdgpu: fix a GPU hang issue when remove device
    drm/amd/pm: fix the failure when change power profile for renoir
    drm/amdgpu: fix potential memory leak during navi12 deinitialization
    usb: typec: Fix copy paste error for NVIDIA alt-mode description
    iommu/vt-d: Fix lockdep splat in sva bind()/unbind()
    ACPI: scan: add stub acpi_create_platform_device() for !CONFIG_ACPI
    drm/msm: Call msm_init_vram before binding the gpu
    ARM: picoxcell: fix missing interrupt-parent properties
    poll: fix performance regression due to out-of-line __put_user()
    rcu-tasks: Move RCU-tasks initialization to before early_initcall()
    bpf: Simplify task_file_seq_get_next()
    bpf: Save correct stopping point in file seq iteration
    x86/sev-es: Fix SEV-ES OUT/IN immediate opcode vc handling
    cfg80211: select CONFIG_CRC32
    nvme-fc: avoid calling _nvme_fc_abort_outstanding_ios from interrupt context
    iommu/vt-d: Update domain geometry in iommu_ops.at(de)tach_dev
    net/mlx5e: CT: Use per flow counter when CT flow accounting is enabled
    net/mlx5: Fix passing zero to 'PTR_ERR'
    net/mlx5: E-Switch, fix changing vf VLANID
    blk-mq-debugfs: Add decode for BLK_MQ_F_TAG_HCTX_SHARED
    mm: fix clear_refs_write locking
    mm: don't play games with pinned pages in clear_page_refs
    mm: don't put pinned pages into the swap cache
    perf intel-pt: Fix 'CPU too large' error
    dump_common_audit_data(): fix racy accesses to ->d_name
    ASoC: meson: axg-tdm-interface: fix loopback
    ASoC: meson: axg-tdmin: fix axg skew offset
    ASoC: Intel: fix error code cnl_set_dsp_D0()
    nvmet-rdma: Fix NULL deref when setting pi_enable and traddr INADDR_ANY
    nvme: don't intialize hwmon for discovery controllers
    nvme-tcp: fix possible data corruption with bio merges
    nvme-tcp: Fix warning with CONFIG_DEBUG_PREEMPT
    NFS4: Fix use-after-free in trace_event_raw_event_nfs4_set_lock
    pNFS: We want return-on-close to complete when evicting the inode
    pNFS: Mark layout for return if return-on-close was not sent
    pNFS: Stricter ordering of layoutget and layoutreturn
    NFS: Adjust fs_context error logging
    NFS/pNFS: Don't call pnfs_free_bucket_lseg() before removing the request
    NFS/pNFS: Don't leak DS commits in pnfs_generic_retry_commit()
    NFS/pNFS: Fix a leak of the layout 'plh_outstanding' counter
    NFS: nfs_delegation_find_inode_server must first reference the superblock
    NFS: nfs_igrab_and_active must first reference the superblock
    scsi: ufs: Fix possible power drain during system suspend
    ext4: fix superblock checksum failure when setting password salt
    RDMA/restrack: Don't treat as an error allocation ID wrapping
    RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp
    bnxt_en: Improve stats context resource accounting with RDMA driver loaded.
    RDMA/mlx5: Fix wrong free of blue flame register on error
    IB/mlx5: Fix error unwinding when set_has_smi_cap fails
    umount(2): move the flag validity checks first
    dm zoned: select CONFIG_CRC32
    drm/i915/dsi: Use unconditional msleep for the panel_on_delay when there is no reset-deassert MIPI-sequence
    drm/i915/icl: Fix initing the DSI DSC power refcount during HW readout
    drm/i915/gt: Restore clear-residual mitigations for Ivybridge, Baytrail
    mm, slub: consider rest of partial list if acquire_slab() fails
    riscv: Trace irq on only interrupt is enabled
    iommu/vt-d: Fix unaligned addresses for intel_flush_svm_range_dev()
    net: sunrpc: interpret the return value of kstrtou32 correctly
    selftests: netfilter: Pass family parameter "-f" to conntrack tool
    dm: eliminate potential source of excessive kernel log noise
    ALSA: fireface: Fix integer overflow in transmit_midi_msg()
    ALSA: firewire-tascam: Fix integer overflow in midi_port_work()
    netfilter: conntrack: fix reading nf_conntrack_buckets
    netfilter: nf_nat: Fix memleak in nf_nat_init
    Linux 5.10.9

    Signed-off-by: Greg Kroah-Hartman
    Change-Id: I609e501511889081e03d2d18ee7e1be95406f396

    Greg Kroah-Hartman
     
  • [ 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
     

19 Jan, 2021

1 commit

  • This patch allows the administrator to configure the interface
    name of a function using u_ether (e.g., eem, ncm, rndis).

    Currently, all such interfaces, regardless of function type, are
    always called usb0, usb1, etc. This makes it very cumbersome to
    use more than one such type at a time, because userspace cannnot
    easily tell the interfaces apart and apply the right
    configuration to each one. Interface renaming in userspace based
    on driver doesn't help, because the interfaces all have the same
    driver. Without this patch, doing this require hacks/workarounds
    such as setting fixed MAC addresses on the functions, and then
    renaming by MAC address, or scraping configfs after each
    interface is created to find out what it is.

    Setting the interface name is done by writing to the same
    "ifname" configfs attribute that reports the interface name after
    the function is bound. The write must contain an interface
    pattern such as "usb%d" (which will cause the net core to pick
    the next available interface name starting with "usb").
    This patch does not allow writing an exact interface name (as
    opposed to a pattern) because if the interface already exists at
    bind time, the bind will fail and the whole gadget will fail to
    activate. This could be allowed in a future patch.

    For compatibility with current userspace, when reading an ifname
    that has not currently been set, the result is still "(unnamed
    net_device)". Once a write to ifname happens, then reading ifname
    will return whatever was last written.

    Tested by configuring an rndis function and an ncm function on
    the same gadget, and writing "rndis%d" to ifname on the rndis
    function and "ncm%d" to ifname on the ncm function. When the
    gadget was bound, the rndis interface was rndis0 and the ncm
    interface was ncm0.

    Signed-off-by: Lorenzo Colitti
    (cherry picked from commit 63d152149b2d0860ccf8c4e6596b6175b2b7ace6
    https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
    Link: https://lore.kernel.org/r/20210113234222.3272933-1-lorenzo@google.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Lorenzo Colitti
    Change-Id: I04deb6cc1d8a5b8ee82404940de2a79c06fbafe7
    Signed-off-by: Greg Kroah-Hartman

    Lorenzo Colitti
     

18 Jan, 2021

1 commit


13 Jan, 2021

31 commits

  • Changes in 5.10.7
    i40e: Fix Error I40E_AQ_RC_EINVAL when removing VFs
    iavf: fix double-release of rtnl_lock
    net/sched: sch_taprio: ensure to reset/destroy all child qdiscs
    net: mvpp2: Add TCAM entry to drop flow control pause frames
    net: mvpp2: prs: fix PPPoE with ipv6 packet parse
    net: systemport: set dev->max_mtu to UMAC_MAX_MTU_SIZE
    ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()
    ethernet: ucc_geth: set dev->max_mtu to 1518
    ionic: account for vlan tag len in rx buffer len
    atm: idt77252: call pci_disable_device() on error path
    net: mvpp2: Fix GoP port 3 Networking Complex Control configurations
    net: stmmac: dwmac-meson8b: ignore the second clock input
    ibmvnic: fix login buffer memory leak
    ibmvnic: continue fatal error reset after passive init
    net: ethernet: mvneta: Fix error handling in mvneta_probe
    qede: fix offload for IPIP tunnel packets
    virtio_net: Fix recursive call to cpus_read_lock()
    net/ncsi: Use real net-device for response handler
    net: ethernet: Fix memleak in ethoc_probe
    net-sysfs: take the rtnl lock when storing xps_cpus
    net-sysfs: take the rtnl lock when accessing xps_cpus_map and num_tc
    net-sysfs: take the rtnl lock when storing xps_rxqs
    net-sysfs: take the rtnl lock when accessing xps_rxqs_map and num_tc
    net: ethernet: ti: cpts: fix ethtool output when no ptp_clock registered
    tun: fix return value when the number of iovs exceeds MAX_SKB_FRAGS
    e1000e: Only run S0ix flows if shutdown succeeded
    e1000e: bump up timeout to wait when ME un-configures ULP mode
    Revert "e1000e: disable s0ix entry and exit flows for ME systems"
    e1000e: Export S0ix flags to ethtool
    bnxt_en: Check TQM rings for maximum supported value.
    net: mvpp2: fix pkt coalescing int-threshold configuration
    bnxt_en: Fix AER recovery.
    ipv4: Ignore ECN bits for fib lookups in fib_compute_spec_dst()
    net: sched: prevent invalid Scell_log shift count
    net: hns: fix return value check in __lb_other_process()
    erspan: fix version 1 check in gre_parse_header()
    net: hdlc_ppp: Fix issues when mod_timer is called while timer is running
    bareudp: set NETIF_F_LLTX flag
    bareudp: Fix use of incorrect min_headroom size
    vhost_net: fix ubuf refcount incorrectly when sendmsg fails
    r8169: work around power-saving bug on some chip versions
    net: dsa: lantiq_gswip: Enable GSWIP_MII_CFG_EN also for internal PHYs
    net: dsa: lantiq_gswip: Fix GSWIP_MII_CFG(p) register access
    CDC-NCM: remove "connected" log message
    ibmvnic: fix: NULL pointer dereference.
    net: usb: qmi_wwan: add Quectel EM160R-GL
    selftests: mlxsw: Set headroom size of correct port
    stmmac: intel: Add PCI IDs for TGL-H platform
    selftests/vm: fix building protection keys test
    block: add debugfs stanza for QUEUE_FLAG_NOWAIT
    workqueue: Kick a worker based on the actual activation of delayed works
    scsi: ufs: Fix wrong print message in dev_err()
    scsi: ufs-pci: Fix restore from S4 for Intel controllers
    scsi: ufs-pci: Ensure UFS device is in PowerDown mode for suspend-to-disk ->poweroff()
    scsi: ufs-pci: Fix recovery from hibernate exit errors for Intel controllers
    scsi: ufs-pci: Enable UFSHCD_CAP_RPM_AUTOSUSPEND for Intel controllers
    scsi: block: Introduce BLK_MQ_REQ_PM
    scsi: ide: Do not set the RQF_PREEMPT flag for sense requests
    scsi: ide: Mark power management requests with RQF_PM instead of RQF_PREEMPT
    scsi: scsi_transport_spi: Set RQF_PM for domain validation commands
    scsi: core: Only process PM requests if rpm_status != RPM_ACTIVE
    local64.h: make mandatory
    lib/genalloc: fix the overflow when size is too big
    depmod: handle the case of /sbin/depmod without /sbin in PATH
    scsi: ufs: Clear UAC for FFU and RPMB LUNs
    kbuild: don't hardcode depmod path
    Bluetooth: revert: hci_h5: close serdev device and free hu in h5_close
    scsi: block: Remove RQF_PREEMPT and BLK_MQ_REQ_PREEMPT
    scsi: block: Do not accept any requests while suspended
    crypto: ecdh - avoid buffer overflow in ecdh_set_secret()
    crypto: asym_tpm: correct zero out potential secrets
    powerpc: Handle .text.{hot,unlikely}.* in linker script
    Staging: comedi: Return -EFAULT if copy_to_user() fails
    staging: mt7621-dma: Fix a resource leak in an error handling path
    usb: gadget: enable super speed plus
    USB: cdc-acm: blacklist another IR Droid device
    USB: cdc-wdm: Fix use after free in service_outstanding_interrupt().
    usb: typec: intel_pmc_mux: Configure HPD first for HPD+IRQ request
    usb: dwc3: meson-g12a: disable clk on error handling path in probe
    usb: dwc3: gadget: Restart DWC3 gadget when enabling pullup
    usb: dwc3: gadget: Clear wait flag on dequeue
    usb: dwc3: ulpi: Use VStsDone to detect PHY regs access completion
    usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one
    usb: dwc3: ulpi: Fix USB2.0 HS/FS/LS PHY suspend regression
    usb: chipidea: ci_hdrc_imx: add missing put_device() call in usbmisc_get_init_data()
    USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set
    usb: usbip: vhci_hcd: protect shift size
    usb: uas: Add PNY USB Portable SSD to unusual_uas
    USB: serial: iuu_phoenix: fix DMA from stack
    USB: serial: option: add LongSung M5710 module support
    USB: serial: option: add Quectel EM160R-GL
    USB: yurex: fix control-URB timeout handling
    USB: usblp: fix DMA to stack
    ALSA: usb-audio: Fix UBSAN warnings for MIDI jacks
    usb: gadget: select CONFIG_CRC32
    USB: Gadget: dummy-hcd: Fix shift-out-of-bounds bug
    usb: gadget: f_uac2: reset wMaxPacketSize
    usb: gadget: function: printer: Fix a memory leak for interface descriptor
    usb: gadget: u_ether: Fix MTU size mismatch with RX packet size
    USB: gadget: legacy: fix return error code in acm_ms_bind()
    usb: gadget: Fix spinlock lockup on usb_function_deactivate
    usb: gadget: configfs: Preserve function ordering after bind failure
    usb: gadget: configfs: Fix use-after-free issue with udc_name
    USB: serial: keyspan_pda: remove unused variable
    hwmon: (amd_energy) fix allocation of hwmon_channel_info config
    mm: make wait_on_page_writeback() wait for multiple pending writebacks
    x86/mm: Fix leak of pmd ptlock
    KVM: x86/mmu: Use -1 to flag an undefined spte in get_mmio_spte()
    KVM: x86/mmu: Get root level from walkers when retrieving MMIO SPTE
    kvm: check tlbs_dirty directly
    KVM: x86/mmu: Ensure TDP MMU roots are freed after yield
    x86/resctrl: Use an IPI instead of task_work_add() to update PQR_ASSOC MSR
    x86/resctrl: Don't move a task to the same resource group
    blk-iocost: fix NULL iocg deref from racing against initialization
    ALSA: hda/via: Fix runtime PM for Clevo W35xSS
    ALSA: hda/conexant: add a new hda codec CX11970
    ALSA: hda/realtek - Fix speaker volume control on Lenovo C940
    ALSA: hda/realtek: Add mute LED quirk for more HP laptops
    ALSA: hda/realtek: Enable mute and micmute LED on HP EliteBook 850 G7
    ALSA: hda/realtek: Add two "Intel Reference board" SSID in the ALC256.
    iommu/vt-d: Move intel_iommu info from struct intel_svm to struct intel_svm_dev
    btrfs: qgroup: don't try to wait flushing if we're already holding a transaction
    btrfs: send: fix wrong file path when there is an inode with a pending rmdir
    Revert "device property: Keep secondary firmware node secondary by type"
    dmabuf: fix use-after-free of dmabuf's file->f_inode
    arm64: link with -z norelro for LLD or aarch64-elf
    drm/i915: clear the shadow batch
    drm/i915: clear the gpu reloc batch
    bcache: fix typo from SUUP to SUPP in features.h
    bcache: check unsupported feature sets for bcache register
    bcache: introduce BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE for large bucket
    net/mlx5e: Fix SWP offsets when vlan inserted by driver
    ARM: dts: OMAP3: disable AES on N950/N9
    netfilter: x_tables: Update remaining dereference to RCU
    netfilter: ipset: fix shift-out-of-bounds in htable_bits()
    netfilter: xt_RATEEST: reject non-null terminated string from userspace
    netfilter: nft_dynset: report EOPNOTSUPP on missing set feature
    dmaengine: idxd: off by one in cleanup code
    x86/mtrr: Correct the range check before performing MTRR type lookups
    KVM: x86: fix shift out of bounds reported by UBSAN
    xsk: Fix memory leak for failed bind
    rtlwifi: rise completion at the last step of firmware callback
    scsi: target: Fix XCOPY NAA identifier lookup
    Linux 5.10.7

    Signed-off-by: Greg Kroah-Hartman
    Change-Id: I1a7c195af35831fe362b027fe013c0c7e4dc20ea

    Greg Kroah-Hartman
     
  • UCSI already conveys the information about a port's connection
    status, whether it is operating in UFP or DFP mode, and whether the
    partner supports USB data or not. This information can be used to
    notify a dual-role controller to start up its host or peripheral
    mode accordingly. Add optional support for this by querying each
    port's fwnode to look for an associated USB role switch device.
    If present, call usb_role_switch_set() with the determined data
    role upon Connect Change or Connector Partner Change updates.

    Bug: 177215430
    (cherry picked from commit 89795852c9c46b9b0701f7376d30a1c5ab4d146c
    git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing)
    Change-Id: I83106abd1c5122d9ca89e5854e82aa988f5b528f
    Reviewed-by: Heikki Krogerus
    Signed-off-by: Mayank Rana
    Signed-off-by: Jack Pham
    Link: https://lore.kernel.org/r/20210111215520.18476-1-jackp@codeaurora.org
    Signed-off-by: Greg Kroah-Hartman

    Mayank Rana
     
  • During init, vbus_vsafe0v does not get updated till the first
    connect as a sink. This causes TCPM to be stuck in SRC_ATTACH_WAIT
    state while booting with a sink (For instance: a headset) connected.

    [ 1.429168] Start toggling
    [ 1.439907] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
    [ 1.445242] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
    [ 53.358528] CC1: 0 -> 0, CC2: 0 -> 2 [state TOGGLING, polarity 0, connected]
    [ 53.358564] state change TOGGLING -> SRC_ATTACH_WAIT [rev1 NONE_AMS]

    Fix this by updating vbus_vsafe0v based on vbus_present status
    on boot.

    Reviewed-by: Heikki Krogerus
    Signed-off-by: Badhri Jagan Sridharan
    Link: https://lore.kernel.org/r/20201211071911.2205197-1-badhri@google.com
    Signed-off-by: Greg Kroah-Hartman
    (cherry picked from commit 3db4c21c0f71f7a51ce5c50f0d4d3742c9ec4a65)
    Signed-off-by: Will McVicker
    Change-Id: I2760d68069088754546f462caa24d7c73f7a533f

    Badhri Jagan Sridharan
     
  • 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