Skip to content
  1. Sep 08, 2022
    • Greg Kroah-Hartman's avatar
      Linux 5.10.142 · 281e81a5
      Greg Kroah-Hartman authored
      
      
      Link: https://lore.kernel.org/r/20220906132816.936069583@linuxfoundation.org
      Tested-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Tested-by: default avatarPavel Machek (CIP) <pavel@denx.de>
      Tested-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
      Tested-by: default avatarRudi Heitbaum <rudi@heitbaum.com>
      Tested-by: default avatarSalvatore Bonaccorso <carnil@debian.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      v5.10.142
      281e81a5
    • Johan Hovold's avatar
      USB: serial: ch341: fix disabled rx timer on older devices · 2058aab4
      Johan Hovold authored
      commit 41ca302a
      
       upstream.
      
      At least one older CH341 appears to have the RX timer enable bit
      inverted so that setting it disables the RX timer and prevents the FIFO
      from emptying until it is full.
      
      Only set the RX timer enable bit for devices with version newer than
      0x27 (even though this probably affects all pre-0x30 devices).
      
      Reported-by: default avatarJonathan Woithe <jwoithe@just42.net>
      Tested-by: default avatarJonathan Woithe <jwoithe@just42.net>
      Link: https://lore.kernel.org/r/Ys1iPTfiZRWj2gXs@marvin.atrad.com.au
      Fixes: 4e46c410
      
       ("USB: serial: ch341: reinitialize chip on reconfiguration")
      Cc: stable@vger.kernel.org      # 4.10
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2058aab4
    • Johan Hovold's avatar
      USB: serial: ch341: fix lost character on LCR updates · 2a4c619a
      Johan Hovold authored
      commit 8e83622a
      
       upstream.
      
      Disable LCR updates for pre-0x30 devices which use a different (unknown)
      protocol for line control and where the current register write causes
      the next received character to be lost.
      
      Note that updating LCR using the INIT command has no effect on these
      devices either.
      
      Reported-by: default avatarJonathan Woithe <jwoithe@just42.net>
      Tested-by: default avatarJonathan Woithe <jwoithe@just42.net>
      Link: https://lore.kernel.org/r/Ys1iPTfiZRWj2gXs@marvin.atrad.com.au
      Fixes: 4e46c410 ("USB: serial: ch341: reinitialize chip on reconfiguration")
      Fixes: 55fa15b5
      
       ("USB: serial: ch341: fix baud rate and line-control handling")
      Cc: stable@vger.kernel.org      # 4.10
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      [ johan: adjust context to 5.15 ]
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2a4c619a
    • Johan Hovold's avatar
      usb: dwc3: disable USB core PHY management · 06a84bda
      Johan Hovold authored
      commit 6000b8d9 upstream.
      
      The dwc3 driver manages its PHYs itself so the USB core PHY management
      needs to be disabled.
      
      Use the struct xhci_plat_priv hack added by commits 46034a99 ("usb:
      host: xhci-plat: add platform data support") and f768e718 ("usb:
      host: xhci-plat: add priv quirk for skip PHY initialization") to
      propagate the setting for now.
      
      Fixes: 4e88d4c0 ("usb: add a flag to skip PHY initialization to struct usb_hcd")
      Fixes: 178a0bce
      
       ("usb: core: hcd: integrate the PHY wrapper into the HCD core")
      Tested-by: default avatarMatthias Kaehlcke <mka@chromium.org>
      Cc: stable <stable@kernel.org>
      Reviewed-by: default avatarMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Link: https://lore.kernel.org/r/20220825131836.19769-1-johan+linaro@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [ johan: adjust context to 5.15 ]
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      06a84bda
    • Johan Hovold's avatar
      usb: dwc3: qcom: fix use-after-free on runtime-PM wakeup · 451fa901
      Johan Hovold authored
      commit  a872ab30 upstream.
      
      The Qualcomm dwc3 runtime-PM implementation checks the xhci
      platform-device pointer in the wakeup-interrupt handler to determine
      whether the controller is in host mode and if so triggers a resume.
      
      After a role switch in OTG mode the xhci platform-device would have been
      freed and the next wakeup from runtime suspend would access the freed
      memory.
      
      Note that role switching is executed from a freezable workqueue, which
      guarantees that the pointer is stable during suspend.
      
      Also note that runtime PM has been broken since commit 2664deb0
      ("usb: dwc3: qcom: Honor wakeup enabled/disabled state"), which
      incidentally also prevents this issue from being triggered.
      
      Fixes: a4333c3a
      
       ("usb: dwc3: Add Qualcomm DWC3 glue driver")
      Cc: stable@vger.kernel.org      # 4.18
      Reviewed-by: default avatarMatthias Kaehlcke <mka@chromium.org>
      Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Link: https://lore.kernel.org/r/20220804151001.23612-5-johan+linaro@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [ johan: adjust context for 5.15 ]
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      451fa901
    • Johan Hovold's avatar
      usb: dwc3: fix PHY disable sequence · 8984ca41
      Johan Hovold authored
      commit d2ac7bef upstream.
      
      Generic PHYs must be powered-off before they can be tore down.
      
      Similarly, suspending legacy PHYs after having powered them off makes no
      sense.
      
      Fix the dwc3_core_exit() (e.g. called during suspend) and open-coded
      dwc3_probe() error-path sequences that got this wrong.
      
      Note that this makes dwc3_core_exit() match the dwc3_core_init() error
      path with respect to powering off the PHYs.
      
      Fixes: 03c1fd62 ("usb: dwc3: core: add phy cleanup for probe error handling")
      Fixes: c499ff71
      
       ("usb: dwc3: core: re-factor init and exit paths")
      Cc: stable@vger.kernel.org      # 4.8
      Reviewed-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Reviewed-by: default avatarMatthias Kaehlcke <mka@chromium.org>
      Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Link: https://lore.kernel.org/r/20220804151001.23612-2-johan+linaro@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [ johan: adjust context to 5.15 ]
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8984ca41
    • Adrian Hunter's avatar
      mmc: core: Fix UHS-I SD 1.8V workaround branch · cb271893
      Adrian Hunter authored
      commit 15c56208 upstream.
      
      When introduced, upon success, the 1.8V fixup workaround in
      mmc_sd_init_card() would branch to practically the end of the function, to
      a label named "done". Unfortunately, perhaps due to the label name, over
      time new code has been added that really should have come after "done" not
      before it. Let's fix the problem by moving the label to the correct place
      and rename it "cont".
      
      Fixes: 045d705d
      
       ("mmc: core: Enable the MMC host software queue for the SD card")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarSeunghui Lee <sh043.lee@samsung.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20220815073321.63382-2-adrian.hunter@intel.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      [Backport to 5.10]
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cb271893
    • Anand Jain's avatar
      btrfs: harden identification of a stale device · 7f73a9de
      Anand Jain authored
      commit 770c79fb
      
       upstream.
      
      Identifying and removing the stale device from the fs_uuids list is done
      by btrfs_free_stale_devices().  btrfs_free_stale_devices() in turn
      depends on device_path_matched() to check if the device appears in more
      than one btrfs_device structure.
      
      The matching of the device happens by its path, the device path. However,
      when device mapper is in use, the dm device paths are nothing but a link
      to the actual block device, which leads to the device_path_matched()
      failing to match.
      
      Fix this by matching the dev_t as provided by lookup_bdev() instead of
      plain string compare of the device paths.
      
      Reported-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7f73a9de
    • Diego Santa Cruz's avatar
      drm/i915/glk: ECS Liva Q2 needs GLK HDMI port timing quirk · 3c63a22d
      Diego Santa Cruz authored
      commit 919bef7a upstream.
      
      The quirk added in upstream commit 90c3e219
      
       ("drm/i915/glk: Add
      Quirk for GLK NUC HDMI port issues.") is also required on the ECS Liva
      Q2.
      
      Note: Would be nicer to figure out the extra delay required for the
      retimer without quirks, however don't know how to check for that.
      
      Cc: stable@vger.kernel.org
      Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1326
      Signed-off-by: default avatarDiego Santa Cruz <Diego.SantaCruz@spinetix.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220616124137.3184371-1-jani.nikula@intel.com
      (cherry picked from commit 08e9505f
      
      )
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c63a22d
    • Takashi Iwai's avatar
      ALSA: seq: Fix data-race at module auto-loading · 1079d095
      Takashi Iwai authored
      commit 3e7e04b7
      
       upstream.
      
      It's been reported that there is a possible data-race accessing to the
      global card_requested[] array at ALSA sequencer core, which is used
      for determining whether to call request_module() for the card or not.
      This data race itself is almost harmless, as it might end up with one
      extra request_module() call for the already loaded module at most.
      But it's still better to fix.
      
      This patch addresses the possible data race of card_requested[] and
      client_requested[] arrays by replacing them with bitmask.
      It's an atomic operation and can work without locks.
      
      Reported-by: default avatarAbhishek Shah <abhishek.shah@columbia.edu>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/CAEHB24_ay6YzARpA1zgCsE7=H9CSJJzux618E=Ka4h0YdKn=qA@mail.gmail.com
      Link: https://lore.kernel.org/r/20220823072717.1706-2-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1079d095
    • Takashi Iwai's avatar
      ALSA: seq: oss: Fix data-race for max_midi_devs access · f19a209f
      Takashi Iwai authored
      commit 22dec134
      
       upstream.
      
      ALSA OSS sequencer refers to a global variable max_midi_devs at
      creating a new port, storing it to its own field.  Meanwhile this
      variable may be changed by other sequencer events at
      snd_seq_oss_midi_check_exit_port() in parallel, which may cause a data
      race.
      
      OTOH, this data race itself is almost harmless, as the access to the
      MIDI device is done via get_mdev() and it's protected with a refcount,
      hence its presence is guaranteed.
      
      Though, it's sill better to address the data-race from the code sanity
      POV, and this patch adds the proper spinlock for the protection.
      
      Reported-by: default avatarAbhishek Shah <abhishek.shah@columbia.edu>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/CAEHB2493pZRXs863w58QWnUTtv3HHfg85aYhLn5HJHCwxqtHQg@mail.gmail.com
      Link: https://lore.kernel.org/r/20220823072717.1706-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f19a209f
    • Kacper Michajłow's avatar
      ALSA: hda/realtek: Add speaker AMP init for Samsung laptops with ALC298 · 7565c150
      Kacper Michajłow authored
      commit a2d57ebe
      
       upstream.
      
      Magic initialization sequence was extracted from Windows driver and
      cleaned up manually.
      
      Fixes internal speakers output.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=207423
      Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1851518
      Signed-off-by: default avatarKacper Michajłow <kasper93@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220827203328.30363-1-kasper93@gmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7565c150
    • Miquel Raynal's avatar
      net: mac802154: Fix a condition in the receive path · ab9f8903
      Miquel Raynal authored
      commit f0da4711 upstream.
      
      Upon reception, a packet must be categorized, either it's destination is
      the host, or it is another host. A packet with no destination addressing
      fields may be valid in two situations:
      - the packet has no source field: only ACKs are built like that, we
        consider the host as the destination.
      - the packet has a valid source field: it is directed to the PAN
        coordinator, as for know we don't have this information we consider we
        are not the PAN coordinator.
      
      There was likely a copy/paste error made during a previous cleanup
      because the if clause is now containing exactly the same condition as in
      the switch case, which can never be true. In the past the destination
      address was used in the switch and the source address was used in the
      if, which matches what the spec says.
      
      Cc: stable@vger.kernel.org
      Fixes: ae531b94
      
       ("ieee802154: use ieee802154_addr instead of *_sa variants")
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/r/20220826142954.254853-1-miquel.raynal@bootlin.com
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ab9f8903
    • Sebastian Andrzej Siewior's avatar
      net: Use u64_stats_fetch_begin_irq() for stats fetch. · d71a1c9f
      Sebastian Andrzej Siewior authored
      commit 278d3ba6
      
       upstream.
      
      On 32bit-UP u64_stats_fetch_begin() disables only preemption. If the
      reader is in preemptible context and the writer side
      (u64_stats_update_begin*()) runs in an interrupt context (IRQ or
      softirq) then the writer can update the stats during the read operation.
      This update remains undetected.
      
      Use u64_stats_fetch_begin_irq() to ensure the stats fetch on 32bit-UP
      are not interrupted by a writer. 32bit-SMP remains unaffected by this
      change.
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Catherine Sullivan <csully@google.com>
      Cc: David Awogbemila <awogbemila@google.com>
      Cc: Dimitris Michailidis <dmichail@fungible.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Hans Ulli Kroll <ulli.kroll@googlemail.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Jeroen de Borst <jeroendb@google.com>
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: Simon Horman <simon.horman@corigine.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-wireless@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: oss-drivers@corigine.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d71a1c9f
    • Nicolas Dichtel's avatar
      ip: fix triggering of 'icmp redirect' · 685f4e56
      Nicolas Dichtel authored
      commit eb55dc09 upstream.
      
      __mkroute_input() uses fib_validate_source() to trigger an icmp redirect.
      My understanding is that fib_validate_source() is used to know if the src
      address and the gateway address are on the same link. For that,
      fib_validate_source() returns 1 (same link) or 0 (not the same network).
      __mkroute_input() is the only user of these positive values, all other
      callers only look if the returned value is negative.
      
      Since the below patch, fib_validate_source() didn't return anymore 1 when
      both addresses are on the same network, because the route lookup returns
      RT_SCOPE_LINK instead of RT_SCOPE_HOST. But this is, in fact, right.
      Let's adapat the test to return 1 again when both addresses are on the same
      link.
      
      CC: stable@vger.kernel.org
      Fixes: 747c1430
      
       ("ip: fix dflt addr selection for connected nexthop")
      Reported-by: default avatarkernel test robot <yujie.liu@intel.com>
      Reported-by: default avatarHeng Qi <hengqi@linux.alibaba.com>
      Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20220829100121.3821-1-nicolas.dichtel@6wind.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      685f4e56
    • Siddh Raman Pant's avatar
      wifi: mac80211: Fix UAF in ieee80211_scan_rx() · 4abc8c07
      Siddh Raman Pant authored
      commit 60deb9f1
      
       upstream.
      
      ieee80211_scan_rx() tries to access scan_req->flags after a
      null check, but a UAF is observed when the scan is completed
      and __ieee80211_scan_completed() executes, which then calls
      cfg80211_scan_done() leading to the freeing of scan_req.
      
      Since scan_req is rcu_dereference()'d, prevent the racing in
      __ieee80211_scan_completed() by ensuring that from mac80211's
      POV it is no longer accessed from an RCU read critical section
      before we call cfg80211_scan_done().
      
      Cc: stable@vger.kernel.org
      Link: https://syzkaller.appspot.com/bug?extid=f9acff9bf08a845f225d
      Reported-by: default avatar <syzbot+f9acff9bf08a845f225d@syzkaller.appspotmail.com>
      Suggested-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarSiddh Raman Pant <code@siddh.me>
      Link: https://lore.kernel.org/r/20220819200340.34826-1-code@siddh.me
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4abc8c07
    • Siddh Raman Pant's avatar
      wifi: mac80211: Don't finalize CSA in IBSS mode if state is disconnected · dd649b49
      Siddh Raman Pant authored
      commit 15bc8966 upstream.
      
      When we are not connected to a channel, sending channel "switch"
      announcement doesn't make any sense.
      
      The BSS list is empty in that case. This causes the for loop in
      cfg80211_get_bss() to be bypassed, so the function returns NULL
      (check line 1424 of net/wireless/scan.c), causing the WARN_ON()
      in ieee80211_ibss_csa_beacon() to get triggered (check line 500
      of net/mac80211/ibss.c), which was consequently reported on the
      syzkaller dashboard.
      
      Thus, check if we have an existing connection before generating
      the CSA beacon in ieee80211_ibss_finish_csa().
      
      Cc: stable@vger.kernel.org
      Fixes: cd7760e6
      
       ("mac80211: add support for CSA in IBSS mode")
      Link: https://syzkaller.appspot.com/bug?id=05603ef4ae8926761b678d2939a3b2ad28ab9ca6
      Reported-by: default avatar <syzbot+b6c9fe29aefe68e4ad34@syzkaller.appspotmail.com>
      Signed-off-by: default avatarSiddh Raman Pant <code@siddh.me>
      Tested-by: default avatar <syzbot+b6c9fe29aefe68e4ad34@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/r/20220814151512.9985-1-code@siddh.me
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dd649b49
    • Isaac J. Manjarres's avatar
      driver core: Don't probe devices after bus_type.match() probe deferral · 742e222d
      Isaac J. Manjarres authored
      commit 25e9fbf0 upstream.
      
      Both __device_attach_driver() and __driver_attach() check the return
      code of the bus_type.match() function to see if the device needs to be
      added to the deferred probe list. After adding the device to the list,
      the logic attempts to bind the device to the driver anyway, as if the
      device had matched with the driver, which is not correct.
      
      If __device_attach_driver() detects that the device in question is not
      ready to match with a driver on the bus, then it doesn't make sense for
      the device to attempt to bind with the current driver or continue
      attempting to match with any of the other drivers on the bus. So, update
      the logic in __device_attach_driver() to reflect this.
      
      If __driver_attach() detects that a driver tried to match with a device
      that is not ready to match yet, then the driver should not attempt to bind
      with the device. However, the driver can still attempt to match and bind
      with other devices on the bus, as drivers can be bound to multiple
      devices. So, update the logic in __driver_attach() to reflect this.
      
      Fixes: 656b8035
      
       ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()")
      Cc: stable@vger.kernel.org
      Cc: Saravana Kannan <saravanak@google.com>
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarIsaac J. Manjarres <isaacmanjarres@google.com>
      Link: https://lore.kernel.org/r/20220817184026.3468620-1-isaacmanjarres@google.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      742e222d
    • Krishna Kurapati's avatar
      usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS · 6202637f
      Krishna Kurapati authored
      commit 9d4dc16e upstream.
      
      During cdrom emulation, the response to read_toc command must contain
      the cdrom address as the number of sectors (2048 byte sized blocks)
      represented either as an absolute value (when MSF bit is '0') or in
      terms of PMin/PSec/PFrame (when MSF bit is set to '1'). Incase of
      cdrom, the fsg_lun_open call sets the sector size to 2048 bytes.
      
      When MAC OS sends a read_toc request with MSF set to '1', the
      store_cdrom_address assumes that the address being provided is the
      LUN size represented in 512 byte sized blocks instead of 2048. It
      tries to modify the address further to convert it to 2048 byte sized
      blocks and store it in MSF format. This results in data transfer
      failures as the cdrom address being provided in the read_toc response
      is incorrect.
      
      Fixes: 3f565a36
      
       ("usb: gadget: storage: adapt logic block size to bound block devices")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarKrishna Kurapati <quic_kriskura@quicinc.com>
      Link: https://lore.kernel.org/r/1661570110-19127-1-git-send-email-quic_kriskura@quicinc.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6202637f
    • Alan Stern's avatar
      USB: core: Prevent nested device-reset calls · abe3cfb7
      Alan Stern authored
      commit 9c6d7788
      
       upstream.
      
      Automatic kernel fuzzing revealed a recursive locking violation in
      usb-storage:
      
      ============================================
      WARNING: possible recursive locking detected
      5.18.0 #3 Not tainted
      --------------------------------------------
      kworker/1:3/1205 is trying to acquire lock:
      ffff888018638db8 (&us_interface_key[i]){+.+.}-{3:3}, at:
      usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
      
      but task is already holding lock:
      ffff888018638db8 (&us_interface_key[i]){+.+.}-{3:3}, at:
      usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
      
      ...
      
      stack backtrace:
      CPU: 1 PID: 1205 Comm: kworker/1:3 Not tainted 5.18.0 #3
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
      1.13.0-1ubuntu1.1 04/01/2014
      Workqueue: usb_hub_wq hub_event
      Call Trace:
      <TASK>
      __dump_stack lib/dump_stack.c:88 [inline]
      dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
      print_deadlock_bug kernel/locking/lockdep.c:2988 [inline]
      check_deadlock kernel/locking/lockdep.c:3031 [inline]
      validate_chain kernel/locking/lockdep.c:3816 [inline]
      __lock_acquire.cold+0x152/0x3ca kernel/locking/lockdep.c:5053
      lock_acquire kernel/locking/lockdep.c:5665 [inline]
      lock_acquire+0x1ab/0x520 kernel/locking/lockdep.c:5630
      __mutex_lock_common kernel/locking/mutex.c:603 [inline]
      __mutex_lock+0x14f/0x1610 kernel/locking/mutex.c:747
      usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
      usb_reset_device+0x37d/0x9a0 drivers/usb/core/hub.c:6109
      r871xu_dev_remove+0x21a/0x270 drivers/staging/rtl8712/usb_intf.c:622
      usb_unbind_interface+0x1bd/0x890 drivers/usb/core/driver.c:458
      device_remove drivers/base/dd.c:545 [inline]
      device_remove+0x11f/0x170 drivers/base/dd.c:537
      __device_release_driver drivers/base/dd.c:1222 [inline]
      device_release_driver_internal+0x1a7/0x2f0 drivers/base/dd.c:1248
      usb_driver_release_interface+0x102/0x180 drivers/usb/core/driver.c:627
      usb_forced_unbind_intf+0x4d/0xa0 drivers/usb/core/driver.c:1118
      usb_reset_device+0x39b/0x9a0 drivers/usb/core/hub.c:6114
      
      This turned out not to be an error in usb-storage but rather a nested
      device reset attempt.  That is, as the rtl8712 driver was being
      unbound from a composite device in preparation for an unrelated USB
      reset (that driver does not have pre_reset or post_reset callbacks),
      its ->remove routine called usb_reset_device() -- thus nesting one
      reset call within another.
      
      Performing a reset as part of disconnect processing is a questionable
      practice at best.  However, the bug report points out that the USB
      core does not have any protection against nested resets.  Adding a
      reset_in_progress flag and testing it will prevent such errors in the
      future.
      
      Link: https://lore.kernel.org/all/CAB7eexKUpvX-JNiLzhXBDWgfg2T9e9_0Tw4HQ6keN==voRbP0g@mail.gmail.com/
      Cc: stable@vger.kernel.org
      Reported-and-tested-by: default avatarRondreis <linhaoguo86@gmail.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/YwkflDxvg0KWqyZK@rowland.harvard.edu
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      abe3cfb7
    • Josh Poimboeuf's avatar
      s390: fix nospec table alignments · b0d4993c
      Josh Poimboeuf authored
      commit c9305b6c upstream.
      
      Add proper alignment for .nospec_call_table and .nospec_return_table in
      vmlinux.
      
      [hca@linux.ibm.com]: The problem with the missing alignment of the nospec
      tables exist since a long time, however only since commit e6ed91fd
      ("s390/alternatives: remove padding generation code") and with
      CONFIG_RELOCATABLE=n the kernel may also crash at boot time.
      
      The above named commit reduced the size of struct alt_instr by one byte,
      so its new size is 11 bytes. Therefore depending on the number of cpu
      alternatives the size of the __alt_instructions array maybe odd, which
      again also causes that the addresses of the nospec tables will be odd.
      
      If the address of __nospec_call_start is odd and the kernel is compiled
      With CONFIG_RELOCATABLE=n the compiler may generate code that loads the
      address of __nospec_call_start with a 'larl' instruction.
      
      This will generate incorrect code since the 'larl' instruction only works
      with even addresses. In result the members of the nospec tables will be
      accessed with an off-by-one offset, which subsequently may lead to
      addressing exceptions within __nospec_revert().
      
      Fixes: f19fbd5e
      
       ("s390: introduce execute-trampolines for branches")
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Link: https://lore.kernel.org/r/8719bf1ce4a72ebdeb575200290094e9ce047bcc.1661557333.git.jpoimboe@kernel.org
      Cc: <stable@vger.kernel.org> # 4.16
      Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0d4993c
    • Gerald Schaefer's avatar
      s390/hugetlb: fix prepare_hugepage_range() check for 2 GB hugepages · 0361d50e
      Gerald Schaefer authored
      commit 7c8d42fd upstream.
      
      The alignment check in prepare_hugepage_range() is wrong for 2 GB
      hugepages, it only checks for 1 MB hugepage alignment.
      
      This can result in kernel crash in __unmap_hugepage_range() at the
      BUG_ON(start & ~huge_page_mask(h)) alignment check, for mappings
      created with MAP_FIXED at unaligned address.
      
      Fix this by correctly handling multiple hugepage sizes, similar to the
      generic version of prepare_hugepage_range().
      
      Fixes: d08de8e2
      
       ("s390/mm: add support for 2GB hugepages")
      Cc: <stable@vger.kernel.org> # 4.8+
      Acked-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0361d50e
    • Witold Lipieta's avatar
      usb-storage: Add ignore-residue quirk for NXP PN7462AU · b9097c5e
      Witold Lipieta authored
      commit 2aa48857
      
       upstream.
      
      This is USB mass storage primary boot loader for code download on
      NXP PN7462AU.
      
      Without the quirk it is impossible to write whole memory at once as
      device restarts during the write due to bogus residue values reported.
      
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarWitold Lipieta <witold.lipieta@thaumatec.com>
      Link: https://lore.kernel.org/r/20220809112911.462776-1-witold.lipieta@thaumatec.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b9097c5e
    • Thierry GUIBERT's avatar
      USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020) · 5f0d1179
      Thierry GUIBERT authored
      commit a10bc717
      
       upstream.
      
      Supports for ICOM F3400 and ICOM F4400 PMR radios in CDC-ACM driver
      enabling the AT serial port.
      The Vendor Id is 0x0C26
      The Product ID is 0x0020
      
      Output of lsusb :
      Bus 001 Device 009: ID 0c26:0020 Prolific Technology Inc. ICOM Radio
      Couldn't open device, some information will be missing
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            2 Communications
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        idVendor           0x0c26 Prolific Technology Inc.
        idProduct          0x0020
        bcdDevice            0.00
        iManufacturer           1 ICOM Inc.
        iProduct                2 ICOM Radio
        iSerial                 3 *obfuscated*
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength       0x0030
          bNumInterfaces          2
          bConfigurationValue     1
          iConfiguration          0
          bmAttributes         0xc0
            Self Powered
          MaxPower                0mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x83  EP 3 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval              12
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
      
      Signed-off-by: default avatarThierry GUIBERT <thierry.guibert@croix-rouge.fr>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20220819081702.84118-1-thierry.guibert@croix-rouge.fr
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f0d1179
    • Heiner Kallweit's avatar
      usb: dwc2: fix wrong order of phy_power_on and phy_init · d608c131
      Heiner Kallweit authored
      commit f9b995b4 upstream.
      
      Since 1599069a ("phy: core: Warn when phy_power_on is called before
      phy_init") the driver complains. In my case (Amlogic SoC) the warning
      is: phy phy-fe03e000.phy.2: phy_power_on was called before phy_init
      So change the order of the two calls. The same change has to be done
      to the order of phy_exit() and phy_power_off().
      
      Fixes: 09a75e85
      
       ("usb: dwc2: refactor common low-level hw code to platform.c")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Acked-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Link: https://lore.kernel.org/r/dfcc6b40-2274-4e86-e73c-5c5e6aa3e046@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d608c131
    • Pablo Sun's avatar
      usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles · 95791d51
      Pablo Sun authored
      commit c1e5c2f0 upstream.
      
      Fix incorrect pin assignment values when connecting to a monitor with
      Type-C receptacle instead of a plug.
      
      According to specification, an UFP_D receptacle's pin assignment
      should came from the UFP_D pin assignments field (bit 23:16), while
      an UFP_D plug's assignments are described in the DFP_D pin assignments
      (bit 15:8) during Mode Discovery.
      
      For example the LG 27 UL850-W is a monitor with Type-C receptacle.
      The monitor responds to MODE DISCOVERY command with following
      DisplayPort Capability flag:
      
              dp->alt->vdo=0x140045
      
      The existing logic only take cares of UPF_D plug case,
      and would take the bit 15:8 for this 0x140045 case.
      
      This results in an non-existing pin assignment 0x0 in
      dp_altmode_configure.
      
      To fix this problem a new set of macros are introduced
      to take plug/receptacle differences into consideration.
      
      Fixes: 0e3bb7d6
      
       ("usb: typec: Add driver for DisplayPort alternate mode")
      Cc: stable@vger.kernel.org
      Co-developed-by: default avatarPablo Sun <pablo.sun@mediatek.com>
      Co-developed-by: default avatarMacpaul Lin <macpaul.lin@mediatek.com>
      Reviewed-by: default avatarGuillaume Ranquet <granquet@baylibre.com>
      Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: default avatarPablo Sun <pablo.sun@mediatek.com>
      Signed-off-by: default avatarMacpaul Lin <macpaul.lin@mediatek.com>
      Link: https://lore.kernel.org/r/20220804034803.19486-1-macpaul.lin@mediatek.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      95791d51
    • Slark Xiao's avatar
      USB: serial: option: add support for Cinterion MV32-WA/WB RmNet mode · 89b01a88
      Slark Xiao authored
      commit 8ffe20d0
      
       upstream.
      
      We added PIDs for MV32-WA/WB MBIM mode before, now we need to add
      support for RmNet mode.
      
      Test evidence as below:
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=03 Dev#=  3 Spd=480 MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=1e2d ProdID=00f3 Rev=05.04
      S:  Manufacturer=Cinterion
      S:  Product=Cinterion PID 0x00F3 USB Mobile Broadband
      S:  SerialNumber=d7b4be8d
      C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=03 Dev#= 10 Spd=480 MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=1e2d ProdID=00f4 Rev=05.04
      S:  Manufacturer=Cinterion
      S:  Product=Cinterion PID 0x00F4 USB Mobile Broadband
      S:  SerialNumber=d095087d
      C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      Signed-off-by: default avatarSlark Xiao <slark_xiao@163.com>
      [ johan: sort entries ]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89b01a88
    • Yonglin Tan's avatar
      USB: serial: option: add Quectel EM060K modem · 7f1f1767
      Yonglin Tan authored
      commit f766f3ab
      
       upstream.
      
      Add usb product id entry for the Quectel EM060K module.
      
      "MBIM mode": DIAG + NMEA + AT + MODEM + MBIM + QDSS
      
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=030b Rev= 5.04
      S:  Manufacturer=Quectel
      S:  Product=EM060K-GL
      S:  SerialNumber=89fb57db
      C:* #Ifs= 7 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 8 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 8 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 9 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 9 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#=12 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarYonglin Tan <yonglin.tan@outlook.com>
      [ johan: mention QDSS port and sort entries ]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7f1f1767
    • Yan Xinyu's avatar
      USB: serial: option: add support for OPPO R11 diag port · efcc3e1e
      Yan Xinyu authored
      commit 8d5fc280
      
       upstream.
      
      Add support for OPPO R11 USB diag serial port to option driver. This
      phone uses Qualcomm Snapdragon 660 SoC.
      
      usb-devices output:
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 10 Spd=480 MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=22d9 ProdID=276c Rev=04.04
      S:  Manufacturer=OPPO
      S:  Product=SDM660-MTP _SN:09C6BCA7
      S:  SerialNumber=beb2c403
      C:  #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      I:  If#=0x1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      
      Signed-off-by: default avatarYan Xinyu <sdlyyxy@bupt.edu.cn>
      Link: https://lore.kernel.org/r/20220714102037.4113889-1-sdlyyxy@bupt.edu.cn
      Link: https://lore.kernel.org/r/Yt1WfSZk03Plpnan@hovoldconsulting.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      efcc3e1e
    • Johan Hovold's avatar
      USB: serial: cp210x: add Decagon UCA device id · e547c07c
      Johan Hovold authored
      commit ceb40384
      
       upstream.
      
      Add the device id for Decagon Devices USB Cable Adapter.
      
      Link: https://lore.kernel.org/r/trinity-819f9db2-d3e1-40e9-a669-9c245817c046-1661523546680@msvc-mesg-web108
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e547c07c
    • Mathias Nyman's avatar
      xhci: Add grace period after xHC start to prevent premature runtime suspend. · 5a603f4c
      Mathias Nyman authored
      commit 33e32158
      
       upstream.
      
      After xHC controller is started, either in probe or resume, it can take
      a while before any of the connected usb devices are visible to the roothub
      due to link training.
      
      It's possible xhci driver loads, sees no acivity and suspends the host
      before the USB device is visible.
      
      In one testcase with a hotplugged xHC controller the host finally detected
      the connected USB device and generated a wake 500ms after host initial
      start.
      
      If hosts didn't suspend the device duringe training it probablty wouldn't
      take up to 500ms to detect it, but looking at specs reveal USB3 link
      training has a couple long timeout values, such as 120ms
      RxDetectQuietTimeout, and 360ms PollingLFPSTimeout.
      
      So Add a 500ms grace period that keeps polling the roothub for 500ms after
      start, preventing runtime suspend until USB devices are detected.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20220825150840.132216-3-mathias.nyman@linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a603f4c
    • Alan Stern's avatar
      media: mceusb: Use new usb_control_msg_*() routines · 587f793c
      Alan Stern authored
      commit 608e58a0
      
       upstream.
      
      Automatic kernel fuzzing led to a WARN about invalid pipe direction in
      the mceusb driver:
      
      ------------[ cut here ]------------
      usb 6-1: BOGUS control dir, pipe 80000380 doesn't match bRequestType 40
      WARNING: CPU: 0 PID: 2465 at drivers/usb/core/urb.c:410
      usb_submit_urb+0x1326/0x1820 drivers/usb/core/urb.c:410
      Modules linked in:
      CPU: 0 PID: 2465 Comm: kworker/0:2 Not tainted 5.19.0-rc4-00208-g69cb6c6556ad #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
      1.13.0-1ubuntu1.1 04/01/2014
      Workqueue: usb_hub_wq hub_event
      RIP: 0010:usb_submit_urb+0x1326/0x1820 drivers/usb/core/urb.c:410
      Code: 7c 24 40 e8 ac 23 91 fd 48 8b 7c 24 40 e8 b2 70 1b ff 45 89 e8
      44 89 f1 4c 89 e2 48 89 c6 48 c7 c7 a0 30 a9 86 e8 48 07 11 02 <0f> 0b
      e9 1c f0 ff ff e8 7e 23 91 fd 0f b6 1d 63 22 83 05 31 ff 41
      RSP: 0018:ffffc900032becf0 EFLAGS: 00010282
      RAX: 0000000000000000 RBX: ffff8881100f3058 RCX: 0000000000000000
      RDX: ffffc90004961000 RSI: ffff888114c6d580 RDI: fffff52000657d90
      RBP: ffff888105ad90f0 R08: ffffffff812c3638 R09: 0000000000000000
      R10: 0000000000000005 R11: ffffed1023504ef1 R12: ffff888105ad9000
      R13: 0000000000000040 R14: 0000000080000380 R15: ffff88810ba96500
      FS: 0000000000000000(0000) GS:ffff88811a800000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007ffe810bda58 CR3: 000000010b720000 CR4: 0000000000350ef0
      Call Trace:
      <TASK>
      usb_start_wait_urb+0x101/0x4c0 drivers/usb/core/message.c:58
      usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
      usb_control_msg+0x31c/0x4a0 drivers/usb/core/message.c:153
      mceusb_gen1_init drivers/media/rc/mceusb.c:1431 [inline]
      mceusb_dev_probe+0x258e/0x33f0 drivers/media/rc/mceusb.c:1807
      
      The reason for the warning is clear enough; the driver sends an
      unusual read request on endpoint 0 but does not set the USB_DIR_IN bit
      in the bRequestType field.
      
      More importantly, the whole situation can be avoided and the driver
      simplified by converting it over to the relatively new
      usb_control_msg_recv() and usb_control_msg_send() routines.  That's
      what this fix does.
      
      Link: https://lore.kernel.org/all/CAB7eexLLApHJwZfMQ=X-PtRhw0BgO+5KcSMS05FNUYejJXqtSA@mail.gmail.com/
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Cc: stable@vger.kernel.org
      Reported-and-tested-by: default avatarRondreis <linhaoguo86@gmail.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/YwkfnBFCSEVC6XZu@rowland.harvard.edu
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      587f793c
    • Mika Westerberg's avatar
      thunderbolt: Use the actual buffer in tb_async_error() · 07fb6b10
      Mika Westerberg authored
      commit eb100b8f upstream.
      
      The received notification packet is held in pkg->buffer and not in pkg
      itself. Fix this by using the correct buffer.
      
      Fixes: 81a54b5e
      
       ("thunderbolt: Let the connection manager handle all notifications")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      07fb6b10
    • SeongJae Park's avatar
      xen-blkfront: Advertise feature-persistent as user requested · f210912d
      SeongJae Park authored
      commit 9f5e0fe5 upstream.
      
      The advertisement of the persistent grants feature (writing
      'feature-persistent' to xenbus) should mean not the decision for using
      the feature but only the availability of the feature.  However, commit
      74a85247 ("xen-blkfront: add a parameter for disabling of persistent
      grants") made a field of blkfront, which was a place for saving only the
      negotiation result, to be used for yet another purpose: caching of the
      'feature_persistent' parameter value.  As a result, the advertisement,
      which should follow only the parameter value, becomes inconsistent.
      
      This commit fixes the misuse of the semantic by making blkfront saves
      the parameter value in a separate place and advertises the support based
      on only the saved value.
      
      Fixes: 74a85247
      
       ("xen-blkfront: add a parameter for disabling of persistent grants")
      Cc: <stable@vger.kernel.org> # 5.10.x
      Suggested-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
      Tested-by: default avatarMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/20220831165824.94815-3-sj@kernel.org
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f210912d
    • SeongJae Park's avatar
      xen-blkback: Advertise feature-persistent as user requested · aa45c507
      SeongJae Park authored
      commit 06ba5d2e upstream.
      
      The advertisement of the persistent grants feature (writing
      'feature-persistent' to xenbus) should mean not the decision for using
      the feature but only the availability of the feature.  However, commit
      aac8a70d ("xen-blkback: add a parameter for disabling of persistent
      grants") made a field of blkback, which was a place for saving only the
      negotiation result, to be used for yet another purpose: caching of the
      'feature_persistent' parameter value.  As a result, the advertisement,
      which should follow only the parameter value, becomes inconsistent.
      
      This commit fixes the misuse of the semantic by making blkback saves the
      parameter value in a separate place and advertises the support based on
      only the saved value.
      
      Fixes: aac8a70d
      
       ("xen-blkback: add a parameter for disabling of persistent grants")
      Cc: <stable@vger.kernel.org> # 5.10.x
      Suggested-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
      Tested-by: default avatarMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/20220831165824.94815-2-sj@kernel.org
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa45c507
    • Steven Price's avatar
      mm: pagewalk: Fix race between unmap and page walker · 47a73e5e
      Steven Price authored
      [ Upstream commit 8782fb61 ]
      
      The mmap lock protects the page walker from changes to the page tables
      during the walk.  However a read lock is insufficient to protect those
      areas which don't have a VMA as munmap() detaches the VMAs before
      downgrading to a read lock and actually tearing down PTEs/page tables.
      
      For users of walk_page_range() the solution is to simply call pte_hole()
      immediately without checking the actual page tables when a VMA is not
      present. We now never call __walk_page_range() without a valid vma.
      
      For walk_page_range_novma() the locking requirements are tightened to
      require the mmap write lock to be taken, and then walking the pgd
      directly with 'no_vma' set.
      
      This in turn means that all page walkers either have a valid vma, or
      it's that special 'novma' case for page table debugging.  As a result,
      all the odd '(!walk->vma && !walk->no_vma)' tests can be removed.
      
      Fixes: dd2283f2
      
       ("mm: mmap: zap pages with read mmap_sem in munmap")
      Reported-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarSteven Price <steven.price@arm.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      47a73e5e
    • Dan Carpenter's avatar
      xen/grants: prevent integer overflow in gnttab_dma_alloc_pages() · 5d0d46e6
      Dan Carpenter authored
      [ Upstream commit e9ea0b30 ]
      
      The change from kcalloc() to kvmalloc() means that arg->nr_pages
      might now be large enough that the "args->nr_pages << PAGE_SHIFT" can
      result in an integer overflow.
      
      Fixes: b3f7931f
      
       ("xen/gntdev: switch from kcalloc() to kvcalloc()")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/YxDROJqu/RPvR0bi@kili
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5d0d46e6
    • Jim Mattson's avatar
      KVM: x86: Mask off unsupported and unknown bits of IA32_ARCH_CAPABILITIES · eb0c614c
      Jim Mattson authored
      [ Upstream commit 0204750b ]
      
      KVM should not claim to virtualize unknown IA32_ARCH_CAPABILITIES
      bits. When kvm_get_arch_capabilities() was originally written, there
      were only a few bits defined in this MSR, and KVM could virtualize all
      of them. However, over the years, several bits have been defined that
      KVM cannot just blindly pass through to the guest without additional
      work (such as virtualizing an MSR promised by the
      IA32_ARCH_CAPABILITES feature bit).
      
      Define a mask of supported IA32_ARCH_CAPABILITIES bits, and mask off
      any other bits that are set in the hardware MSR.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Fixes: 5b76a3cf
      
       ("KVM: VMX: Tell the nested hypervisor to skip L1D flush on vmentry")
      Signed-off-by: default avatarJim Mattson <jmattson@google.com>
      Reviewed-by: default avatarVipin Sharma <vipinsh@google.com>
      Reviewed-by: default avatarXiaoyao Li <xiaoyao.li@intel.com>
      Message-Id: <20220830174947.2182144-1-jmattson@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eb0c614c
    • Haibo Chen's avatar
      gpio: pca953x: Add mutex_lock for regcache sync in PM · 7efcbac5
      Haibo Chen authored
      [ Upstream commit 518e26f1 ]
      
      The regcache sync will set the cache_bypass = true, at that
      time, when there is regmap write operation, it will bypass
      the regmap cache, then the regcache sync will write back the
      value from cache to register, which is not as our expectation.
      
      Though regmap already use its internal lock to avoid such issue,
      but this driver force disable the regmap internal lock in its
      regmap config: disable_locking = true
      
      To avoid this issue, use the driver's own lock to do the protect
      in system PM.
      
      Fixes: b7657430
      
       ("gpio: pca953x: Restore registers after suspend/resume cycle")
      Signed-off-by: default avatarHaibo Chen <haibo.chen@nxp.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7efcbac5
    • Armin Wolf's avatar
      hwmon: (gpio-fan) Fix array out of bounds access · 517dba79
      Armin Wolf authored
      [ Upstream commit f233d2be ]
      
      The driver does not check if the cooling state passed to
      gpio_fan_set_cur_state() exceeds the maximum cooling state as
      stored in fan_data->num_speeds. Since the cooling state is later
      used as an array index in set_fan_speed(), an array out of bounds
      access can occur.
      This can be exploited by setting the state of the thermal cooling device
      to arbitrary values, causing for example a kernel oops when unavailable
      memory is accessed this way.
      
      Example kernel oops:
      [  807.987276] Unable to handle kernel paging request at virtual address ffffff80d0588064
      [  807.987369] Mem abort info:
      [  807.987398]   ESR = 0x96000005
      [  807.987428]   EC = 0x25: DABT (current EL), IL = 32 bits
      [  807.987477]   SET = 0, FnV = 0
      [  807.987507]   EA = 0, S1PTW = 0
      [  807.987536]   FSC = 0x05: level 1 translation fault
      [  807.987570] Data abort info:
      [  807.987763]   ISV = 0, ISS = 0x00000005
      [  807.987801]   CM = 0, WnR = 0
      [  807.987832] swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000001165000
      [  807.987872] [ffffff80d0588064] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
      [  807.987961] Internal error: Oops: 96000005 [#1] PREEMPT SMP
      [  807.987992] Modules linked in: cmac algif_hash aes_arm64 algif_skcipher af_alg bnep hci_uart btbcm bluetooth ecdh_generic ecc 8021q garp stp llc snd_soc_hdmi_codec brcmfmac vc4 brcmutil cec drm_kms_helper snd_soc_core cfg80211 snd_compress bcm2835_codec(C) snd_pcm_dmaengine syscopyarea bcm2835_isp(C) bcm2835_v4l2(C) sysfillrect v4l2_mem2mem bcm2835_mmal_vchiq(C) raspberrypi_hwmon sysimgblt videobuf2_dma_contig videobuf2_vmalloc fb_sys_fops videobuf2_memops rfkill videobuf2_v4l2 videobuf2_common i2c_bcm2835 snd_bcm2835(C) videodev snd_pcm snd_timer snd mc vc_sm_cma(C) gpio_fan uio_pdrv_genirq uio drm fuse drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
      [  807.988508] CPU: 0 PID: 1321 Comm: bash Tainted: G         C        5.15.56-v8+ #1575
      [  807.988548] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
      [  807.988574] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      [  807.988608] pc : set_fan_speed.part.5+0x34/0x80 [gpio_fan]
      [  807.988654] lr : gpio_fan_set_cur_state+0x34/0x50 [gpio_fan]
      [  807.988691] sp : ffffffc008cf3bd0
      [  807.988710] x29: ffffffc008cf3bd0 x28: ffffff80019edac0 x27: 0000000000000000
      [  807.988762] x26: 0000000000000000 x25: 0000000000000000 x24: ffffff800747c920
      [  807.988787] x23: 000000000000000a x22: ffffff800369f000 x21: 000000001999997c
      [  807.988854] x20: ffffff800369f2e8 x19: ffffff8002ae8080 x18: 0000000000000000
      [  807.988877] x17: 0000000000000000 x16: 0000000000000000 x15: 000000559e271b70
      [  807.988938] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
      [  807.988960] x11: 0000000000000000 x10: ffffffc008cf3c20 x9 : ffffffcfb60c741c
      [  807.989018] x8 : 000000000000000a x7 : 00000000ffffffc9 x6 : 0000000000000009
      [  807.989040] x5 : 000000000000002a x4 : 0000000000000000 x3 : ffffff800369f2e8
      [  807.989062] x2 : 000000000000e780 x1 : 0000000000000001 x0 : ffffff80d0588060
      [  807.989084] Call trace:
      [  807.989091]  set_fan_speed.part.5+0x34/0x80 [gpio_fan]
      [  807.989113]  gpio_fan_set_cur_state+0x34/0x50 [gpio_fan]
      [  807.989199]  cur_state_store+0x84/0xd0
      [  807.989221]  dev_attr_store+0x20/0x38
      [  807.989262]  sysfs_kf_write+0x4c/0x60
      [  807.989282]  kernfs_fop_write_iter+0x130/0x1c0
      [  807.989298]  new_sync_write+0x10c/0x190
      [  807.989315]  vfs_write+0x254/0x378
      [  807.989362]  ksys_write+0x70/0xf8
      [  807.989379]  __arm64_sys_write+0x24/0x30
      [  807.989424]  invoke_syscall+0x4c/0x110
      [  807.989442]  el0_svc_common.constprop.3+0xfc/0x120
      [  807.989458]  do_el0_svc+0x2c/0x90
      [  807.989473]  el0_svc+0x24/0x60
      [  807.989544]  el0t_64_sync_handler+0x90/0xb8
      [  807.989558]  el0t_64_sync+0x1a0/0x1a4
      [  807.989579] Code: b9403801 f9402800 7100003f 8b35cc00 (b9400416)
      [  807.989627] ---[ end trace 8ded4c918658445b ]---
      
      Fix this by checking the cooling state and return an error if it
      exceeds the maximum cooling state.
      
      Tested on a Raspberry Pi 3.
      
      Fixes: b5cf88e4
      
       ("(gpio-fan): Add thermal control hooks")
      Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
      Link: https://lore.kernel.org/r/20220830011101.178843-1-W_Armin@gmx.de
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      517dba79