Skip to content
Snippets Groups Projects
  1. Jan 24, 2023
    • Greg Kroah-Hartman's avatar
    • Hugh Dickins's avatar
      mm/khugepaged: fix collapse_pte_mapped_thp() to allow anon_vma · 29487eed
      Hugh Dickins authored
      commit ab0c3f12 upstream.
      
      uprobe_write_opcode() uses collapse_pte_mapped_thp() to restore huge pmd,
      when removing a breakpoint from hugepage text: vma->anon_vma is always set
      in that case, so undo the prohibition.  And MADV_COLLAPSE ought to be able
      to collapse some page tables in a vma which happens to have anon_vma set
      from CoWing elsewhere.
      
      Is anon_vma lock required?  Almost not: if any page other than expected
      subpage of the non-anon huge page is found in the page table, collapse is
      aborted without making any change.  However, it is possible that an anon
      page was CoWed from this extent in another mm or vma, in which case a
      concurrent lookup might look here: so keep it away while clearing pmd (but
      perhaps we shall go back to using pmd_lock() there in future).
      
      Note that collapse_pte_mapped_thp() is exceptional in freeing a page table
      without having cleared its ptes: I'm uneasy about that, and had thought
      pte_clear()ing appropriate; but exclusive i_mmap lock does fix the
      problem, and we would have to move the mmu_notification if clearing those
      ptes.
      
      What this fixes is not a dangerous instability.  But I suggest Cc stable
      because uprobes "healing" has regressed in that way, so this should follow
      8d3c106e into those stable releases where it was backported (and may
      want adjustment there - I'll supply backports as needed).
      
      Link: https://lkml.kernel.org/r/b740c9fb-edba-92ba-59fb-7a5592e5dfc@google.com
      
      
      Fixes: 8d3c106e ("mm/khugepaged: take the right locks for page table retraction")
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Yang Shi <shy828301@gmail.com>
      Cc: Zach O'Keefe <zokeefe@google.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: <stable@vger.kernel.org>    [5.4+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      29487eed
    • YingChi Long's avatar
      x86/fpu: Use _Alignof to avoid undefined behavior in TYPE_ALIGN · 7242fc8c
      YingChi Long authored
      commit 55228db2 upstream.
      
      WG14 N2350 specifies that it is an undefined behavior to have type
      definitions within offsetof", see
      
        https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
      
      
      
      This specification is also part of C23.
      
      Therefore, replace the TYPE_ALIGN macro with the _Alignof builtin to
      avoid undefined behavior. (_Alignof itself is C11 and the kernel is
      built with -gnu11).
      
      ISO C11 _Alignof is subtly different from the GNU C extension
      __alignof__. Latter is the preferred alignment and _Alignof the
      minimal alignment. For long long on x86 these are 8 and 4
      respectively.
      
      The macro TYPE_ALIGN's behavior matches _Alignof rather than
      __alignof__.
      
        [ bp: Massage commit message. ]
      
      Signed-off-by: default avatarYingChi Long <me@inclyc.cn>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Link: https://lore.kernel.org/r/20220925153151.2467884-1-me@inclyc.cn
      
      
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7242fc8c
    • Joshua Ashton's avatar
      drm/amd/display: Fix COLOR_SPACE_YCBCR2020_TYPE matrix · 2b1375fa
      Joshua Ashton authored
      
      commit 973a9c81 upstream.
      
      The YCC conversion matrix for RGB -> COLOR_SPACE_YCBCR2020_TYPE is
      missing the values for the fourth column of the matrix.
      
      The fourth column of the matrix is essentially just a value that is
      added given that the color is 3 components in size.
      These values are needed to bias the chroma from the [-1, 1] -> [0, 1]
      range.
      
      This fixes color being very green when using Gamescope HDR on HDMI
      output which prefers YCC 4:4:4.
      
      Fixes: 40df2f80 ("drm/amd/display: color space ycbcr709 support")
      Reviewed-by: default avatarMelissa Wen <mwen@igalia.com>
      Signed-off-by: default avatarJoshua Ashton <joshua@froggi.es>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b1375fa
    • hongao's avatar
      drm/amd/display: Fix set scaling doesn's work · 763a74e1
      hongao authored
      
      commit 040625ab upstream.
      
      [Why]
      Setting scaling does not correctly update CRTC state. As a result
      dc stream state's src (composition area) && dest (addressable area)
      was not calculated as expected. This causes set scaling doesn's work.
      
      [How]
      Correctly update CRTC state when setting scaling property.
      
      Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Tested-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarhongao <hongao@uniontech.com>
      Signed-off-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      763a74e1
    • Sasa Dragic's avatar
      drm/i915: re-disable RC6p on Sandy Bridge · 39e0844a
      Sasa Dragic authored
      
      commit 67b0b4ed upstream.
      
      RC6p on Sandy Bridge got re-enabled over time, causing visual glitches
      and GPU hangs.
      
      Disabled originally in commit 1c8ecf80 ("drm/i915: do not enable
      RC6p on Sandy Bridge").
      
      Signed-off-by: default avatarSasa Dragic <sasa.dragic@gmail.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221219172927.9603-2-sasa.dragic@gmail.com
      
      
      Fixes: fb6db0f5 ("drm/i915: Remove unsafe i915.enable_rc6")
      Fixes: 13c5a577 ("drm/i915/gt: Select the deepest available parking mode for rc6")
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      (cherry picked from commit 0c8a6e9e)
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39e0844a
    • Khazhismel Kumykov's avatar
      gsmi: fix null-deref in gsmi_get_variable · ffef7779
      Khazhismel Kumykov authored
      
      commit a769b05e upstream.
      
      We can get EFI variables without fetching the attribute, so we must
      allow for that in gsmi.
      
      commit 85974825 ("efi: pstore: Omit efivars caching EFI varstore
      access layer") added a new get_variable call with attr=NULL, which
      triggers panic in gsmi.
      
      Fixes: 74c5b31c ("driver: Google EFI SMI")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarKhazhismel Kumykov <khazhy@google.com>
      Link: https://lore.kernel.org/r/20230118010212.1268474-1-khazhy@google.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ffef7779
    • Tobias Schramm's avatar
      serial: atmel: fix incorrect baudrate setup · b4461af0
      Tobias Schramm authored
      
      commit 5bfdd3c6 upstream.
      
      Commit ba47f97a ("serial: core: remove baud_rates when serial console
      setup") changed uart_set_options to select the correct baudrate
      configuration based on the absolute error between requested baudrate and
      available standard baudrate settings.
      Prior to that commit the baudrate was selected based on which predefined
      standard baudrate did not exceed the requested baudrate.
      This change of selection logic was never reflected in the atmel serial
      driver. Thus the comment left in the atmel serial driver is no longer
      accurate.
      Additionally the manual rounding up described in that comment and applied
      via (quot - 1) requests an incorrect baudrate. Since uart_set_options uses
      tty_termios_encode_baud_rate to determine the appropriate baudrate flags
      this can cause baudrate selection to fail entirely because
      tty_termios_encode_baud_rate will only select a baudrate if relative error
      between requested and selected baudrate does not exceed +/-2%.
      Fix that by requesting actual, exact baudrate used by the serial.
      
      Fixes: ba47f97a ("serial: core: remove baud_rates when serial console setup")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarTobias Schramm <t.schramm@manjaro.org>
      Acked-by: default avatarRichard Genoud <richard.genoud@gmail.com>
      Link: https://lore.kernel.org/r/20230109072940.202936-1-t.schramm@manjaro.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b4461af0
    • Mohan Kumar's avatar
      dmaengine: tegra210-adma: fix global intr clear · 55f9aca2
      Mohan Kumar authored
      
      commit 9c7e355c upstream.
      
      The current global interrupt clear programming register offset
      was not correct. Fix the programming with right offset
      
      Fixes: ded1f3db ("dmaengine: tegra210-adma: prepare for supporting newer Tegra chips")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMohan Kumar <mkumard@nvidia.com>
      Link: https://lore.kernel.org/r/20230102064844.31306-1-mkumard@nvidia.com
      
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      55f9aca2
    • Ilpo Järvinen's avatar
      serial: pch_uart: Pass correct sg to dma_unmap_sg() · 5d993696
      Ilpo Järvinen authored
      
      commit e8914b52 upstream.
      
      A local variable sg is used to store scatterlist pointer in
      pch_dma_tx_complete(). The for loop doing Tx byte accounting before
      dma_unmap_sg() alters sg in its increment statement. Therefore, the
      pointer passed into dma_unmap_sg() won't match to the one given to
      dma_map_sg().
      
      To fix the problem, use priv->sg_tx_p directly in dma_unmap_sg()
      instead of the local variable.
      
      Fixes: da3564ee ("pch_uart: add multi-scatter processing")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Link: https://lore.kernel.org/r/20230103093435.4396-1-ilpo.jarvinen@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5d993696
    • Heiner Kallweit's avatar
      dt-bindings: phy: g12a-usb3-pcie-phy: fix compatible string documentation · 97697a25
      Heiner Kallweit authored
      
      commit e1811190 upstream.
      
      The compatible string in the driver doesn't have the meson prefix.
      Fix this in the documentation and rename the file accordingly.
      
      Fixes: 87a55485 ("dt-bindings: phy: meson-g12a-usb3-pcie-phy: convert to yaml")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Reviewed-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Link: https://lore.kernel.org/r/0a82be92-ce85-da34-9d6f-4b33034473e5@gmail.com
      
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      97697a25
    • Juhyung Park's avatar
      usb-storage: apply IGNORE_UAS only for HIKSEMI MD202 on RTL9210 · aa1b22da
      Juhyung Park authored
      commit dbd24ec1 upstream.
      
      The commit e00b488e ("usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS")
      blacklists UAS for all of RTL9210 enclosures.
      
      The RTL9210 controller was advertised with UAS since its release back in
      2019 and was shipped with a lot of enclosure products with different
      firmware combinations.
      
      Blacklist UAS only for HIKSEMI MD202.
      
      This should hopefully be replaced with more robust method than just
      comparing strings.  But with limited information [1] provided thus far
      (dmesg when the device is plugged in, which includes manufacturer and
      product, but no lsusb -v to compare against), this is the best we can do
      for now.
      
      [1] https://lore.kernel.org/all/20230109115550.71688-1-qkrwngud825@gmail.com
      
      
      
      Fixes: e00b488e ("usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS")
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Hongling Zeng <zenghongling@kylinos.cn>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJuhyung Park <qkrwngud825@gmail.com>
      Acked-by: default avatarOliver Neukum <oneukum@suse.com>
      Link: https://lore.kernel.org/r/20230117085154.123301-1-qkrwngud825@gmail.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa1b22da
    • Maciej Żenczykowski's avatar
      usb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate() · a21da7f7
      Maciej Żenczykowski authored
      commit c6ec9295 upstream.
      
      In Google internal bug 265639009 we've received an (as yet) unreproducible
      crash report from an aarch64 GKI 5.10.149-android13 running device.
      
      AFAICT the source code is at:
        https://android.googlesource.com/kernel/common/+/refs/tags/ASB-2022-12-05_13-5.10
      
      
      
      The call stack is:
        ncm_close() -> ncm_notify() -> ncm_do_notify()
      with the crash at:
        ncm_do_notify+0x98/0x270
      Code: 79000d0b b9000a6c f940012a f9400269 (b9405d4b)
      
      Which I believe disassembles to (I don't know ARM assembly, but it looks sane enough to me...):
      
        // halfword (16-bit) store presumably to event->wLength (at offset 6 of struct usb_cdc_notification)
        0B 0D 00 79    strh w11, [x8, #6]
      
        // word (32-bit) store presumably to req->Length (at offset 8 of struct usb_request)
        6C 0A 00 B9    str  w12, [x19, #8]
      
        // x10 (NULL) was read here from offset 0 of valid pointer x9
        // IMHO we're reading 'cdev->gadget' and getting NULL
        // gadget is indeed at offset 0 of struct usb_composite_dev
        2A 01 40 F9    ldr  x10, [x9]
      
        // loading req->buf pointer, which is at offset 0 of struct usb_request
        69 02 40 F9    ldr  x9, [x19]
      
        // x10 is null, crash, appears to be attempt to read cdev->gadget->max_speed
        4B 5D 40 B9    ldr  w11, [x10, #0x5c]
      
      which seems to line up with ncm_do_notify() case NCM_NOTIFY_SPEED code fragment:
      
        event->wLength = cpu_to_le16(8);
        req->length = NCM_STATUS_BYTECOUNT;
      
        /* SPEED_CHANGE data is up/down speeds in bits/sec */
        data = req->buf + sizeof *event;
        data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget));
      
      My analysis of registers and NULL ptr deref crash offset
        (Unable to handle kernel NULL pointer dereference at virtual address 000000000000005c)
      heavily suggests that the crash is due to 'cdev->gadget' being NULL when executing:
        data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget));
      which calls:
        ncm_bitrate(NULL)
      which then calls:
        gadget_is_superspeed(NULL)
      which reads
        ((struct usb_gadget *)NULL)->max_speed
      and hits a panic.
      
      AFAICT, if I'm counting right, the offset of max_speed is indeed 0x5C.
      (remember there's a GKI KABI reservation of 16 bytes in struct work_struct)
      
      It's not at all clear to me how this is all supposed to work...
      but returning 0 seems much better than panic-ing...
      
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Cc: Carlos Llamas <cmllamas@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20230117131839.1138208-1-maze@google.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a21da7f7
    • Dan Scally's avatar
      usb: gadget: g_webcam: Send color matching descriptor per frame · 83b0aac5
      Dan Scally authored
      
      commit e95765e9 upstream.
      
      Currently the color matching descriptor is only sent across the wire
      a single time, following the descriptors for each format and frame.
      According to the UVC 1.5 Specification 3.9.2.6 ("Color Matching
      Descriptors"):
      
      "Only one instance is allowed for a given format and if present,
      the Color Matching descriptor shall be placed following the Video
      and Still Image Frame descriptors for that format".
      
      Add another reference to the color matching descriptor after the
      yuyv frames so that it's correctly transmitted for that format
      too.
      
      Fixes: a9914127 ("USB gadget: Webcam device")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarDaniel Scally <dan.scally@ideasonboard.com>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>
      Link: https://lore.kernel.org/r/20221216160528.479094-1-dan.scally@ideasonboard.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      83b0aac5
    • Prashant Malani's avatar
      usb: typec: altmodes/displayport: Fix pin assignment calculation · 004fbb04
      Prashant Malani authored
      
      commit 9682b41e upstream.
      
      Commit c1e5c2f0 ("usb: typec: altmodes/displayport: correct pin
      assignment for UFP receptacles") fixed the pin assignment calculation
      to take into account whether the peripheral was a plug or a receptacle.
      
      But the "pin_assignments" sysfs logic was not updated. Address this by
      using the macros introduced in the aforementioned commit in the sysfs
      logic too.
      
      Fixes: c1e5c2f0 ("usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles")
      Cc: stable@vger.kernel.org
      Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: default avatarPrashant Malani <pmalani@chromium.org>
      Reviewed-by: default avatarBenson Leung <bleung@chromium.org>
      Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Link: https://lore.kernel.org/r/20230111020546.3384569-2-pmalani@chromium.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      004fbb04
    • Prashant Malani's avatar
      usb: typec: altmodes/displayport: Add pin assignment helper · a1478ef5
      Prashant Malani authored
      
      commit 582836e3 upstream.
      
      The code to extract a peripheral's currently supported Pin Assignments
      is repeated in a couple of locations. Factor it out into a separate
      function.
      
      This will also make it easier to add fixes (we only need to update 1
      location instead of 2).
      
      Fixes: c1e5c2f0 ("usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles")
      Cc: stable@vger.kernel.org
      Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: default avatarPrashant Malani <pmalani@chromium.org>
      Reviewed-by: default avatarBenson Leung <bleung@chromium.org>
      Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Link: https://lore.kernel.org/r/20230111020546.3384569-1-pmalani@chromium.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1478ef5
    • Alexander Stein's avatar
      usb: host: ehci-fsl: Fix module alias · 040e0d12
      Alexander Stein authored
      
      commit 5d3d01ae upstream.
      
      Commit ca07e1c1 ("drivers:usb:fsl:Make fsl ehci drv an independent
      driver module") changed DRV_NAME which was used for MODULE_ALIAS as well.
      Starting from this the module alias didn't match the platform device
      name created in fsl-mph-dr-of.c
      Change DRV_NAME to match the driver name for host mode in fsl-mph-dr-of.
      This is needed for module autoloading on ls1021a.
      
      Fixes: ca07e1c1 ("drivers:usb:fsl:Make fsl ehci drv an independent driver module")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
      Link: https://lore.kernel.org/r/20230120122714.3848784-1-alexander.stein@ew.tq-group.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      040e0d12
    • Michael Adler's avatar
      USB: serial: cp210x: add SCALANCE LPE-9000 device id · 8d5740ad
      Michael Adler authored
      
      commit 3f9e76e3 upstream.
      
      Add the USB serial console device ID for Siemens SCALANCE LPE-9000
      which have a USB port for their serial console.
      
      Signed-off-by: default avatarMichael Adler <michael.adler@siemens.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>
      8d5740ad
    • Alan Stern's avatar
      USB: gadgetfs: Fix race between mounting and unmounting · 9a39f462
      Alan Stern authored
      
      commit d18dcfe9 upstream.
      
      The syzbot fuzzer and Gerald Lee have identified a use-after-free bug
      in the gadgetfs driver, involving processes concurrently mounting and
      unmounting the gadgetfs filesystem.  In particular, gadgetfs_fill_super()
      can race with gadgetfs_kill_sb(), causing the latter to deallocate
      the_device while the former is using it.  The output from KASAN says,
      in part:
      
      BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
      BUG: KASAN: use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:176 [inline]
      BUG: KASAN: use-after-free in __refcount_sub_and_test include/linux/refcount.h:272 [inline]
      BUG: KASAN: use-after-free in __refcount_dec_and_test include/linux/refcount.h:315 [inline]
      BUG: KASAN: use-after-free in refcount_dec_and_test include/linux/refcount.h:333 [inline]
      BUG: KASAN: use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:159 [inline]
      BUG: KASAN: use-after-free in gadgetfs_kill_sb+0x33/0x100 drivers/usb/gadget/legacy/inode.c:2086
      Write of size 4 at addr ffff8880276d7840 by task syz-executor126/18689
      
      CPU: 0 PID: 18689 Comm: syz-executor126 Not tainted 6.1.0-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
      Call Trace:
       <TASK>
      ...
       atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:176 [inline]
       __refcount_sub_and_test include/linux/refcount.h:272 [inline]
       __refcount_dec_and_test include/linux/refcount.h:315 [inline]
       refcount_dec_and_test include/linux/refcount.h:333 [inline]
       put_dev drivers/usb/gadget/legacy/inode.c:159 [inline]
       gadgetfs_kill_sb+0x33/0x100 drivers/usb/gadget/legacy/inode.c:2086
       deactivate_locked_super+0xa7/0xf0 fs/super.c:332
       vfs_get_super fs/super.c:1190 [inline]
       get_tree_single+0xd0/0x160 fs/super.c:1207
       vfs_get_tree+0x88/0x270 fs/super.c:1531
       vfs_fsconfig_locked fs/fsopen.c:232 [inline]
      
      The simplest solution is to ensure that gadgetfs_fill_super() and
      gadgetfs_kill_sb() are serialized by making them both acquire a new
      mutex.
      
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: default avatar <syzbot+33d7ad66d65044b93f16@syzkaller.appspotmail.com>
      Reported-and-tested-by: default avatarGerald Lee <sundaywind2004@gmail.com>
      Link: https://lore.kernel.org/linux-usb/CAO3qeMVzXDP-JU6v1u5Ags6Q-bb35kg3=C6d04DjzA9ffa5x1g@mail.gmail.com/
      Fixes: e5d82a73 ("vfs: Convert gadgetfs to use the new mount API")
      CC: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/Y6XCPXBpn3tmjdCC@rowland.harvard.edu
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9a39f462
    • Enzo Matsumiya's avatar
      cifs: do not include page data when checking signature · 1bc1fdd7
      Enzo Matsumiya authored
      
      commit 30b2b219 upstream.
      
      On async reads, page data is allocated before sending.  When the
      response is received but it has no data to fill (e.g.
      STATUS_END_OF_FILE), __calc_signature() will still include the pages in
      its computation, leading to an invalid signature check.
      
      This patch fixes this by not setting the async read smb_rqst page data
      (zeroed by default) if its got_bytes is 0.
      
      This can be reproduced/verified with xfstests generic/465.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarEnzo Matsumiya <ematsumiya@suse.de>
      Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1bc1fdd7
    • Filipe Manana's avatar
      btrfs: fix race between quota rescan and disable leading to NULL pointer deref · 89ac597e
      Filipe Manana authored
      
      commit b7adbf9a upstream.
      
      If we have one task trying to start the quota rescan worker while another
      one is trying to disable quotas, we can end up hitting a race that results
      in the quota rescan worker doing a NULL pointer dereference. The steps for
      this are the following:
      
      1) Quotas are enabled;
      
      2) Task A calls the quota rescan ioctl and enters btrfs_qgroup_rescan().
         It calls qgroup_rescan_init() which returns 0 (success) and then joins a
         transaction and commits it;
      
      3) Task B calls the quota disable ioctl and enters btrfs_quota_disable().
         It clears the bit BTRFS_FS_QUOTA_ENABLED from fs_info->flags and calls
         btrfs_qgroup_wait_for_completion(), which returns immediately since the
         rescan worker is not yet running.
         Then it starts a transaction and locks fs_info->qgroup_ioctl_lock;
      
      4) Task A queues the rescan worker, by calling btrfs_queue_work();
      
      5) The rescan worker starts, and calls rescan_should_stop() at the start
         of its while loop, which results in 0 iterations of the loop, since
         the flag BTRFS_FS_QUOTA_ENABLED was cleared from fs_info->flags by
         task B at step 3);
      
      6) Task B sets fs_info->quota_root to NULL;
      
      7) The rescan worker tries to start a transaction and uses
         fs_info->quota_root as the root argument for btrfs_start_transaction().
         This results in a NULL pointer dereference down the call chain of
         btrfs_start_transaction(). The stack trace is something like the one
         reported in Link tag below:
      
         general protection fault, probably for non-canonical address 0xdffffc0000000041: 0000 [#1] PREEMPT SMP KASAN
         KASAN: null-ptr-deref in range [0x0000000000000208-0x000000000000020f]
         CPU: 1 PID: 34 Comm: kworker/u4:2 Not tainted 6.1.0-syzkaller-13872-gb6bb9676f216 #0
         Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
         Workqueue: btrfs-qgroup-rescan btrfs_work_helper
         RIP: 0010:start_transaction+0x48/0x10f0 fs/btrfs/transaction.c:564
         Code: 48 89 fb 48 (...)
         RSP: 0018:ffffc90000ab7ab0 EFLAGS: 00010206
         RAX: 0000000000000041 RBX: 0000000000000208 RCX: ffff88801779ba80
         RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
         RBP: dffffc0000000000 R08: 0000000000000001 R09: fffff52000156f5d
         R10: fffff52000156f5d R11: 1ffff92000156f5c R12: 0000000000000000
         R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000003
         FS:  0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
         CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
         CR2: 00007f2bea75b718 CR3: 000000001d0cc000 CR4: 00000000003506e0
         DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
         DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
         Call Trace:
          <TASK>
          btrfs_qgroup_rescan_worker+0x3bb/0x6a0 fs/btrfs/qgroup.c:3402
          btrfs_work_helper+0x312/0x850 fs/btrfs/async-thread.c:280
          process_one_work+0x877/0xdb0 kernel/workqueue.c:2289
          worker_thread+0xb14/0x1330 kernel/workqueue.c:2436
          kthread+0x266/0x300 kernel/kthread.c:376
          ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
          </TASK>
         Modules linked in:
      
      So fix this by having the rescan worker function not attempt to start a
      transaction if it didn't do any rescan work.
      
      Reported-by: default avatar <syzbot+96977faa68092ad382c4@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/linux-btrfs/000000000000e5454b05f065a803@google.com/
      
      
      Fixes: e804861b ("btrfs: fix deadlock between quota disable and qgroup rescan worker")
      CC: stable@vger.kernel.org # 5.4+
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89ac597e
    • Samuel Holland's avatar
      mmc: sunxi-mmc: Fix clock refcount imbalance during unbind · 61cad0c6
      Samuel Holland authored
      
      commit 85094197 upstream.
      
      If the controller is suspended by runtime PM, the clock is already
      disabled, so do not try to disable it again during removal. Use
      pm_runtime_disable() to flush any pending runtime PM transitions.
      
      Fixes: 9a8e1e8c ("mmc: sunxi: Add runtime_pm support")
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Acked-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20220810022509.43743-1-samuel@sholland.org
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      61cad0c6
    • Ian Abbott's avatar
      comedi: adv_pci1760: Fix PWM instruction handling · 4f96ae71
      Ian Abbott authored
      commit 2efb6edd upstream.
      
      (Actually, this is fixing the "Read the Current Status" command sent to
      the device's outgoing mailbox, but it is only currently used for the PWM
      instructions.)
      
      The PCI-1760 is operated mostly by sending commands to a set of Outgoing
      Mailbox registers, waiting for the command to complete, and reading the
      result from the Incoming Mailbox registers.  One of these commands is
      the "Read the Current Status" command.  The number of this command is
      0x07 (see the User's Manual for the PCI-1760 at
      <https://advdownload.advantech.com/productfile/Downloadfile2/1-11P6653/PCI-1760.pdf
      
      >.
      The `PCI1760_CMD_GET_STATUS` macro defined in the driver should expand
      to this command number 0x07, but unfortunately it currently expands to
      0x03.  (Command number 0x03 is not defined in the User's Manual.)
      Correct the definition of the `PCI1760_CMD_GET_STATUS` macro to fix it.
      
      This is used by all the PWM subdevice related instructions handled by
      `pci1760_pwm_insn_config()` which are probably all broken.  The effect
      of sending the undefined command number 0x03 is not known.
      
      Fixes: 14b93bb6 ("staging: comedi: adv_pci_dio: separate out PCI-1760 support")
      Cc: <stable@vger.kernel.org> # v4.5+
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Link: https://lore.kernel.org/r/20230103143754.17564-1-abbotti@mev.co.uk
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4f96ae71
    • Flavio Suligoi's avatar
      usb: core: hub: disable autosuspend for TI TUSB8041 · f11a6891
      Flavio Suligoi authored
      
      commit 7171b0e2 upstream.
      
      The Texas Instruments TUSB8041 has an autosuspend problem at high
      temperature.
      
      If there is not USB traffic, after a couple of ms, the device enters in
      autosuspend mode. In this condition the external clock stops working, to
      save energy. When the USB activity turns on, ther hub exits the
      autosuspend state, the clock starts running again and all works fine.
      
      At ambient temperature all works correctly, but at high temperature,
      when the USB activity turns on, the external clock doesn't restart and
      the hub disappears from the USB bus.
      
      Disabling the autosuspend mode for this hub solves the issue.
      
      Signed-off-by: default avatarFlavio Suligoi <f.suligoi@asem.it>
      Cc: stable <stable@kernel.org>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20221219124759.3207032-1-f.suligoi@asem.it
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f11a6891
    • Ola Jeppsson's avatar
      misc: fastrpc: Fix use-after-free race condition for maps · 556dfdb2
      Ola Jeppsson authored
      
      commit 96b328d1 upstream.
      
      It is possible that in between calling fastrpc_map_get() until
      map->fl->lock is taken in fastrpc_free_map(), another thread can call
      fastrpc_map_lookup() and get a reference to a map that is about to be
      deleted.
      
      Rewrite fastrpc_map_get() to only increase the reference count of a map
      if it's non-zero. Propagate this to callers so they can know if a map is
      about to be deleted.
      
      Fixes this warning:
      refcount_t: addition on 0; use-after-free.
      WARNING: CPU: 5 PID: 10100 at lib/refcount.c:25 refcount_warn_saturate
      ...
      Call trace:
       refcount_warn_saturate
       [fastrpc_map_get inlined]
       [fastrpc_map_lookup inlined]
       fastrpc_map_create
       fastrpc_internal_invoke
       fastrpc_device_ioctl
       __arm64_sys_ioctl
       invoke_syscall
      
      Fixes: c68cfb71 ("misc: fastrpc: Add support for context Invoke method")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarOla Jeppsson <ola@snap.com>
      Signed-off-by: default avatarAbel Vesa <abel.vesa@linaro.org>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20221124174941.418450-4-srinivas.kandagatla@linaro.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      556dfdb2
    • Abel Vesa's avatar
      misc: fastrpc: Don't remove map on creater_process and device_release · 4b5c44e9
      Abel Vesa authored
      
      commit 5bb96c8f upstream.
      
      Do not remove the map from the list on error path in
      fastrpc_init_create_process, instead call fastrpc_map_put, to avoid
      use-after-free. Do not remove it on fastrpc_device_release either,
      call fastrpc_map_put instead.
      
      The fastrpc_free_map is the only proper place to remove the map.
      This is called only after the reference count is 0.
      
      Fixes: b49f6d83 ("misc: fastrpc: Fix a possible double free")
      Cc: stable <stable@kernel.org>
      Co-developed-by: default avatarOla Jeppsson <ola@snap.com>
      Signed-off-by: default avatarOla Jeppsson <ola@snap.com>
      Signed-off-by: default avatarAbel Vesa <abel.vesa@linaro.org>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20221124174941.418450-3-srinivas.kandagatla@linaro.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4b5c44e9
    • Greg Kroah-Hartman's avatar
      USB: misc: iowarrior: fix up header size for USB_DEVICE_ID_CODEMERCS_IOW100 · 04eb41ec
      Greg Kroah-Hartman authored
      
      commit 14ff7460 upstream.
      
      The USB_DEVICE_ID_CODEMERCS_IOW100 header size was incorrect, it should
      be 12, not 13.
      
      Cc: stable <stable@kernel.org>
      Fixes: 17a82716 ("USB: iowarrior: fix up report size handling for some devices")
      Reported-by: default avatarChristoph Jung <jung@codemercs.com>
      Link: https://lore.kernel.org/r/20230120135330.3842518-1-gregkh@linuxfoundation.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      04eb41ec
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05CN modem · 7ebb3eca
      Duke Xin(辛安文) authored
      
      commit 71dfd381 upstream.
      
      The EM05CN modem has 2 USB configurations that are configurable via the AT
      command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with
      the following interfaces, respectively:
      
      "MBIM"  : AT + MBIM + DIAG + NMEA  + MODEM
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      
      The detailed description of the USB configuration for each mode as follows:
      
      MBIM Mode
      --------------
      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=2c7c ProdID=0312 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-CN
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 1 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0312 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-CN
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      7ebb3eca
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05CN (SG) modem · 32165699
      Duke Xin(辛安文) authored
      
      commit 1541dd00 upstream.
      
      The EM05CN (SG) modem has 2 USB configurations that are configurable via the AT
      command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with
      the following interfaces, respectively:
      
      "MBIM"  : AT + MBIM + DIAG + NMEA  + MODEM
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      
      The detailed description of the USB configuration for each mode as follows:
      
      MBIM Mode
      --------------
      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=2c7c ProdID=0310 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-CN
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 1 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0310 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-CN
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      32165699
    • Ali Mirghasemi's avatar
      USB: serial: option: add Quectel EC200U modem · 81affe3b
      Ali Mirghasemi authored
      
      commit d9bbb158 upstream.
      
      Add support for EC200U modem
      
      0x0901: EC200U - AT + AP + CP + NMEA + DIAG + MOS
      
      usb-device output:
      T: Bus=01 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
      D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
      P: Vendor=2c7c ProdID=0901 Rev= 3.18
      S: Manufacturer=Android
      S: Product=Android
      C:* #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=400mA
      A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
      E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=32ms
      I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=83(I) Atr=03(Int.) MxPS= 512 Ivl=4096ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 7 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=89(I) Atr=03(Int.) MxPS= 512 Ivl=4096ms
      I:* If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarAli Mirghasemi <ali.mirghasemi1376@gmail.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>
      81affe3b
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05-G (RS) modem · a7c19d94
      Duke Xin(辛安文) authored
      
      commit b72d1397 upstream.
      
      The EM05-G (RS) modem has 2 USB configurations that are configurable via
      the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate
      with the following interfaces, respectively:
      
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      "MBIM"  : MBIM + AT + DIAG + NMEA + Modem
      
      The detailed description of the USB configuration for each mode as follows:
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0314 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      MBIM Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0314 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      a7c19d94
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05-G (CS) modem · 5966eda5
      Duke Xin(辛安文) authored
      
      commit bb78654b upstream.
      
      The EM05-G (CS) modem has 2 USB configurations that are configurable via
      the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate
      with the following interfaces, respectively:
      
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      "MBIM"  : MBIM + AT + DIAG + NMEA + Modem
      
      The detailed description of the USB configuration for each mode as follows:
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=030C Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      MBIM Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=030C Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      5966eda5
    • Duke Xin(辛安文)'s avatar
      USB: serial: option: add Quectel EM05-G (GR) modem · eece7a6c
      Duke Xin(辛安文) authored
      
      commit 6c331f32 upstream.
      
      The EM05-G (GR) modem has 2 USB configurations that are configurable via
      the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate
      with the following interfaces, respectively:
      
      "RMNET" : AT + DIAG + NMEA + Modem + QMI
      "MBIM"  : MBIM + AT + DIAG + NMEA + Modem
      
      The detailed description of the USB configuration for each mode as follows:
      
      RMNET Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0313 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      MBIM Mode
      --------------
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0313 Rev= 3.18
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM05-G
      C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(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=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=00 Prot=00 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#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 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#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDuke Xin(辛安文) <duke_xinanwen@163.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>
      eece7a6c
    • Greg Kroah-Hartman's avatar
      prlimit: do_prlimit needs to have a speculation check · 96b02125
      Greg Kroah-Hartman authored
      
      commit 73979060 upstream.
      
      do_prlimit() adds the user-controlled resource value to a pointer that
      will subsequently be dereferenced.  In order to help prevent this
      codepath from being used as a spectre "gadget" a barrier needs to be
      added after checking the range.
      
      Reported-by: default avatarJordy Zomer <jordyzomer@google.com>
      Tested-by: default avatarJordy Zomer <jordyzomer@google.com>
      Suggested-by: default avatarLinus Torvalds <torvalds@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      96b02125
    • Mathias Nyman's avatar
      xhci: Detect lpm incapable xHC USB3 roothub ports from ACPI tables · afcb4e0a
      Mathias Nyman authored
      
      commit 74622f0a upstream.
      
      USB3 ports on xHC hosts may have retimers that cause too long
      exit latency to work with native USB3 U1/U2 link power management states.
      
      For now only use usb_acpi_port_lpm_incapable() to evaluate if port lpm
      should be disabled while setting up the USB3 roothub.
      
      Other ways to identify lpm incapable ports can be added here later if
      ACPI _DSM does not exist.
      
      Limit this to Intel hosts for now, this is to my knowledge only
      an Intel issue.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-8-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      afcb4e0a
    • Mathias Nyman's avatar
      usb: acpi: add helper to check port lpm capability using acpi _DSM · 84e2e577
      Mathias Nyman authored
      commit cd702d18 upstream.
      
      Add a helper to evaluate ACPI usb device specific method (_DSM) provided
      in case the USB3 port shouldn't enter U1 and U2 link states.
      
      This _DSM was added as port specific retimer configuration may lead to
      exit latencies growing beyond U1/U2 exit limits, and OS needs a way to
      find which ports can't support U1/U2 link power management states.
      
      This _DSM is also used by windows:
      Link: https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/usb-device-specific-method---dsm-
      
      
      
      Some patch issues found in testing resolved by Ron Lee
      
      Cc: stable@vger.kernel.org
      Tested-by: default avatarRon Lee <ron.lee@intel.com>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-7-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84e2e577
    • Mathias Nyman's avatar
      xhci: Add a flag to disable USB3 lpm on a xhci root port level. · 8a6e963b
      Mathias Nyman authored
      
      commit 0522b9a1 upstream.
      
      One USB3 roothub port may support link power management, while another
      root port on the same xHC can't due to different retimers used for
      the ports.
      
      This is the case with Intel Alder Lake, and possible future platforms
      where retimers used for USB4 ports cause too long exit latecy to
      enable native USB3 lpm U1 and U2 states.
      
      Add a flag in the xhci port structure to indicate if the port is
      lpm_incapable, and check it while calculating exit latency.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-6-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8a6e963b
    • Mathias Nyman's avatar
      xhci: Add update_hub_device override for PCI xHCI hosts · cf6e5d3c
      Mathias Nyman authored
      
      commit 23a3b8d5 upstream.
      
      Allow PCI hosts to check and tune roothub and port settings
      before the hub is up and running.
      
      This override is needed to turn off U1 and U2 LPM for some ports
      based on per port ACPI _DSM, _UPC, or possibly vendor specific mmio
      values for Intel xHC hosts.
      
      Usb core calls the host update_hub_device once it creates a hub.
      
      Entering U1 or U2 link power save state on ports with this limitation
      will cause link to fail, turning the usb device unusable in that setup.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-5-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cf6e5d3c
    • Mathias Nyman's avatar
      xhci: Fix null pointer dereference when host dies · 133b9023
      Mathias Nyman authored
      
      commit a2bc47c4 upstream.
      
      Make sure xhci_free_dev() and xhci_kill_endpoint_urbs() do not race
      and cause null pointer dereference when host suddenly dies.
      
      Usb core may call xhci_free_dev() which frees the xhci->devs[slot_id]
      virt device at the same time that xhci_kill_endpoint_urbs() tries to
      loop through all the device's endpoints, checking if there are any
      cancelled urbs left to give back.
      
      hold the xhci spinlock while freeing the virt device
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-4-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      133b9023
    • Jimmy Hu's avatar
      usb: xhci: Check endpoint is valid before dereferencing it · 9891e5c7
      Jimmy Hu authored
      
      commit e8fb5bc7 upstream.
      
      When the host controller is not responding, all URBs queued to all
      endpoints need to be killed. This can cause a kernel panic if we
      dereference an invalid endpoint.
      
      Fix this by using xhci_get_virt_ep() helper to find the endpoint and
      checking if the endpoint is valid before dereferencing it.
      
      [233311.853271] xhci-hcd xhci-hcd.1.auto: xHCI host controller not responding, assume dead
      [233311.853393] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000e8
      
      [233311.853964] pc : xhci_hc_died+0x10c/0x270
      [233311.853971] lr : xhci_hc_died+0x1ac/0x270
      
      [233311.854077] Call trace:
      [233311.854085]  xhci_hc_died+0x10c/0x270
      [233311.854093]  xhci_stop_endpoint_command_watchdog+0x100/0x1a4
      [233311.854105]  call_timer_fn+0x50/0x2d4
      [233311.854112]  expire_timers+0xac/0x2e4
      [233311.854118]  run_timer_softirq+0x300/0xabc
      [233311.854127]  __do_softirq+0x148/0x528
      [233311.854135]  irq_exit+0x194/0x1a8
      [233311.854143]  __handle_domain_irq+0x164/0x1d0
      [233311.854149]  gic_handle_irq.22273+0x10c/0x188
      [233311.854156]  el1_irq+0xfc/0x1a8
      [233311.854175]  lpm_cpuidle_enter+0x25c/0x418 [msm_pm]
      [233311.854185]  cpuidle_enter_state+0x1f0/0x764
      [233311.854194]  do_idle+0x594/0x6ac
      [233311.854201]  cpu_startup_entry+0x7c/0x80
      [233311.854209]  secondary_start_kernel+0x170/0x198
      
      Fixes: 50e8725e ("xhci: Refactor command watchdog and fix split string.")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJimmy Hu <hhhuuu@google.com>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Message-ID: <0fe978ed-8269-9774-1c40-f8a98c17e838@linux.intel.com>
      Link: https://lore.kernel.org/r/20230116142216.1141605-3-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9891e5c7
Loading