óÐÉÓÏË ÉÚÍÅÎÅÎÉÊ × Linux 6.1.88

 
af_unix: Call manage_oob() for every skb in unix_stream_read_generic(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Wed Apr 10 10:10:15 2024 -0700

    af_unix: Call manage_oob() for every skb in unix_stream_read_generic().
    
    [ Upstream commit 283454c8a123072e5c386a5a2b5fc576aa455b6f ]
    
    When we call recv() for AF_UNIX socket, we first peek one skb and
    calls manage_oob() to check if the skb is sent with MSG_OOB.
    
    However, when we fetch the next (and the following) skb, manage_oob()
    is not called now, leading a wrong behaviour.
    
    Let's say a socket send()s "hello" with MSG_OOB and the peer tries
    to recv() 5 bytes with MSG_PEEK.  Here, we should get only "hell"
    without 'o', but actually not:
    
      >>> from socket import *
      >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)
      >>> c1.send(b'hello', MSG_OOB)
      5
      >>> c2.recv(5, MSG_PEEK)
      b'hello'
    
    The first skb fills 4 bytes, and the next skb is peeked but not
    properly checked by manage_oob().
    
    Let's move up the again label to call manage_oob() for evry skb.
    
    With this patch:
    
      >>> from socket import *
      >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)
      >>> c1.send(b'hello', MSG_OOB)
      5
      >>> c2.recv(5, MSG_PEEK)
      b'hell'
    
    Fixes: 314001f0bf92 ("af_unix: Add OOB support")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20240410171016.7621-2-kuniyu@amazon.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

af_unix: Don't peek OOB data without MSG_OOB. [+ + +]
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Wed Apr 10 10:10:16 2024 -0700

    af_unix: Don't peek OOB data without MSG_OOB.
    
    [ Upstream commit 22dd70eb2c3d754862964377a75abafd3167346b ]
    
    Currently, we can read OOB data without MSG_OOB by using MSG_PEEK
    when OOB data is sitting on the front row, which is apparently
    wrong.
    
      >>> from socket import *
      >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)
      >>> c1.send(b'a', MSG_OOB)
      1
      >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
      b'a'
    
    If manage_oob() is called when no data has been copied, we only
    check if the socket enables SO_OOBINLINE or MSG_PEEK is not used.
    Otherwise, the skb is returned as is.
    
    However, here we should return NULL if MSG_PEEK is set and no data
    has been copied.
    
    Also, in such a case, we should not jump to the redo label because
    we will be caught in the loop and hog the CPU until normal data
    comes in.
    
    Then, we need to handle skb == NULL case with the if-clause below
    the manage_oob() block.
    
    With this patch:
    
      >>> from socket import *
      >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)
      >>> c1.send(b'a', MSG_OOB)
      1
      >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      BlockingIOError: [Errno 11] Resource temporarily unavailable
    
    Fixes: 314001f0bf92 ("af_unix: Add OOB support")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20240410171016.7621-3-kuniyu@amazon.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: hda/realtek - Enable audio jacks of Haier Boyue G42 with ALC269VC [+ + +]
Author: Ai Chao <aichao@kylinos.cn>
Date:   Fri Apr 19 16:21:59 2024 +0800

    ALSA: hda/realtek - Enable audio jacks of Haier Boyue G42 with ALC269VC
    
    commit 7ee5faad0f8c3ad86c8cfc2f6aac91d2ba29790f upstream.
    
    The Haier Boyue G42 with ALC269VC cannot detect the MIC of headset,
    the line out and internal speaker until
    ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS quirk applied.
    
    Signed-off-by: Ai Chao <aichao@kylinos.cn>
    Cc: <stable@vger.kernel.org>
    Message-ID: <20240419082159.476879-1-aichao@kylinos.cn>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: scarlett2: Add correct product series name to messages [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Fri Sep 15 03:03:03 2023 +0930

    ALSA: scarlett2: Add correct product series name to messages
    
    [ Upstream commit 6e743781d62e28f5fa095e5f31f878819622c143 ]
    
    This driver was originally developed for the Focusrite Scarlett Gen 2
    series, but now also supports the Scarlett Gen 3 series, the
    Clarett 8Pre USB, and the Clarett+ 8Pre. The messages output by the
    driver on initialisation and error include the identifying text
    "Scarlett Gen 2/3", but this is no longer accurate, and writing
    "Scarlett Gen 2/3/Clarett USB/Clarett+" would be unwieldy.
    
    Add series_name field to the scarlett2_device_entry struct so that
    concise and accurate messages can be output.
    
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://lore.kernel.org/r/3774b9d35bf1fbdd6fdad9f3f4f97e9b82ac76bf.1694705811.git.g@b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Stable-dep-of: b61a3acada00 ("ALSA: scarlett2: Add Focusrite Clarett+ 2Pre and 4Pre support")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: scarlett2: Add Focusrite Clarett 2Pre and 4Pre USB support [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Sat Oct 7 22:03:04 2023 +1030

    ALSA: scarlett2: Add Focusrite Clarett 2Pre and 4Pre USB support
    
    [ Upstream commit 2b17b489e47a956c8e93c8f1bcabb0343c851d90 ]
    
    It has been confirmed that all devices in the Focusrite Clarett USB
    series work the same as the devices in the Clarett+ series. Add the
    missing PIDs to enable support for the Clarett 2Pre and 4Pre USB.
    
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://lore.kernel.org/r/ZSFB8EVTG1PK1eq/@m.b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: scarlett2: Add Focusrite Clarett+ 2Pre and 4Pre support [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Wed Sep 27 01:11:30 2023 +0930

    ALSA: scarlett2: Add Focusrite Clarett+ 2Pre and 4Pre support
    
    [ Upstream commit b61a3acada0031e7a4922d1340b4296ab95c260b ]
    
    The Focusrite Clarett+ series uses the same protocol as the Scarlett
    Gen 2 and Gen 3 series. This patch adds support for the Clarett+ 2Pre
    and Clarett+ 4Pre similarly to the existing 8Pre support by adding
    appropriate entries to the scarlett2 driver.
    
    The Clarett 2Pre USB and 4Pre USB presumably use the same protocol as
    well, so support for them can easily be added if someone can test.
    
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://lore.kernel.org/r/ZRL7qjC3tYQllT3H@m.b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: scarlett2: Add support for Clarett 8Pre USB [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Fri Sep 15 03:02:37 2023 +0930

    ALSA: scarlett2: Add support for Clarett 8Pre USB
    
    [ Upstream commit b9a98cdd3ac7b80d8ea0f6acd81c88ad3d8bcb4a ]
    
    The Clarett 8Pre USB works the same as the Clarett+ 8Pre, only the USB
    ID is different.
    
    Tested-by: Philippe Perrot <philippe@perrot-net.fr>
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://lore.kernel.org/r/e59f47b29e2037f031b56bde10474c6e96e31ba5.1694705811.git.g@b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: scarlett2: Default mixer driver to enabled [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Fri Sep 15 03:01:57 2023 +0930

    ALSA: scarlett2: Default mixer driver to enabled
    
    [ Upstream commit bc83058f598757a908b30f8f536338cb1478ab5b ]
    
    Early versions of this mixer driver did not work on all hardware, so
    out of caution the driver was disabled by default and had to be
    explicitly enabled with device_setup=1.
    
    Since commit 764fa6e686e0 ("ALSA: usb-audio: scarlett2: Fix device
    hang with ehci-pci") no more problems of this nature have been
    reported. Therefore, enable the driver by default but provide a new
    device_setup option to disable the driver in case that is needed.
    
    - device_setup value of 0 now means "enable" rather than "disable".
    - device_setup value of 1 is now ignored.
    - device_setup value of 4 now means "disable".
    
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://lore.kernel.org/r/89600a35b40307f2766578ad1ca2f21801286b58.1694705811.git.g@b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Stable-dep-of: b61a3acada00 ("ALSA: scarlett2: Add Focusrite Clarett+ 2Pre and 4Pre support")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: scarlett2: Move USB IDs out from device_info struct [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Fri Sep 15 03:02:16 2023 +0930

    ALSA: scarlett2: Move USB IDs out from device_info struct
    
    [ Upstream commit d98cc489029dba4d99714c2e8ec4f5ba249f6851 ]
    
    By moving the USB IDs from the device_info struct into
    scarlett2_devices[], that will allow for devices with different
    USB IDs to share the same device_info.
    
    Tested-by: Philippe Perrot <philippe@perrot-net.fr>
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://lore.kernel.org/r/8263368e8d49e6fcebc709817bd82ab79b404468.1694705811.git.g@b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Stable-dep-of: b9a98cdd3ac7 ("ALSA: scarlett2: Add support for Clarett 8Pre USB")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: scarlett2: Rename scarlett_gen2 to scarlett2 [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Fri Oct 27 04:31:28 2023 +1030

    ALSA: scarlett2: Rename scarlett_gen2 to scarlett2
    
    [ Upstream commit efc3d7d20361cc59325a9f0525e079333b4459c0 ]
    
    This driver was originally developed for the Focusrite Scarlett Gen 2
    series. Since then Focusrite have used a similar protocol for their
    Gen 3, Gen 4, Clarett USB, Clarett+, and Vocaster series.
    
    Let's call this common protocol the "Scarlett 2 Protocol" and rename
    the driver to scarlett2 to not imply that it is restricted to Gen 2
    series devices.
    
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://lore.kernel.org/r/e1ad7f69a1e20cdb39094164504389160c1a0a0b.1698342632.git.g@b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arm64: hibernate: Fix level3 translation fault in swsusp_save() [+ + +]
Author: Yaxiong Tian <tianyaxiong@kylinos.cn>
Date:   Wed Apr 17 10:52:48 2024 +0800

    arm64: hibernate: Fix level3 translation fault in swsusp_save()
    
    commit 50449ca66cc5a8cbc64749cf4b9f3d3fc5f4b457 upstream.
    
    On arm64 machines, swsusp_save() faults if it attempts to access
    MEMBLOCK_NOMAP memory ranges. This can be reproduced in QEMU using UEFI
    when booting with rodata=off debug_pagealloc=off and CONFIG_KFENCE=n:
    
      Unable to handle kernel paging request at virtual address ffffff8000000000
      Mem abort info:
        ESR = 0x0000000096000007
        EC = 0x25: DABT (current EL), IL = 32 bits
        SET = 0, FnV = 0
        EA = 0, S1PTW = 0
        FSC = 0x07: level 3 translation fault
      Data abort info:
        ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
        CM = 0, WnR = 0, TnD = 0, TagAccess = 0
        GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
      swapper pgtable: 4k pages, 39-bit VAs, pgdp=00000000eeb0b000
      [ffffff8000000000] pgd=180000217fff9803, p4d=180000217fff9803, pud=180000217fff9803, pmd=180000217fff8803, pte=0000000000000000
      Internal error: Oops: 0000000096000007 [#1] SMP
      Internal error: Oops: 0000000096000007 [#1] SMP
      Modules linked in: xt_multiport ipt_REJECT nf_reject_ipv4 xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c iptable_filter bpfilter rfkill at803x snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg dwmac_generic stmmac_platform snd_hda_codec stmmac joydev pcs_xpcs snd_hda_core phylink ppdev lp parport ramoops reed_solomon ip_tables x_tables nls_iso8859_1 vfat multipath linear amdgpu amdxcp drm_exec gpu_sched drm_buddy hid_generic usbhid hid radeon video drm_suballoc_helper drm_ttm_helper ttm i2c_algo_bit drm_display_helper cec drm_kms_helper drm
      CPU: 0 PID: 3663 Comm: systemd-sleep Not tainted 6.6.2+ #76
      Source Version: 4e22ed63a0a48e7a7cff9b98b7806d8d4add7dc0
      Hardware name: Greatwall GW-XXXXXX-XXX/GW-XXXXXX-XXX, BIOS KunLun BIOS V4.0 01/19/2021
      pstate: 600003c5 (nZCv DAIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : swsusp_save+0x280/0x538
      lr : swsusp_save+0x280/0x538
      sp : ffffffa034a3fa40
      x29: ffffffa034a3fa40 x28: ffffff8000001000 x27: 0000000000000000
      x26: ffffff8001400000 x25: ffffffc08113e248 x24: 0000000000000000
      x23: 0000000000080000 x22: ffffffc08113e280 x21: 00000000000c69f2
      x20: ffffff8000000000 x19: ffffffc081ae2500 x18: 0000000000000000
      x17: 6666662074736420 x16: 3030303030303030 x15: 3038666666666666
      x14: 0000000000000b69 x13: ffffff9f89088530 x12: 00000000ffffffea
      x11: 00000000ffff7fff x10: 00000000ffff7fff x9 : ffffffc08193f0d0
      x8 : 00000000000bffe8 x7 : c0000000ffff7fff x6 : 0000000000000001
      x5 : ffffffa0fff09dc8 x4 : 0000000000000000 x3 : 0000000000000027
      x2 : 0000000000000000 x1 : 0000000000000000 x0 : 000000000000004e
      Call trace:
       swsusp_save+0x280/0x538
       swsusp_arch_suspend+0x148/0x190
       hibernation_snapshot+0x240/0x39c
       hibernate+0xc4/0x378
       state_store+0xf0/0x10c
       kobj_attr_store+0x14/0x24
    
    The reason is swsusp_save() -> copy_data_pages() -> page_is_saveable()
    -> kernel_page_present() assuming that a page is always present when
    can_set_direct_map() is false (all of rodata_full,
    debug_pagealloc_enabled() and arm64_kfence_can_set_direct_map() false),
    irrespective of the MEMBLOCK_NOMAP ranges. Such MEMBLOCK_NOMAP regions
    should not be saved during hibernation.
    
    This problem was introduced by changes to the pfn_valid() logic in
    commit a7d9f306ba70 ("arm64: drop pfn_valid_within() and simplify
    pfn_valid()").
    
    Similar to other architectures, drop the !can_set_direct_map() check in
    kernel_page_present() so that page_is_savable() skips such pages.
    
    Fixes: a7d9f306ba70 ("arm64: drop pfn_valid_within() and simplify pfn_valid()")
    Cc: <stable@vger.kernel.org> # 5.14.x
    Suggested-by: Mike Rapoport <rppt@kernel.org>
    Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
    Co-developed-by: xiongxin <xiongxin@kylinos.cn>
    Signed-off-by: xiongxin <xiongxin@kylinos.cn>
    Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
    Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
    Link: https://lore.kernel.org/r/20240417025248.386622-1-tianyaxiong@kylinos.cn
    [catalin.marinas@arm.com: rework commit message]
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ARM: omap2: n8x0: stop instantiating codec platform data [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Wed Nov 2 16:20:02 2022 -0700

    ARM: omap2: n8x0: stop instantiating codec platform data
    
    [ Upstream commit faf3b5cb59f84e4056bd84f115a958bc99c61e65 ]
    
    As of 0426370b58b2 ("ARM: dts: omap2420-n810: Correct the audio codec
    (tlv320aic33) node") the DTS properly specifies reset GPIO, and the
    device name in auxdata lookup table does not even match the one in
    device tree anymore, so stop instantiating it.
    
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Acked-by: Tony Lindgren <tony@atomide.com>
    Link: https://lore.kernel.org/r/20221102232004.1721864-1-dmitry.torokhov@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ASoC: ti: Convert Pandora ASoC to GPIO descriptors [+ + +]
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Tue Sep 26 15:25:32 2023 +0200

    ASoC: ti: Convert Pandora ASoC to GPIO descriptors
    
    [ Upstream commit 319e6ac143b9e9048e527ab9dd2aabb8fdf3d60f ]
    
    The Pandora uses GPIO descriptors pretty much exclusively, but not
    for ASoC, so let's fix it. Register the pins in a descriptor table
    in the machine since the ASoC device is not using device tree.
    
    Use static locals for the GPIO descriptors because I'm not able
    to experient with better state storage on any real hardware. Others
    using the Pandora can come afterwards and improve this.
    
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
    Link: https://lore.kernel.org/r/20230926-descriptors-asoc-ti-v1-4-60cf4f8adbc5@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
binder: check offset alignment in binder_get_object() [+ + +]
Author: Carlos Llamas <cmllamas@google.com>
Date:   Sat Mar 30 19:01:14 2024 +0000

    binder: check offset alignment in binder_get_object()
    
    commit aaef73821a3b0194a01bd23ca77774f704a04d40 upstream.
    
    Commit 6d98eb95b450 ("binder: avoid potential data leakage when copying
    txn") introduced changes to how binder objects are copied. In doing so,
    it unintentionally removed an offset alignment check done through calls
    to binder_alloc_copy_from_buffer() -> check_buffer().
    
    These calls were replaced in binder_get_object() with copy_from_user(),
    so now an explicit offset alignment check is needed here. This avoids
    later complications when unwinding the objects gets harder.
    
    It is worth noting this check existed prior to commit 7a67a39320df
    ("binder: add function to copy binder object from buffer"), likely
    removed due to redundancy at the time.
    
    Fixes: 6d98eb95b450 ("binder: avoid potential data leakage when copying txn")
    Cc: stable@vger.kernel.org
    Signed-off-by: Carlos Llamas <cmllamas@google.com>
    Acked-by: Todd Kjos <tkjos@google.com>
    Link: https://lore.kernel.org/r/20240330190115.1877819-1-cmllamas@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
bootconfig: use memblock_free_late to free xbc memory to buddy [+ + +]
Author: Qiang Zhang <qiang4.zhang@intel.com>
Date:   Sun Apr 14 19:49:45 2024 +0800

    bootconfig: use memblock_free_late to free xbc memory to buddy
    
    commit 89f9a1e876b5a7ad884918c03a46831af202c8a0 upstream.
    
    On the time to free xbc memory in xbc_exit(), memblock may has handed
    over memory to buddy allocator. So it doesn't make sense to free memory
    back to memblock. memblock_free() called by xbc_exit() even causes UAF bugs
    on architectures with CONFIG_ARCH_KEEP_MEMBLOCK disabled like x86.
    Following KASAN logs shows this case.
    
    This patch fixes the xbc memory free problem by calling memblock_free()
    in early xbc init error rewind path and calling memblock_free_late() in
    xbc exit path to free memory to buddy allocator.
    
    [    9.410890] ==================================================================
    [    9.418962] BUG: KASAN: use-after-free in memblock_isolate_range+0x12d/0x260
    [    9.426850] Read of size 8 at addr ffff88845dd30000 by task swapper/0/1
    
    [    9.435901] CPU: 9 PID: 1 Comm: swapper/0 Tainted: G     U             6.9.0-rc3-00208-g586b5dfb51b9 #5
    [    9.446403] Hardware name: Intel Corporation RPLP LP5 (CPU:RaptorLake)/RPLP LP5 (ID:13), BIOS IRPPN02.01.01.00.00.19.015.D-00000000 Dec 28 2023
    [    9.460789] Call Trace:
    [    9.463518]  <TASK>
    [    9.465859]  dump_stack_lvl+0x53/0x70
    [    9.469949]  print_report+0xce/0x610
    [    9.473944]  ? __virt_addr_valid+0xf5/0x1b0
    [    9.478619]  ? memblock_isolate_range+0x12d/0x260
    [    9.483877]  kasan_report+0xc6/0x100
    [    9.487870]  ? memblock_isolate_range+0x12d/0x260
    [    9.493125]  memblock_isolate_range+0x12d/0x260
    [    9.498187]  memblock_phys_free+0xb4/0x160
    [    9.502762]  ? __pfx_memblock_phys_free+0x10/0x10
    [    9.508021]  ? mutex_unlock+0x7e/0xd0
    [    9.512111]  ? __pfx_mutex_unlock+0x10/0x10
    [    9.516786]  ? kernel_init_freeable+0x2d4/0x430
    [    9.521850]  ? __pfx_kernel_init+0x10/0x10
    [    9.526426]  xbc_exit+0x17/0x70
    [    9.529935]  kernel_init+0x38/0x1e0
    [    9.533829]  ? _raw_spin_unlock_irq+0xd/0x30
    [    9.538601]  ret_from_fork+0x2c/0x50
    [    9.542596]  ? __pfx_kernel_init+0x10/0x10
    [    9.547170]  ret_from_fork_asm+0x1a/0x30
    [    9.551552]  </TASK>
    
    [    9.555649] The buggy address belongs to the physical page:
    [    9.561875] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x45dd30
    [    9.570821] flags: 0x200000000000000(node=0|zone=2)
    [    9.576271] page_type: 0xffffffff()
    [    9.580167] raw: 0200000000000000 ffffea0011774c48 ffffea0012ba1848 0000000000000000
    [    9.588823] raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
    [    9.597476] page dumped because: kasan: bad access detected
    
    [    9.605362] Memory state around the buggy address:
    [    9.610714]  ffff88845dd2ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [    9.618786]  ffff88845dd2ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    [    9.626857] >ffff88845dd30000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    [    9.634930]                    ^
    [    9.638534]  ffff88845dd30080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    [    9.646605]  ffff88845dd30100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    [    9.654675] ==================================================================
    
    Link: https://lore.kernel.org/all/20240414114944.1012359-1-qiang4.zhang@linux.intel.com/
    
    Fixes: 40caa127f3c7 ("init: bootconfig: Remove all bootconfig data when the init memory is removed")
    Cc: Stable@vger.kernel.org
    Signed-off-by: Qiang Zhang <qiang4.zhang@intel.com>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
clk: Get runtime PM before walking tree during disable_unused [+ + +]
Author: Stephen Boyd <sboyd@kernel.org>
Date:   Mon Mar 25 11:41:58 2024 -0700

    clk: Get runtime PM before walking tree during disable_unused
    
    [ Upstream commit e581cf5d216289ef292d1a4036d53ce90e122469 ]
    
    Doug reported [1] the following hung task:
    
     INFO: task swapper/0:1 blocked for more than 122 seconds.
           Not tainted 5.15.149-21875-gf795ebc40eb8 #1
     "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
     task:swapper/0       state:D stack:    0 pid:    1 ppid:     0 flags:0x00000008
     Call trace:
      __switch_to+0xf4/0x1f4
      __schedule+0x418/0xb80
      schedule+0x5c/0x10c
      rpm_resume+0xe0/0x52c
      rpm_resume+0x178/0x52c
      __pm_runtime_resume+0x58/0x98
      clk_pm_runtime_get+0x30/0xb0
      clk_disable_unused_subtree+0x58/0x208
      clk_disable_unused_subtree+0x38/0x208
      clk_disable_unused_subtree+0x38/0x208
      clk_disable_unused_subtree+0x38/0x208
      clk_disable_unused_subtree+0x38/0x208
      clk_disable_unused+0x4c/0xe4
      do_one_initcall+0xcc/0x2d8
      do_initcall_level+0xa4/0x148
      do_initcalls+0x5c/0x9c
      do_basic_setup+0x24/0x30
      kernel_init_freeable+0xec/0x164
      kernel_init+0x28/0x120
      ret_from_fork+0x10/0x20
     INFO: task kworker/u16:0:9 blocked for more than 122 seconds.
           Not tainted 5.15.149-21875-gf795ebc40eb8 #1
     "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
     task:kworker/u16:0   state:D stack:    0 pid:    9 ppid:     2 flags:0x00000008
     Workqueue: events_unbound deferred_probe_work_func
     Call trace:
      __switch_to+0xf4/0x1f4
      __schedule+0x418/0xb80
      schedule+0x5c/0x10c
      schedule_preempt_disabled+0x2c/0x48
      __mutex_lock+0x238/0x488
      __mutex_lock_slowpath+0x1c/0x28
      mutex_lock+0x50/0x74
      clk_prepare_lock+0x7c/0x9c
      clk_core_prepare_lock+0x20/0x44
      clk_prepare+0x24/0x30
      clk_bulk_prepare+0x40/0xb0
      mdss_runtime_resume+0x54/0x1c8
      pm_generic_runtime_resume+0x30/0x44
      __genpd_runtime_resume+0x68/0x7c
      genpd_runtime_resume+0x108/0x1f4
      __rpm_callback+0x84/0x144
      rpm_callback+0x30/0x88
      rpm_resume+0x1f4/0x52c
      rpm_resume+0x178/0x52c
      __pm_runtime_resume+0x58/0x98
      __device_attach+0xe0/0x170
      device_initial_probe+0x1c/0x28
      bus_probe_device+0x3c/0x9c
      device_add+0x644/0x814
      mipi_dsi_device_register_full+0xe4/0x170
      devm_mipi_dsi_device_register_full+0x28/0x70
      ti_sn_bridge_probe+0x1dc/0x2c0
      auxiliary_bus_probe+0x4c/0x94
      really_probe+0xcc/0x2c8
      __driver_probe_device+0xa8/0x130
      driver_probe_device+0x48/0x110
      __device_attach_driver+0xa4/0xcc
      bus_for_each_drv+0x8c/0xd8
      __device_attach+0xf8/0x170
      device_initial_probe+0x1c/0x28
      bus_probe_device+0x3c/0x9c
      deferred_probe_work_func+0x9c/0xd8
      process_one_work+0x148/0x518
      worker_thread+0x138/0x350
      kthread+0x138/0x1e0
      ret_from_fork+0x10/0x20
    
    The first thread is walking the clk tree and calling
    clk_pm_runtime_get() to power on devices required to read the clk
    hardware via struct clk_ops::is_enabled(). This thread holds the clk
    prepare_lock, and is trying to runtime PM resume a device, when it finds
    that the device is in the process of resuming so the thread schedule()s
    away waiting for the device to finish resuming before continuing. The
    second thread is runtime PM resuming the same device, but the runtime
    resume callback is calling clk_prepare(), trying to grab the
    prepare_lock waiting on the first thread.
    
    This is a classic ABBA deadlock. To properly fix the deadlock, we must
    never runtime PM resume or suspend a device with the clk prepare_lock
    held. Actually doing that is near impossible today because the global
    prepare_lock would have to be dropped in the middle of the tree, the
    device runtime PM resumed/suspended, and then the prepare_lock grabbed
    again to ensure consistency of the clk tree topology. If anything
    changes with the clk tree in the meantime, we've lost and will need to
    start the operation all over again.
    
    Luckily, most of the time we're simply incrementing or decrementing the
    runtime PM count on an active device, so we don't have the chance to
    schedule away with the prepare_lock held. Let's fix this immediate
    problem that can be triggered more easily by simply booting on Qualcomm
    sc7180.
    
    Introduce a list of clk_core structures that have been registered, or
    are in the process of being registered, that require runtime PM to
    operate. Iterate this list and call clk_pm_runtime_get() on each of them
    without holding the prepare_lock during clk_disable_unused(). This way
    we can be certain that the runtime PM state of the devices will be
    active and resumed so we can't schedule away while walking the clk tree
    with the prepare_lock held. Similarly, call clk_pm_runtime_put() without
    the prepare_lock held to properly drop the runtime PM reference. We
    remove the calls to clk_pm_runtime_{get,put}() in this path because
    they're superfluous now that we know the devices are runtime resumed.
    
    Reported-by: Douglas Anderson <dianders@chromium.org>
    Closes: https://lore.kernel.org/all/20220922084322.RFC.2.I375b6b9e0a0a5348962f004beb3dafee6a12dfbb@changeid/ [1]
    Closes: https://issuetracker.google.com/328070191
    Cc: Marek Szyprowski <m.szyprowski@samsung.com>
    Cc: Ulf Hansson <ulf.hansson@linaro.org>
    Cc: Krzysztof Kozlowski <krzk@kernel.org>
    Fixes: 9a34b45397e5 ("clk: Add support for runtime PM")
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Link: https://lore.kernel.org/r/20240325184204.745706-5-sboyd@kernel.org
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: Get runtime PM before walking tree for clk_summary [+ + +]
Author: Stephen Boyd <sboyd@kernel.org>
Date:   Mon Mar 25 11:41:59 2024 -0700

    clk: Get runtime PM before walking tree for clk_summary
    
    [ Upstream commit 9d1e795f754db1ac3344528b7af0b17b8146f321 ]
    
    Similar to the previous commit, we should make sure that all devices are
    runtime resumed before printing the clk_summary through debugfs. Failure
    to do so would result in a deadlock if the thread is resuming a device
    to print clk state and that device is also runtime resuming in another
    thread, e.g the screen is turning on and the display driver is starting
    up. We remove the calls to clk_pm_runtime_{get,put}() in this path
    because they're superfluous now that we know the devices are runtime
    resumed. This also squashes a bug where the return value of
    clk_pm_runtime_get() wasn't checked, leading to an RPM count underflow
    on error paths.
    
    Fixes: 1bb294a7981c ("clk: Enable/Disable runtime PM for clk_summary")
    Cc: Taniya Das <quic_tdas@quicinc.com>
    Cc: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Link: https://lore.kernel.org/r/20240325184204.745706-6-sboyd@kernel.org
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: Initialize struct clk_core kref earlier [+ + +]
Author: Stephen Boyd <sboyd@kernel.org>
Date:   Mon Mar 25 11:41:57 2024 -0700

    clk: Initialize struct clk_core kref earlier
    
    [ Upstream commit 9d05ae531c2cff20d5d527f04e28d28e04379929 ]
    
    Initialize this kref once we allocate memory for the struct clk_core so
    that we can reuse the release function to free any memory associated
    with the structure. This mostly consolidates code, but also clarifies
    that the kref lifetime exists once the container structure (struct
    clk_core) is allocated instead of leaving it in a half-baked state for
    most of __clk_core_init().
    
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Link: https://lore.kernel.org/r/20240325184204.745706-4-sboyd@kernel.org
    Stable-dep-of: e581cf5d2162 ("clk: Get runtime PM before walking tree during disable_unused")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: clk-gate: Propagate struct device with mtk_clk_register_gates() [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date:   Fri Jan 20 10:20:33 2023 +0100

    clk: mediatek: clk-gate: Propagate struct device with mtk_clk_register_gates()
    
    [ Upstream commit 20498d52c9c1a68b1d92c42bce1dc893d3e74f30 ]
    
    Commit e4c23e19aa2a ("clk: mediatek: Register clock gate with device")
    introduces a helper function for the sole purpose of propagating a
    struct device pointer to the clk API when registering the mtk-gate
    clocks to take advantage of Runtime PM when/where needed and where
    a power domain is defined in devicetree.
    
    Function mtk_clk_register_gates() then becomes a wrapper around the
    new mtk_clk_register_gates_with_dev() function that will simply pass
    NULL as struct device: this is essential when registering drivers
    with CLK_OF_DECLARE instead of as a platform device, as there will
    be no struct device to pass... but we can as well simply have only
    one function that always takes such pointer as a param and pass NULL
    when unavoidable.
    
    This commit removes the mtk_clk_register_gates() wrapper and renames
    mtk_clk_register_gates_with_dev() to the former and all of the calls
    to either of the two functions were fixed in all drivers in order to
    reflect this change; also, to improve consistency with other kernel
    functions, the pointer to struct device was moved as the first param.
    
    Since a lot of MediaTek clock drivers are actually registering as a
    platform device, but were still registering the mtk-gate clocks
    without passing any struct device to the clock framework, they've
    been changed to pass a valid one now, as to make all those platforms
    able to use runtime power management where available.
    
    While at it, some much needed indentation changes were also done.
    
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
    Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
    Tested-by: Miles Chen <miles.chen@mediatek.com>
    Link: https://lore.kernel.org/r/20230120092053.182923-4-angelogioacchino.delregno@collabora.com
    Tested-by: Mingming Su <mingming.su@mediatek.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: 2f7b1d8b5505 ("clk: mediatek: Do a runtime PM get on controllers during probe")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: clk-mtk: Extend mtk_clk_simple_probe() [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date:   Fri Jan 20 10:20:42 2023 +0100

    clk: mediatek: clk-mtk: Extend mtk_clk_simple_probe()
    
    [ Upstream commit 7b6183108c8ccf0dc295f39cdf78bd8078455636 ]
    
    As a preparation to increase probe functions commonization across
    various MediaTek SoC clock controller drivers, extend function
    mtk_clk_simple_probe() to be able to register not only gates, but
    also fixed clocks, factors, muxes and composites.
    
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Reviewed-by: Miles Chen <miles.chen@mediatek.com>
    Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
    Tested-by: Miles Chen <miles.chen@mediatek.com>
    Link: https://lore.kernel.org/r/20230120092053.182923-13-angelogioacchino.delregno@collabora.com
    Tested-by: Mingming Su <mingming.su@mediatek.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: 2f7b1d8b5505 ("clk: mediatek: Do a runtime PM get on controllers during probe")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: clk-mtk: Propagate struct device for composites [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date:   Fri Jan 20 10:20:35 2023 +0100

    clk: mediatek: clk-mtk: Propagate struct device for composites
    
    [ Upstream commit 01a6c1ab57c3a474c8d23c7d82c3fcce85f62612 ]
    
    Like done for cpumux clocks, propagate struct device for composite
    clocks registered through clk-mtk helpers to be able to get runtime
    pm support for MTK clocks.
    
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Tested-by: Miles Chen <miles.chen@mediatek.com>
    Link: https://lore.kernel.org/r/20230120092053.182923-6-angelogioacchino.delregno@collabora.com
    Tested-by: Mingming Su <mingming.su@mediatek.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: 2f7b1d8b5505 ("clk: mediatek: Do a runtime PM get on controllers during probe")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: clk-mux: Propagate struct device for mtk-mux [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date:   Fri Jan 20 10:20:36 2023 +0100

    clk: mediatek: clk-mux: Propagate struct device for mtk-mux
    
    [ Upstream commit d3d6bd5e25cdc460df33ae1db4f051c4bdd3aa60 ]
    
    Like done for other clocks, propagate struct device for mtk mux clocks
    registered through clk-mux helpers to enable runtime pm support.
    
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Tested-by: Miles Chen <miles.chen@mediatek.com>
    Link: https://lore.kernel.org/r/20230120092053.182923-7-angelogioacchino.delregno@collabora.com
    Tested-by: Mingming Su <mingming.su@mediatek.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: 2f7b1d8b5505 ("clk: mediatek: Do a runtime PM get on controllers during probe")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: Do a runtime PM get on controllers during probe [+ + +]
Author: Pin-yen Lin <treapking@chromium.org>
Date:   Tue Mar 12 19:51:55 2024 +0800

    clk: mediatek: Do a runtime PM get on controllers during probe
    
    [ Upstream commit 2f7b1d8b5505efb0057cd1ab85fca206063ea4c3 ]
    
    mt8183-mfgcfg has a mutual dependency with genpd during the probing
    stage, which leads to a deadlock in the following call stack:
    
    CPU0:  genpd_lock --> clk_prepare_lock
    genpd_power_off_work_fn()
     genpd_lock()
     generic_pm_domain::power_off()
        clk_unprepare()
          clk_prepare_lock()
    
    CPU1: clk_prepare_lock --> genpd_lock
    clk_register()
      __clk_core_init()
        clk_prepare_lock()
        clk_pm_runtime_get()
          genpd_lock()
    
    Do a runtime PM get at the probe function to make sure clk_register()
    won't acquire the genpd lock. Instead of only modifying mt8183-mfgcfg,
    do this on all mediatek clock controller probings because we don't
    believe this would cause any regression.
    
    Verified on MT8183 and MT8192 Chromebooks.
    
    Fixes: acddfc2c261b ("clk: mediatek: Add MT8183 clock support")
    Signed-off-by: Pin-yen Lin <treapking@chromium.org>
    
    Link: https://lore.kernel.org/r/20240312115249.3341654-1-treapking@chromium.org
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: mt8192: Correctly unregister and free clocks on failure [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date:   Fri Jan 20 10:20:31 2023 +0100

    clk: mediatek: mt8192: Correctly unregister and free clocks on failure
    
    [ Upstream commit 0cbe12694990501be92f997d987925132002dbe5 ]
    
    If anything fails during probe of the clock controller(s), unregister
    (and kfree!) whatever we have previously registered to leave with a
    clean state and prevent leaks.
    
    Fixes: 710573dee31b ("clk: mediatek: Add MT8192 basic clocks support")
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
    Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
    Tested-by: Miles Chen <miles.chen@mediatek.com>
    Link: https://lore.kernel.org/r/20230120092053.182923-2-angelogioacchino.delregno@collabora.com
    Tested-by: Mingming Su <mingming.su@mediatek.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: 2f7b1d8b5505 ("clk: mediatek: Do a runtime PM get on controllers during probe")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: mt8192: Propagate struct device for gate clocks [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date:   Fri Jan 20 10:20:32 2023 +0100

    clk: mediatek: mt8192: Propagate struct device for gate clocks
    
    [ Upstream commit fdc325c8f79cb4155009db8394db19793c4d07cd ]
    
    Convert instances of mtk_clk_register_gates() to use the newer
    mtk_clk_register_gates_with_dev() to propagate struct device to
    the clk framework.
    
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
    Tested-by: Miles Chen <miles.chen@mediatek.com>
    Link: https://lore.kernel.org/r/20230120092053.182923-3-angelogioacchino.delregno@collabora.com
    Tested-by: Mingming Su <mingming.su@mediatek.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: 2f7b1d8b5505 ("clk: mediatek: Do a runtime PM get on controllers during probe")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: Print an info line before disabling unused clocks [+ + +]
Author: Konrad Dybcio <konrad.dybcio@linaro.org>
Date:   Tue Mar 7 14:29:28 2023 +0100

    clk: Print an info line before disabling unused clocks
    
    [ Upstream commit 12ca59b91d04df32e41be5a52f0cabba912c11de ]
    
    Currently, the regulator framework informs us before calling into
    their unused cleanup paths, which eases at least some debugging. The
    same could be beneficial for clocks, so that random shutdowns shortly
    after most initcalls are done can be less of a guess.
    
    Add a pr_info before disabling unused clocks to do so.
    
    Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
    Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230307132928.3887737-1-konrad.dybcio@linaro.org
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: e581cf5d2162 ("clk: Get runtime PM before walking tree during disable_unused")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: Remove prepare_lock hold assertion in __clk_release() [+ + +]
Author: Stephen Boyd <sboyd@kernel.org>
Date:   Mon Mar 25 11:41:55 2024 -0700

    clk: Remove prepare_lock hold assertion in __clk_release()
    
    [ Upstream commit 8358a76cfb47c9a5af627a0c4e7168aa14fa25f6 ]
    
    Removing this assertion lets us move the kref_put() call outside the
    prepare_lock section. We don't need to hold the prepare_lock here to
    free memory and destroy the clk_core structure. We've already unlinked
    the clk from the clk tree and by the time the release function runs
    nothing holds a reference to the clk_core anymore so anything with the
    pointer can't access the memory that's being freed anyway. Way back in
    commit 496eadf821c2 ("clk: Use lockdep asserts to find missing hold of
    prepare_lock") we didn't need to have this assertion either.
    
    Fixes: 496eadf821c2 ("clk: Use lockdep asserts to find missing hold of prepare_lock")
    Cc: Krzysztof Kozlowski <krzk@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Link: https://lore.kernel.org/r/20240325184204.745706-2-sboyd@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: remove unnecessary (void*) conversions [+ + +]
Author: Yu Zhe <yuzhe@nfschina.com>
Date:   Thu Mar 16 15:58:26 2023 +0800

    clk: remove unnecessary (void*) conversions
    
    [ Upstream commit 5b1a1c1ab1f981b15bce778db863344f59bd1501 ]
    
    Pointer variables of void * type do not require type cast.
    
    Signed-off-by: Yu Zhe <yuzhe@nfschina.com>
    Link: https://lore.kernel.org/r/20230316075826.22754-1-yuzhe@nfschina.com
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: 9d1e795f754d ("clk: Get runtime PM before walking tree for clk_summary")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: Show active consumers of clocks in debugfs [+ + +]
Author: Vishal Badole <badolevishal1116@gmail.com>
Date:   Sun Nov 27 22:53:19 2022 +0530

    clk: Show active consumers of clocks in debugfs
    
    [ Upstream commit dcce5cc7826e9c6b3a2443e5e6b7f8d02a103c35 ]
    
    This feature lists the clock consumer's name and respective connection
    id. Using this feature user can easily check that which user has
    acquired and enabled a particular clock.
    
    Usage:
    >> cat /sys/kernel/debug/clk/clk_summary
                          enable  prepare  protect
                                                                              duty  hardware                            Connection
       clock               count    count    count    rate   accuracy phase  cycle    enable   consumer                         Id
    ------------------------------------------------------------------------------------------------------------------------------
     clk_mcasp0_fixed         0        0        0    24576000          0      0  50000     Y   deviceless                     of_clk_get_from_provider
                                                                                               deviceless                     no_connection_id
        clk_mcasp0            0        0        0    24576000          0      0  50000     N      simple-audio-card,cpu           no_connection_id
                                                                                                  deviceless                      no_connection_id
    
    Co-developed-by: Chinmoy Ghosh <chinmoyghosh2001@gmail.com>
    Signed-off-by: Chinmoy Ghosh <chinmoyghosh2001@gmail.com>
    Co-developed-by: Mintu Patel <mintupatel89@gmail.com>
    Signed-off-by: Mintu Patel <mintupatel89@gmail.com>
    Co-developed-by: Vimal Kumar <vimal.kumar32@gmail.com>
    Signed-off-by: Vimal Kumar <vimal.kumar32@gmail.com>
    Signed-off-by: Vishal Badole <badolevishal1116@gmail.com>
    Link: https://lore.kernel.org/r/1669569799-8526-1-git-send-email-badolevishal1116@gmail.com
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: 9d1e795f754d ("clk: Get runtime PM before walking tree for clk_summary")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
comedi: vmk80xx: fix incomplete endpoint checking [+ + +]
Author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Date:   Mon Apr 8 10:16:33 2024 -0700

    comedi: vmk80xx: fix incomplete endpoint checking
    
    commit d1718530e3f640b7d5f0050e725216eab57a85d8 upstream.
    
    While vmk80xx does have endpoint checking implemented, some things
    can fall through the cracks. Depending on the hardware model,
    URBs can have either bulk or interrupt type, and current version
    of vmk80xx_find_usb_endpoints() function does not take that fully
    into account. While this warning does not seem to be too harmful,
    at the very least it will crash systems with 'panic_on_warn' set on
    them.
    
    Fix the issue found by Syzkaller [1] by somewhat simplifying the
    endpoint checking process with usb_find_common_endpoints() and
    ensuring that only expected endpoint types are present.
    
    This patch has not been tested on real hardware.
    
    [1] Syzkaller report:
    usb 1-1: BOGUS urb xfer, pipe 1 != type 3
    WARNING: CPU: 0 PID: 781 at drivers/usb/core/urb.c:504 usb_submit_urb+0xc4e/0x18c0 drivers/usb/core/urb.c:503
    ...
    Call Trace:
     <TASK>
     usb_start_wait_urb+0x113/0x520 drivers/usb/core/message.c:59
     vmk80xx_reset_device drivers/comedi/drivers/vmk80xx.c:227 [inline]
     vmk80xx_auto_attach+0xa1c/0x1a40 drivers/comedi/drivers/vmk80xx.c:818
     comedi_auto_config+0x238/0x380 drivers/comedi/drivers.c:1067
     usb_probe_interface+0x5cd/0xb00 drivers/usb/core/driver.c:399
    ...
    
    Similar issue also found by Syzkaller:
    Link: https://syzkaller.appspot.com/bug?extid=5205eb2f17de3e01946e
    
    Reported-and-tested-by: syzbot+5f29dc6a889fc42bd896@syzkaller.appspotmail.com
    Cc: stable <stable@kernel.org>
    Fixes: 49253d542cc0 ("staging: comedi: vmk80xx: factor out usb endpoint detection")
    Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
    Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
    Link: https://lore.kernel.org/r/20240408171633.31649-1-n.zhandarovich@fintech.ru
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amd/display: Do not recursively call manual trigger programming [+ + +]
Author: Dillon Varone <dillon.varone@amd.com>
Date:   Thu Mar 21 13:49:43 2024 -0400

    drm/amd/display: Do not recursively call manual trigger programming
    
    [ Upstream commit 953927587f37b731abdeabe46ad44a3b3ec67a52 ]
    
    [WHY&HOW]
    We should not be recursively calling the manual trigger programming function when
    FAMS is not in use.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
    Acked-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
    Signed-off-by: Dillon Varone <dillon.varone@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amdgpu: fix incorrect active rb bitmap for gfx11 [+ + +]
Author: Hawking Zhang <Hawking.Zhang@amd.com>
Date:   Mon Feb 20 09:06:53 2023 +0800

    drm/amdgpu: fix incorrect active rb bitmap for gfx11
    
    [ Upstream commit f9c35f4fffc6cb5bbb23f546f48c045aef012518 ]
    
    GFX v11 changes RB_BACKEND_DISABLE related registers
    from per SA to global ones. The approach to query active
    rb bitmap needs to be changed accordingly. Query per
    SE setting returns wrong active RB bitmap especially
    in the case when some of SA are disabled. With the new
    approach, driver will generate the active rb bitmap
    based on active SA bitmap and global active RB bitmap.
    
    Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
    Reviewed-by: Likun Gao <Likun.Gao@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Stable-dep-of: bbca7f414ae9 ("drm/amdgpu: fix incorrect number of active RBs for gfx11")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amdgpu: fix incorrect number of active RBs for gfx11 [+ + +]
Author: Tim Huang <Tim.Huang@amd.com>
Date:   Wed Apr 3 17:28:44 2024 +0800

    drm/amdgpu: fix incorrect number of active RBs for gfx11
    
    [ Upstream commit bbca7f414ae9a12ea231cdbafd79c607e3337ea8 ]
    
    The RB bitmap should be global active RB bitmap &
    active RB bitmap based on active SA.
    
    Signed-off-by: Tim Huang <Tim.Huang@amd.com>
    Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amdgpu: validate the parameters of bo mapping operations more clearly [+ + +]
Author: xinhui pan <xinhui.pan@amd.com>
Date:   Thu Apr 11 11:11:38 2024 +0800

    drm/amdgpu: validate the parameters of bo mapping operations more clearly
    
    commit 6fef2d4c00b5b8561ad68dd2b68173f5c6af1e75 upstream.
    
    Verify the parameters of
    amdgpu_vm_bo_(map/replace_map/clearing_mappings) in one common place.
    
    Fixes: dc54d3d1744d ("drm/amdgpu: implement AMDGPU_VA_OP_CLEAR v2")
    Cc: stable@vger.kernel.org
    Reported-by: Vlad Stolyarov <hexed@google.com>
    Suggested-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: xinhui pan <xinhui.pan@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/i915/vma: Fix UAF on destroy against retire race [+ + +]
Author: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Date:   Tue Mar 5 15:35:06 2024 +0100

    drm/i915/vma: Fix UAF on destroy against retire race
    
    commit 0e45882ca829b26b915162e8e86dbb1095768e9e upstream.
    
    Object debugging tools were sporadically reporting illegal attempts to
    free a still active i915 VMA object when parking a GT believed to be idle.
    
    [161.359441] ODEBUG: free active (active state 0) object: ffff88811643b958 object type: i915_active hint: __i915_vma_active+0x0/0x50 [i915]
    [161.360082] WARNING: CPU: 5 PID: 276 at lib/debugobjects.c:514 debug_print_object+0x80/0xb0
    ...
    [161.360304] CPU: 5 PID: 276 Comm: kworker/5:2 Not tainted 6.5.0-rc1-CI_DRM_13375-g003f860e5577+ #1
    [161.360314] Hardware name: Intel Corporation Rocket Lake Client Platform/RocketLake S UDIMM 6L RVP, BIOS RKLSFWI1.R00.3173.A03.2204210138 04/21/2022
    [161.360322] Workqueue: i915-unordered __intel_wakeref_put_work [i915]
    [161.360592] RIP: 0010:debug_print_object+0x80/0xb0
    ...
    [161.361347] debug_object_free+0xeb/0x110
    [161.361362] i915_active_fini+0x14/0x130 [i915]
    [161.361866] release_references+0xfe/0x1f0 [i915]
    [161.362543] i915_vma_parked+0x1db/0x380 [i915]
    [161.363129] __gt_park+0x121/0x230 [i915]
    [161.363515] ____intel_wakeref_put_last+0x1f/0x70 [i915]
    
    That has been tracked down to be happening when another thread is
    deactivating the VMA inside __active_retire() helper, after the VMA's
    active counter has been already decremented to 0, but before deactivation
    of the VMA's object is reported to the object debugging tool.
    
    We could prevent from that race by serializing i915_active_fini() with
    __active_retire() via ref->tree_lock, but that wouldn't stop the VMA from
    being used, e.g. from __i915_vma_retire() called at the end of
    __active_retire(), after that VMA has been already freed by a concurrent
    i915_vma_destroy() on return from the i915_active_fini().  Then, we should
    rather fix the issue at the VMA level, not in i915_active.
    
    Since __i915_vma_parked() is called from __gt_park() on last put of the
    GT's wakeref, the issue could be addressed by holding the GT wakeref long
    enough for __active_retire() to complete before that wakeref is released
    and the GT parked.
    
    I believe the issue was introduced by commit d93939730347 ("drm/i915:
    Remove the vma refcount") which moved a call to i915_active_fini() from
    a dropped i915_vma_release(), called on last put of the removed VMA kref,
    to i915_vma_parked() processing path called on last put of a GT wakeref.
    However, its visibility to the object debugging tool was suppressed by a
    bug in i915_active that was fixed two weeks later with commit e92eb246feb9
    ("drm/i915/active: Fix missing debug object activation").
    
    A VMA associated with a request doesn't acquire a GT wakeref by itself.
    Instead, it depends on a wakeref held directly by the request's active
    intel_context for a GT associated with its VM, and indirectly on that
    intel_context's engine wakeref if the engine belongs to the same GT as the
    VMA's VM.  Those wakerefs are released asynchronously to VMA deactivation.
    
    Fix the issue by getting a wakeref for the VMA's GT when activating it,
    and putting that wakeref only after the VMA is deactivated.  However,
    exclude global GTT from that processing path, otherwise the GPU never goes
    idle.  Since __i915_vma_retire() may be called from atomic contexts, use
    async variant of wakeref put.  Also, to avoid circular locking dependency,
    take care of acquiring the wakeref before VM mutex when both are needed.
    
    v7: Add inline comments with justifications for:
        - using untracked variants of intel_gt_pm_get/put() (Nirmoy),
        - using async variant of _put(),
        - not getting the wakeref in case of a global GTT,
        - always getting the first wakeref outside vm->mutex.
    v6: Since __i915_vma_active/retire() callbacks are not serialized, storing
        a wakeref tracking handle inside struct i915_vma is not safe, and
        there is no other good place for that.  Use untracked variants of
        intel_gt_pm_get/put_async().
    v5: Replace "tile" with "GT" across commit description (Rodrigo),
      - avoid mentioning multi-GT case in commit description (Rodrigo),
      - explain why we need to take a temporary wakeref unconditionally inside
        i915_vma_pin_ww() (Rodrigo).
    v4: Refresh on top of commit 5e4e06e4087e ("drm/i915: Track gt pm
        wakerefs") (Andi),
      - for more easy backporting, split out removal of former insufficient
        workarounds and move them to separate patches (Nirmoy).
      - clean up commit message and description a bit.
    v3: Identify root cause more precisely, and a commit to blame,
      - identify and drop former workarounds,
      - update commit message and description.
    v2: Get the wakeref before VM mutex to avoid circular locking dependency,
      - drop questionable Fixes: tag.
    
    Fixes: d93939730347 ("drm/i915: Remove the vma refcount")
    Closes: https://gitlab.freedesktop.org/drm/intel/issues/8875
    Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
    Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Cc: Nirmoy Das <nirmoy.das@intel.com>
    Cc: Andi Shyti <andi.shyti@linux.intel.com>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: stable@vger.kernel.org # v5.19+
    Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
    Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240305143747.335367-6-janusz.krzysztofik@linux.intel.com
    (cherry picked from commit f3c71b2ded5c4367144a810ef25f998fd1d6c381)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/panel: visionox-rm69299: don't unregister DSI device [+ + +]
Author: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Date:   Thu Apr 4 13:07:59 2024 +0300

    drm/panel: visionox-rm69299: don't unregister DSI device
    
    [ Upstream commit 9e4d3f4f34455abbaa9930bf6b7575a5cd081496 ]
    
    The DSI device for the panel was registered by the DSI host, so it is an
    error to unregister it from the panel driver. Drop the call to
    mipi_dsi_device_unregister().
    
    Fixes: c7f66d32dd43 ("drm/panel: add support for rm69299 visionox panel")
    Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240404-drop-panel-unregister-v1-1-9f56953c5fb9@linaro.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/vmwgfx: Enable DMA mappings with SEV [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
Date:   Sun Apr 7 22:28:02 2024 -0400

    drm/vmwgfx: Enable DMA mappings with SEV
    
    [ Upstream commit 4c08f01934ab67d1d283d5cbaa52b923abcfe4cd ]
    
    Enable DMA mappings in vmwgfx after TTM has been fixed in commit
    3bf3710e3718 ("drm/ttm: Add a generic TTM memcpy move for page-based iomem")
    
    This enables full guest-backed memory support and in particular allows
    usage of screen targets as the presentation mechanism.
    
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reported-by: Ye Li <ye.li@broadcom.com>
    Tested-by: Ye Li <ye.li@broadcom.com>
    Fixes: 3b0d6458c705 ("drm/vmwgfx: Refuse DMA operation when SEV encryption is active")
    Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
    Cc: dri-devel@lists.freedesktop.org
    Cc: <stable@vger.kernel.org> # v6.6+
    Reviewed-by: Martin Krastev <martin.krastev@broadcom.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240408022802.358641-1-zack.rusin@broadcom.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
drm/vmwgfx: Fix crtc's atomic check conditional [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
Date:   Thu Apr 11 22:55:10 2024 -0400

    drm/vmwgfx: Fix crtc's atomic check conditional
    
    commit a60ccade88f926e871a57176e86a34bbf0db0098 upstream.
    
    The conditional was supposed to prevent enabling of a crtc state
    without a set primary plane. Accidently it also prevented disabling
    crtc state with a set primary plane. Neither is correct.
    
    Fix the conditional and just driver-warn when a crtc state has been
    enabled without a primary plane which will help debug broken userspace.
    
    Fixes IGT's kms_atomic_interruptible and kms_atomic_transition tests.
    
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Fixes: 06ec41909e31 ("drm/vmwgfx: Add and connect CRTC helper functions")
    Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
    Cc: dri-devel@lists.freedesktop.org
    Cc: <stable@vger.kernel.org> # v4.12+
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Reviewed-by: Martin Krastev <martin.krastev@broadcom.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240412025511.78553-5-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: Sort primary plane formats by order of preference [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
Date:   Thu Apr 11 22:55:11 2024 -0400

    drm/vmwgfx: Sort primary plane formats by order of preference
    
    commit d4c972bff3129a9dd4c22a3999fd8eba1a81531a upstream.
    
    The table of primary plane formats wasn't sorted at all, leading to
    applications picking our least desirable formats by defaults.
    
    Sort the primary plane formats according to our order of preference.
    
    Nice side-effect of this change is that it makes IGT's kms_atomic
    plane-invalid-params pass because the test picks the first format
    which for vmwgfx was DRM_FORMAT_XRGB1555 and uses fb's with odd sizes
    which make Pixman, which IGT depends on assert due to the fact that our
    16bpp formats aren't 32 bit aligned like Pixman requires all formats
    to be.
    
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Fixes: 36cc79bc9077 ("drm/vmwgfx: Add universal plane support")
    Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
    Cc: dri-devel@lists.freedesktop.org
    Cc: <stable@vger.kernel.org> # v4.12+
    Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240412025511.78553-6-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm: nv04: Fix out of bounds access [+ + +]
Author: Mikhail Kobuk <m.kobuk@ispras.ru>
Date:   Thu Apr 11 14:08:52 2024 +0300

    drm: nv04: Fix out of bounds access
    
    [ Upstream commit cf92bb778eda7830e79452c6917efa8474a30c1e ]
    
    When Output Resource (dcb->or) value is assigned in
    fabricate_dcb_output(), there may be out of bounds access to
    dac_users array in case dcb->or is zero because ffs(dcb->or) is
    used as index there.
    The 'or' argument of fabricate_dcb_output() must be interpreted as a
    number of bit to set, not value.
    
    Utilize macros from 'enum nouveau_or' in calls instead of hardcoding.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 2e5702aff395 ("drm/nouveau: fabricate DCB encoder table for iMac G4")
    Fixes: 670820c0e6a9 ("drm/nouveau: Workaround incorrect DCB entry on a GeForce3 Ti 200.")
    Signed-off-by: Mikhail Kobuk <m.kobuk@ispras.ru>
    Signed-off-by: Danilo Krummrich <dakr@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240411110854.16701-1-m.kobuk@ispras.ru
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm: panel-orientation-quirks: Add quirk for Lenovo Legion Go [+ + +]
Author: Brenton Simpson <appsforartists@google.com>
Date:   Tue Nov 14 23:38:59 2023 +0000

    drm: panel-orientation-quirks: Add quirk for Lenovo Legion Go
    
    [ Upstream commit 430143b0d3611f4a9c8434319e5e504244749e79 ]
    
    The Legion Go has a 2560x1600 portrait screen, with the native "up" facing
    the right controller (90° CW from the rest of the device).
    
    Signed-off-by: Brenton Simpson <appsforartists@google.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20231114233859.274189-1-appsforartists@google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fs: sysfs: Fix reference leak in sysfs_break_active_protection() [+ + +]
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Wed Mar 13 17:43:41 2024 -0400

    fs: sysfs: Fix reference leak in sysfs_break_active_protection()
    
    commit a90bca2228c0646fc29a72689d308e5fe03e6d78 upstream.
    
    The sysfs_break_active_protection() routine has an obvious reference
    leak in its error path.  If the call to kernfs_find_and_get() fails then
    kn will be NULL, so the companion sysfs_unbreak_active_protection()
    routine won't get called (and would only cause an access violation by
    trying to dereference kn->parent if it was called).  As a result, the
    reference to kobj acquired at the start of the function will never be
    released.
    
    Fix the leak by adding an explicit kobject_put() call when kn is NULL.
    
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    Fixes: 2afc9166f79b ("scsi: sysfs: Introduce sysfs_{un,}break_active_protection()")
    Cc: Bart Van Assche <bvanassche@acm.org>
    Cc: stable@vger.kernel.org
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Acked-by: Tejun Heo <tj@kernel.org>
    Link: https://lore.kernel.org/r/8a4d3f0f-c5e3-4b70-a188-0ca433f9e6f9@rowland.harvard.edu
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
HID: kye: Sort kye devices [+ + +]
Author: David Yang <mmyangfl@gmail.com>
Date:   Tue Feb 7 12:33:16 2023 +0800

    HID: kye: Sort kye devices
    
    [ Upstream commit 8c7b79bc04abb67e7f5864e94286a800b42aa96c ]
    
    Sort kye devices by their Produce IDs.
    
    Signed-off-by: David Yang <mmyangfl@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ice: tc: allow zero flags in parsing tc flower [+ + +]
Author: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Date:   Fri Mar 15 12:08:21 2024 +0100

    ice: tc: allow zero flags in parsing tc flower
    
    [ Upstream commit 73278715725a8347032acf233082ca4eb31e6a56 ]
    
    The check for flags is done to not pass empty lookups to adding switch
    rule functions. Since metadata is always added to lookups there is no
    need to check against the flag.
    
    It is also fixing the problem with such rule:
    $ tc filter add dev gtp_dev ingress protocol ip prio 0 flower \
            enc_dst_port 2123 action drop
    Switch block in case of GTP can't parse the destination port, because it
    should always be set to GTP specific value. The same with ethertype. The
    result is that there is no other matching criteria than GTP tunnel. In
    this case flags is 0, rule can't be added only because of defensive
    check against flags.
    
    Fixes: 9a225f81f540 ("ice: Support GTP-U and GTP-C offload in switchdev")
    Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
    Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
init/main.c: Fix potential static_command_line memory overflow [+ + +]
Author: Yuntao Wang <ytcoode@gmail.com>
Date:   Fri Apr 12 16:17:32 2024 +0800

    init/main.c: Fix potential static_command_line memory overflow
    
    commit 46dad3c1e57897ab9228332f03e1c14798d2d3b9 upstream.
    
    We allocate memory of size 'xlen + strlen(boot_command_line) + 1' for
    static_command_line, but the strings copied into static_command_line are
    extra_command_line and command_line, rather than extra_command_line and
    boot_command_line.
    
    When strlen(command_line) > strlen(boot_command_line), static_command_line
    will overflow.
    
    This patch just recovers strlen(command_line) which was miss-consolidated
    with strlen(boot_command_line) in the commit f5c7310ac73e ("init/main: add
    checks for the return value of memblock_alloc*()")
    
    Link: https://lore.kernel.org/all/20240412081733.35925-2-ytcoode@gmail.com/
    
    Fixes: f5c7310ac73e ("init/main: add checks for the return value of memblock_alloc*()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure [+ + +]
Author: Alexey Izbyshev <izbyshev@ispras.ru>
Date:   Fri Apr 5 15:55:51 2024 +0300

    io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure
    
    Commit 978e5c19dfefc271e5550efba92fcef0d3f62864 upstream.
    
    This bug was introduced in commit 950e79dd7313 ("io_uring: minor
    io_cqring_wait() optimization"), which was made in preparation for
    adc8682ec690 ("io_uring: Add support for napi_busy_poll"). The latter
    got reverted in cb3182167325 ("Revert "io_uring: Add support for
    napi_busy_poll""), so simply undo the former as well.
    
    Cc: stable@vger.kernel.org
    Fixes: 950e79dd7313 ("io_uring: minor io_cqring_wait() optimization")
    Signed-off-by: Alexey Izbyshev <izbyshev@ispras.ru>
    Link: https://lore.kernel.org/r/20240405125551.237142-1-izbyshev@ispras.ru
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ksmbd: clear RENAME_NOREPLACE before calling vfs_rename [+ + +]
Author: Marios Makassikis <mmakassikis@freebox.fr>
Date:   Mon Apr 15 15:12:48 2024 +0200

    ksmbd: clear RENAME_NOREPLACE before calling vfs_rename
    
    commit 4973b04d3ea577db80c501c5f14e68ec69fe1794 upstream.
    
    File overwrite case is explicitly handled, so it is not necessary to
    pass RENAME_NOREPLACE to vfs_rename.
    
    Clearing the flag fixes rename operations when the share is a ntfs-3g
    mount. The latter uses an older version of fuse with no support for
    flags in the ->rename op.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: common: use struct_group_attr instead of struct_group for network_open_info [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Fri Apr 19 23:46:34 2024 +0900

    ksmbd: common: use struct_group_attr instead of struct_group for network_open_info
    
    commit 0268a7cc7fdc47d90b6c18859de7718d5059f6f1 upstream.
    
    4byte padding cause the connection issue with the applications of MacOS.
    smb2_close response size increases by 4 bytes by padding, And the smb
    client of MacOS check it and stop the connection. This patch use
    struct_group_attr instead of struct_group for network_open_info to use
     __packed to avoid padding.
    
    Fixes: 0015eb6e1238 ("smb: client, common: fix fortify warnings")
    Cc: stable@vger.kernel.org
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: fix slab-out-of-bounds in smb2_allocate_rsp_buf [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Thu Apr 11 23:02:15 2024 +0900

    ksmbd: fix slab-out-of-bounds in smb2_allocate_rsp_buf
    
    commit c119f4ede3fa90a9463f50831761c28f989bfb20 upstream.
    
    If ->ProtocolId is SMB2_TRANSFORM_PROTO_NUM, smb2 request size
    validation could be skipped. if request size is smaller than
    sizeof(struct smb2_query_info_req), slab-out-of-bounds read can happen in
    smb2_allocate_rsp_buf(). This patch allocate response buffer after
    decrypting transform request. smb3_decrypt_req() will validate transform
    request size and avoid slab-out-of-bound in smb2_allocate_rsp_buf().
    
    Reported-by: Norbert Szetei <norbert@doyensec.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: validate request buffer size in smb2_allocate_rsp_buf() [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Fri Apr 12 09:45:00 2024 +0900

    ksmbd: validate request buffer size in smb2_allocate_rsp_buf()
    
    commit 17cf0c2794bdb6f39671265aa18aea5c22ee8c4a upstream.
    
    The response buffer should be allocated in smb2_allocate_rsp_buf
    before validating request. But the fields in payload as well as smb2 header
    is used in smb2_allocate_rsp_buf(). This patch add simple buffer size
    validation to avoid potencial out-of-bounds in request buffer.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
KVM: x86/pmu: Disable support for adaptive PEBS [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Wed Mar 6 16:58:33 2024 -0800

    KVM: x86/pmu: Disable support for adaptive PEBS
    
    commit 9e985cbf2942a1bb8fcef9adc2a17d90fd7ca8ee upstream.
    
    Drop support for virtualizing adaptive PEBS, as KVM's implementation is
    architecturally broken without an obvious/easy path forward, and because
    exposing adaptive PEBS can leak host LBRs to the guest, i.e. can leak
    host kernel addresses to the guest.
    
    Bug #1 is that KVM doesn't account for the upper 32 bits of
    IA32_FIXED_CTR_CTRL when (re)programming fixed counters, e.g
    fixed_ctrl_field() drops the upper bits, reprogram_fixed_counters()
    stores local variables as u8s and truncates the upper bits too, etc.
    
    Bug #2 is that, because KVM _always_ sets precise_ip to a non-zero value
    for PEBS events, perf will _always_ generate an adaptive record, even if
    the guest requested a basic record.  Note, KVM will also enable adaptive
    PEBS in individual *counter*, even if adaptive PEBS isn't exposed to the
    guest, but this is benign as MSR_PEBS_DATA_CFG is guaranteed to be zero,
    i.e. the guest will only ever see Basic records.
    
    Bug #3 is in perf.  intel_pmu_disable_fixed() doesn't clear the upper
    bits either, i.e. leaves ICL_FIXED_0_ADAPTIVE set, and
    intel_pmu_enable_fixed() effectively doesn't clear ICL_FIXED_0_ADAPTIVE
    either.  I.e. perf _always_ enables ADAPTIVE counters, regardless of what
    KVM requests.
    
    Bug #4 is that adaptive PEBS *might* effectively bypass event filters set
    by the host, as "Updated Memory Access Info Group" records information
    that might be disallowed by userspace via KVM_SET_PMU_EVENT_FILTER.
    
    Bug #5 is that KVM doesn't ensure LBR MSRs hold guest values (or at least
    zeros) when entering a vCPU with adaptive PEBS, which allows the guest
    to read host LBRs, i.e. host RIPs/addresses, by enabling "LBR Entries"
    records.
    
    Disable adaptive PEBS support as an immediate fix due to the severity of
    the LBR leak in particular, and because fixing all of the bugs will be
    non-trivial, e.g. not suitable for backporting to stable kernels.
    
    Note!  This will break live migration, but trying to make KVM play nice
    with live migration would be quite complicated, wouldn't be guaranteed to
    work (i.e. KVM might still kill/confuse the guest), and it's not clear
    that there are any publicly available VMMs that support adaptive PEBS,
    let alone live migrate VMs that support adaptive PEBS, e.g. QEMU doesn't
    support PEBS in any capacity.
    
    Link: https://lore.kernel.org/all/20240306230153.786365-1-seanjc@google.com
    Link: https://lore.kernel.org/all/ZeepGjHCeSfadANM@google.com
    Fixes: c59a1f106f5c ("KVM: x86/pmu: Add IA32_PEBS_ENABLE MSR emulation for extended PEBS")
    Cc: stable@vger.kernel.org
    Cc: Like Xu <like.xu.linux@gmail.com>
    Cc: Mingwei Zhang <mizhang@google.com>
    Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
    Cc: Zhang Xiong <xiong.y.zhang@intel.com>
    Cc: Lv Zhiyuan <zhiyuan.lv@intel.com>
    Cc: Dapeng Mi <dapeng1.mi@intel.com>
    Cc: Jim Mattson <jmattson@google.com>
    Acked-by: Like Xu <likexu@tencent.com>
    Link: https://lore.kernel.org/r/20240307005833.827147-1-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86/pmu: Do not mask LVTPC when handling a PMI on AMD platforms [+ + +]
Author: Sandipan Das <sandipan.das@amd.com>
Date:   Fri Apr 5 16:55:55 2024 -0700

    KVM: x86/pmu: Do not mask LVTPC when handling a PMI on AMD platforms
    
    commit 49ff3b4aec51e3abfc9369997cc603319b02af9a upstream.
    
    On AMD and Hygon platforms, the local APIC does not automatically set
    the mask bit of the LVTPC register when handling a PMI and there is
    no need to clear it in the kernel's PMI handler.
    
    For guests, the mask bit is currently set by kvm_apic_local_deliver()
    and unless it is cleared by the guest kernel's PMI handler, PMIs stop
    arriving and break use-cases like sampling with perf record.
    
    This does not affect non-PerfMonV2 guests because PMIs are handled in
    the guest kernel by x86_pmu_handle_irq() which always clears the LVTPC
    mask bit irrespective of the vendor.
    
    Before:
    
      $ perf record -e cycles:u true
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.001 MB perf.data (1 samples) ]
    
    After:
    
      $ perf record -e cycles:u true
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.002 MB perf.data (19 samples) ]
    
    Fixes: a16eb25b09c0 ("KVM: x86: Mask LVTPC when handling a PMI")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sandipan Das <sandipan.das@amd.com>
    Reviewed-by: Jim Mattson <jmattson@google.com>
    [sean: use is_intel_compatible instead of !is_amd_or_hygon()]
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20240405235603.1173076-3-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: Snapshot if a vCPU's vendor model is AMD vs. Intel compatible [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri Apr 5 16:55:54 2024 -0700

    KVM: x86: Snapshot if a vCPU's vendor model is AMD vs. Intel compatible
    
    commit fd706c9b1674e2858766bfbf7430534c2b26fbef upstream.
    
    Add kvm_vcpu_arch.is_amd_compatible to cache if a vCPU's vendor model is
    compatible with AMD, i.e. if the vCPU vendor is AMD or Hygon, along with
    helpers to check if a vCPU is compatible AMD vs. Intel.  To handle Intel
    vs. AMD behavior related to masking the LVTPC entry, KVM will need to
    check for vendor compatibility on every PMI injection, i.e. querying for
    AMD will soon be a moderately hot path.
    
    Note!  This subtly (or maybe not-so-subtly) makes "Intel compatible" KVM's
    default behavior, both if userspace omits (or never sets) CPUID 0x0 and if
    userspace sets a completely unknown vendor.  One could argue that KVM
    should treat such vCPUs as not being compatible with Intel *or* AMD, but
    that would add useless complexity to KVM.
    
    KVM needs to do *something* in the face of vendor specific behavior, and
    so unless KVM conjured up a magic third option, choosing to treat unknown
    vendors as neither Intel nor AMD means that checks on AMD compatibility
    would yield Intel behavior, and checks for Intel compatibility would yield
    AMD behavior.  And that's far worse as it would effectively yield random
    behavior depending on whether KVM checked for AMD vs. Intel vs. !AMD vs.
    !Intel.  And practically speaking, all x86 CPUs follow either Intel or AMD
    architecture, i.e. "supporting" an unknown third architecture adds no
    value.
    
    Deliberately don't convert any of the existing guest_cpuid_is_intel()
    checks, as the Intel side of things is messier due to some flows explicitly
    checking for exactly vendor==Intel, versus some flows assuming anything
    that isn't "AMD compatible" gets Intel behavior.  The Intel code will be
    cleaned up in the future.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20240405235603.1173076-2-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 6.1.88 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sat Apr 27 17:07:18 2024 +0200

    Linux 6.1.88
    
    Link: https://lore.kernel.org/r/20240423213853.356988651@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Yann Sionneau <ysionneau@kalrayinc.com>
    Tested-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
    Tested-by: kernelci.org bot <bot@kernelci.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mei: me: disable RPL-S on SPS and IGN firmwares [+ + +]
Author: Alexander Usyskin <alexander.usyskin@intel.com>
Date:   Tue Mar 12 07:19:58 2024 +0200

    mei: me: disable RPL-S on SPS and IGN firmwares
    
    commit 0dc04112bee6fdd6eb847ccb32214703022c0269 upstream.
    
    Extend the quirk to disable MEI interface on Intel PCH Ignition (IGN)
    and SPS firmwares for RPL-S devices. These firmwares do not support
    the MEI protocol.
    
    Fixes: 3ed8c7d39cfe ("mei: me: add raptor lake point S DID")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
    Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
    Link: https://lore.kernel.org/r/20240312051958.118478-1-tomas.winkler@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/memory-failure: fix deadlock when hugetlb_optimize_vmemmap is enabled [+ + +]
Author: Miaohe Lin <linmiaohe@huawei.com>
Date:   Sun Apr 7 16:54:56 2024 +0800

    mm/memory-failure: fix deadlock when hugetlb_optimize_vmemmap is enabled
    
    commit 1983184c22dd84a4d95a71e5c6775c2638557dc7 upstream.
    
    When I did hard offline test with hugetlb pages, below deadlock occurs:
    
    ======================================================
    WARNING: possible circular locking dependency detected
    6.8.0-11409-gf6cef5f8c37f #1 Not tainted
    ------------------------------------------------------
    bash/46904 is trying to acquire lock:
    ffffffffabe68910 (cpu_hotplug_lock){++++}-{0:0}, at: static_key_slow_dec+0x16/0x60
    
    but task is already holding lock:
    ffffffffabf92ea8 (pcp_batch_high_lock){+.+.}-{3:3}, at: zone_pcp_disable+0x16/0x40
    
    which lock already depends on the new lock.
    
    the existing dependency chain (in reverse order) is:
    
    -> #1 (pcp_batch_high_lock){+.+.}-{3:3}:
           __mutex_lock+0x6c/0x770
           page_alloc_cpu_online+0x3c/0x70
           cpuhp_invoke_callback+0x397/0x5f0
           __cpuhp_invoke_callback_range+0x71/0xe0
           _cpu_up+0xeb/0x210
           cpu_up+0x91/0xe0
           cpuhp_bringup_mask+0x49/0xb0
           bringup_nonboot_cpus+0xb7/0xe0
           smp_init+0x25/0xa0
           kernel_init_freeable+0x15f/0x3e0
           kernel_init+0x15/0x1b0
           ret_from_fork+0x2f/0x50
           ret_from_fork_asm+0x1a/0x30
    
    -> #0 (cpu_hotplug_lock){++++}-{0:0}:
           __lock_acquire+0x1298/0x1cd0
           lock_acquire+0xc0/0x2b0
           cpus_read_lock+0x2a/0xc0
           static_key_slow_dec+0x16/0x60
           __hugetlb_vmemmap_restore_folio+0x1b9/0x200
           dissolve_free_huge_page+0x211/0x260
           __page_handle_poison+0x45/0xc0
           memory_failure+0x65e/0xc70
           hard_offline_page_store+0x55/0xa0
           kernfs_fop_write_iter+0x12c/0x1d0
           vfs_write+0x387/0x550
           ksys_write+0x64/0xe0
           do_syscall_64+0xca/0x1e0
           entry_SYSCALL_64_after_hwframe+0x6d/0x75
    
    other info that might help us debug this:
    
     Possible unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(pcp_batch_high_lock);
                                   lock(cpu_hotplug_lock);
                                   lock(pcp_batch_high_lock);
      rlock(cpu_hotplug_lock);
    
     *** DEADLOCK ***
    
    5 locks held by bash/46904:
     #0: ffff98f6c3bb23f0 (sb_writers#5){.+.+}-{0:0}, at: ksys_write+0x64/0xe0
     #1: ffff98f6c328e488 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0xf8/0x1d0
     #2: ffff98ef83b31890 (kn->active#113){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x100/0x1d0
     #3: ffffffffabf9db48 (mf_mutex){+.+.}-{3:3}, at: memory_failure+0x44/0xc70
     #4: ffffffffabf92ea8 (pcp_batch_high_lock){+.+.}-{3:3}, at: zone_pcp_disable+0x16/0x40
    
    stack backtrace:
    CPU: 10 PID: 46904 Comm: bash Kdump: loaded Not tainted 6.8.0-11409-gf6cef5f8c37f #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0x68/0xa0
     check_noncircular+0x129/0x140
     __lock_acquire+0x1298/0x1cd0
     lock_acquire+0xc0/0x2b0
     cpus_read_lock+0x2a/0xc0
     static_key_slow_dec+0x16/0x60
     __hugetlb_vmemmap_restore_folio+0x1b9/0x200
     dissolve_free_huge_page+0x211/0x260
     __page_handle_poison+0x45/0xc0
     memory_failure+0x65e/0xc70
     hard_offline_page_store+0x55/0xa0
     kernfs_fop_write_iter+0x12c/0x1d0
     vfs_write+0x387/0x550
     ksys_write+0x64/0xe0
     do_syscall_64+0xca/0x1e0
     entry_SYSCALL_64_after_hwframe+0x6d/0x75
    RIP: 0033:0x7fc862314887
    Code: 10 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
    RSP: 002b:00007fff19311268 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fc862314887
    RDX: 000000000000000c RSI: 000056405645fe10 RDI: 0000000000000001
    RBP: 000056405645fe10 R08: 00007fc8623d1460 R09: 000000007fffffff
    R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000000c
    R13: 00007fc86241b780 R14: 00007fc862417600 R15: 00007fc862416a00
    
    In short, below scene breaks the lock dependency chain:
    
     memory_failure
      __page_handle_poison
       zone_pcp_disable -- lock(pcp_batch_high_lock)
       dissolve_free_huge_page
        __hugetlb_vmemmap_restore_folio
         static_key_slow_dec
          cpus_read_lock -- rlock(cpu_hotplug_lock)
    
    Fix this by calling drain_all_pages() instead.
    
    This issue won't occur until commit a6b40850c442 ("mm: hugetlb: replace
    hugetlb_free_vmemmap_enabled with a static_key").  As it introduced
    rlock(cpu_hotplug_lock) in dissolve_free_huge_page() code path while
    lock(pcp_batch_high_lock) is already in the __page_handle_poison().
    
    [linmiaohe@huawei.com: extend comment per Oscar]
    [akpm@linux-foundation.org: reflow block comment]
    Link: https://lkml.kernel.org/r/20240407085456.2798193-1-linmiaohe@huawei.com
    Fixes: a6b40850c442 ("mm: hugetlb: replace hugetlb_free_vmemmap_enabled with a static_key")
    Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
    Acked-by: Oscar Salvador <osalvador@suse.de>
    Reviewed-by: Jane Chu <jane.chu@oracle.com>
    Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/mlx5: Lag, restore buckets number to default after hash LAG deactivation [+ + +]
Author: Shay Drory <shayd@nvidia.com>
Date:   Thu Apr 11 14:54:39 2024 +0300

    net/mlx5: Lag, restore buckets number to default after hash LAG deactivation
    
    [ Upstream commit 37cc10da3a50e6d0cb9808a90b7da9b4868794dd ]
    
    The cited patch introduces the concept of buckets in LAG in hash mode.
    However, the patch doesn't clear the number of buckets in the LAG
    deactivation. This results in using the wrong number of buckets in
    case user create a hash mode LAG and afterwards create a non-hash
    mode LAG.
    
    Hence, restore buckets number to default after hash mode LAG
    deactivation.
    
    Fixes: 352899f384d4 ("net/mlx5: Lag, use buckets in hash mode")
    Signed-off-by: Shay Drory <shayd@nvidia.com>
    Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
    Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
    Link: https://lore.kernel.org/r/20240411115444.374475-2-tariqt@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/mlx5e: Prevent deadlock while disabling aRFS [+ + +]
Author: Carolina Jubran <cjubran@nvidia.com>
Date:   Thu Apr 11 14:54:44 2024 +0300

    net/mlx5e: Prevent deadlock while disabling aRFS
    
    [ Upstream commit fef965764cf562f28afb997b626fc7c3cec99693 ]
    
    When disabling aRFS under the `priv->state_lock`, any scheduled
    aRFS works are canceled using the `cancel_work_sync` function,
    which waits for the work to end if it has already started.
    However, while waiting for the work handler, the handler will
    try to acquire the `state_lock` which is already acquired.
    
    The worker acquires the lock to delete the rules if the state
    is down, which is not the worker's responsibility since
    disabling aRFS deletes the rules.
    
    Add an aRFS state variable, which indicates whether the aRFS is
    enabled and prevent adding rules when the aRFS is disabled.
    
    Kernel log:
    
    ======================================================
    WARNING: possible circular locking dependency detected
    6.7.0-rc4_net_next_mlx5_5483eb2 #1 Tainted: G          I
    ------------------------------------------------------
    ethtool/386089 is trying to acquire lock:
    ffff88810f21ce68 ((work_completion)(&rule->arfs_work)){+.+.}-{0:0}, at: __flush_work+0x74/0x4e0
    
    but task is already holding lock:
    ffff8884a1808cc0 (&priv->state_lock){+.+.}-{3:3}, at: mlx5e_ethtool_set_channels+0x53/0x200 [mlx5_core]
    
    which lock already depends on the new lock.
    
    the existing dependency chain (in reverse order) is:
    
    -> #1 (&priv->state_lock){+.+.}-{3:3}:
           __mutex_lock+0x80/0xc90
           arfs_handle_work+0x4b/0x3b0 [mlx5_core]
           process_one_work+0x1dc/0x4a0
           worker_thread+0x1bf/0x3c0
           kthread+0xd7/0x100
           ret_from_fork+0x2d/0x50
           ret_from_fork_asm+0x11/0x20
    
    -> #0 ((work_completion)(&rule->arfs_work)){+.+.}-{0:0}:
           __lock_acquire+0x17b4/0x2c80
           lock_acquire+0xd0/0x2b0
           __flush_work+0x7a/0x4e0
           __cancel_work_timer+0x131/0x1c0
           arfs_del_rules+0x143/0x1e0 [mlx5_core]
           mlx5e_arfs_disable+0x1b/0x30 [mlx5_core]
           mlx5e_ethtool_set_channels+0xcb/0x200 [mlx5_core]
           ethnl_set_channels+0x28f/0x3b0
           ethnl_default_set_doit+0xec/0x240
           genl_family_rcv_msg_doit+0xd0/0x120
           genl_rcv_msg+0x188/0x2c0
           netlink_rcv_skb+0x54/0x100
           genl_rcv+0x24/0x40
           netlink_unicast+0x1a1/0x270
           netlink_sendmsg+0x214/0x460
           __sock_sendmsg+0x38/0x60
           __sys_sendto+0x113/0x170
           __x64_sys_sendto+0x20/0x30
           do_syscall_64+0x40/0xe0
           entry_SYSCALL_64_after_hwframe+0x46/0x4e
    
    other info that might help us debug this:
    
     Possible unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(&priv->state_lock);
                                   lock((work_completion)(&rule->arfs_work));
                                   lock(&priv->state_lock);
      lock((work_completion)(&rule->arfs_work));
    
     *** DEADLOCK ***
    
    3 locks held by ethtool/386089:
     #0: ffffffff82ea7210 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40
     #1: ffffffff82e94c88 (rtnl_mutex){+.+.}-{3:3}, at: ethnl_default_set_doit+0xd3/0x240
     #2: ffff8884a1808cc0 (&priv->state_lock){+.+.}-{3:3}, at: mlx5e_ethtool_set_channels+0x53/0x200 [mlx5_core]
    
    stack backtrace:
    CPU: 15 PID: 386089 Comm: ethtool Tainted: G          I        6.7.0-rc4_net_next_mlx5_5483eb2 #1
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0x60/0xa0
     check_noncircular+0x144/0x160
     __lock_acquire+0x17b4/0x2c80
     lock_acquire+0xd0/0x2b0
     ? __flush_work+0x74/0x4e0
     ? save_trace+0x3e/0x360
     ? __flush_work+0x74/0x4e0
     __flush_work+0x7a/0x4e0
     ? __flush_work+0x74/0x4e0
     ? __lock_acquire+0xa78/0x2c80
     ? lock_acquire+0xd0/0x2b0
     ? mark_held_locks+0x49/0x70
     __cancel_work_timer+0x131/0x1c0
     ? mark_held_locks+0x49/0x70
     arfs_del_rules+0x143/0x1e0 [mlx5_core]
     mlx5e_arfs_disable+0x1b/0x30 [mlx5_core]
     mlx5e_ethtool_set_channels+0xcb/0x200 [mlx5_core]
     ethnl_set_channels+0x28f/0x3b0
     ethnl_default_set_doit+0xec/0x240
     genl_family_rcv_msg_doit+0xd0/0x120
     genl_rcv_msg+0x188/0x2c0
     ? ethnl_ops_begin+0xb0/0xb0
     ? genl_family_rcv_msg_dumpit+0xf0/0xf0
     netlink_rcv_skb+0x54/0x100
     genl_rcv+0x24/0x40
     netlink_unicast+0x1a1/0x270
     netlink_sendmsg+0x214/0x460
     __sock_sendmsg+0x38/0x60
     __sys_sendto+0x113/0x170
     ? do_user_addr_fault+0x53f/0x8f0
     __x64_sys_sendto+0x20/0x30
     do_syscall_64+0x40/0xe0
     entry_SYSCALL_64_after_hwframe+0x46/0x4e
     </TASK>
    
    Fixes: 45bf454ae884 ("net/mlx5e: Enabling aRFS mechanism")
    Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
    Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
    Link: https://lore.kernel.org/r/20240411115444.374475-7-tariqt@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: dsa: introduce preferred_default_local_cpu_port and use on MT7530 [+ + +]
Author: Vladimir Oltean <olteanv@gmail.com>
Date:   Sat Jun 17 09:26:48 2023 +0300

    net: dsa: introduce preferred_default_local_cpu_port and use on MT7530
    
    commit b79d7c14f48083abb3fb061370c0c64a569edf4c upstream.
    
    Since the introduction of the OF bindings, DSA has always had a policy that
    in case multiple CPU ports are present in the device tree, the numerically
    smallest one is always chosen.
    
    The MT7530 switch family, except the switch on the MT7988 SoC, has 2 CPU
    ports, 5 and 6, where port 6 is preferable on the MT7531BE switch because
    it has higher bandwidth.
    
    The MT7530 driver developers had 3 options:
    - to modify DSA when the MT7531 switch support was introduced, such as to
      prefer the better port
    - to declare both CPU ports in device trees as CPU ports, and live with the
      sub-optimal performance resulting from not preferring the better port
    - to declare just port 6 in the device tree as a CPU port
    
    Of course they chose the path of least resistance (3rd option), kicking the
    can down the road. The hardware description in the device tree is supposed
    to be stable - developers are not supposed to adopt the strategy of
    piecemeal hardware description, where the device tree is updated in
    lockstep with the features that the kernel currently supports.
    
    Now, as a result of the fact that they did that, any attempts to modify the
    device tree and describe both CPU ports as CPU ports would make DSA change
    its default selection from port 6 to 5, effectively resulting in a
    performance degradation visible to users with the MT7531BE switch as can be
    seen below.
    
    Without preferring port 6:
    
    [ ID][Role] Interval           Transfer     Bitrate         Retr
    [  5][TX-C]   0.00-20.00  sec   374 MBytes   157 Mbits/sec  734    sender
    [  5][TX-C]   0.00-20.00  sec   373 MBytes   156 Mbits/sec    receiver
    [  7][RX-C]   0.00-20.00  sec  1.81 GBytes   778 Mbits/sec    0    sender
    [  7][RX-C]   0.00-20.00  sec  1.81 GBytes   777 Mbits/sec    receiver
    
    With preferring port 6:
    
    [ ID][Role] Interval           Transfer     Bitrate         Retr
    [  5][TX-C]   0.00-20.00  sec  1.99 GBytes   856 Mbits/sec  273    sender
    [  5][TX-C]   0.00-20.00  sec  1.99 GBytes   855 Mbits/sec    receiver
    [  7][RX-C]   0.00-20.00  sec  1.72 GBytes   737 Mbits/sec   15    sender
    [  7][RX-C]   0.00-20.00  sec  1.71 GBytes   736 Mbits/sec    receiver
    
    Using one port for WAN and the other ports for LAN is a very popular use
    case which is what this test emulates.
    
    As such, this change proposes that we retroactively modify stable kernels
    (which don't support the modification of the CPU port assignments, so as to
    let user space fix the problem and restore the throughput) to keep the
    mt7530 driver preferring port 6 even with device trees where the hardware
    is more fully described.
    
    Fixes: c288575f7810 ("net: dsa: mt7530: Add the support of MT7531 switch")
    Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
    Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: dsa: mt7530: fix enabling EEE on MT7531 switch on all boards [+ + +]
Author: Arınç ÜNAL <arinc.unal@arinc9.com>
Date:   Mon Apr 8 10:08:53 2024 +0300

    net: dsa: mt7530: fix enabling EEE on MT7531 switch on all boards
    
    commit 06dfcd4098cfdc4d4577d94793a4f9125386da8b upstream.
    
    The commit 40b5d2f15c09 ("net: dsa: mt7530: Add support for EEE features")
    brought EEE support but did not enable EEE on MT7531 switch MACs. EEE is
    enabled on MT7531 switch MACs by pulling the LAN2LED0 pin low on the board
    (bootstrapping), unsetting the EEE_DIS bit on the trap register, or setting
    the internal EEE switch bit on the CORE_PLL_GROUP4 register. Thanks to
    SkyLake Huang (黃啟澤) from MediaTek for providing information on the
    internal EEE switch bit.
    
    There are existing boards that were not designed to pull the pin low.
    Because of that, the EEE status currently depends on the board design.
    
    The EEE_DIS bit on the trap pertains to the LAN2LED0 pin which is usually
    used to control an LED. Once the bit is unset, the pin will be low. That
    will make the active low LED turn on. The pin is controlled by the switch
    PHY. It seems that the PHY controls the pin in the way that it inverts the
    pin state. That means depending on the wiring of the LED connected to
    LAN2LED0 on the board, the LED may be on without an active link.
    
    To not cause this unwanted behaviour whilst enabling EEE on all boards, set
    the internal EEE switch bit on the CORE_PLL_GROUP4 register.
    
    My testing on MT7531 shows a certain amount of traffic loss when EEE is
    enabled. That said, I haven't come across a board that enables EEE. So
    enable EEE on the switch MACs but disable EEE advertisement on the switch
    PHYs. This way, we don't change the behaviour of the majority of the boards
    that have this switch. The mediatek-ge PHY driver already disables EEE
    advertisement on the switch PHYs but my testing shows that it is somehow
    enabled afterwards. Disabling EEE advertisement before the PHY driver
    initialises keeps it off.
    
    With this change, EEE can now be enabled using ethtool.
    
    Fixes: 40b5d2f15c09 ("net: dsa: mt7530: Add support for EEE features")
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
    Tested-by: Daniel Golle <daniel@makrotopia.org>
    Reviewed-by: Daniel Golle <daniel@makrotopia.org>
    Link: https://lore.kernel.org/r/20240408-for-net-mt7530-fix-eee-for-mt7531-mt7988-v3-1-84fdef1f008b@arinc9.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: dsa: mt7530: fix improper frames on all 25MHz and 40MHz XTAL MT7530 [+ + +]
Author: Arınç ÜNAL <arinc.unal@arinc9.com>
Date:   Wed Mar 20 23:45:30 2024 +0300

    net: dsa: mt7530: fix improper frames on all 25MHz and 40MHz XTAL MT7530
    
    commit 5f563c31ff0c40ce395d0bae7daa94c7950dac97 upstream.
    
    The MT7530 switch after reset initialises with a core clock frequency that
    works with a 25MHz XTAL connected to it. For 40MHz XTAL, the core clock
    frequency must be set to 500MHz.
    
    The mt7530_pll_setup() function is responsible of setting the core clock
    frequency. Currently, it runs on MT7530 with 25MHz and 40MHz XTAL. This
    causes MT7530 switch with 25MHz XTAL to egress and ingress frames
    improperly.
    
    Introduce a check to run it only on MT7530 with 40MHz XTAL.
    
    The core clock frequency is set by writing to a switch PHY's register.
    Access to the PHY's register is done via the MDIO bus the switch is also
    on. Therefore, it works only when the switch makes switch PHYs listen on
    the MDIO bus the switch is on. This is controlled either by the state of
    the ESW_P1_LED_1 pin after reset deassertion or modifying bit 5 of the
    modifiable trap register.
    
    When ESW_P1_LED_1 is pulled high, PHY indirect access is used. That means
    accessing PHY registers via the PHY indirect access control register of the
    switch.
    
    When ESW_P1_LED_1 is pulled low, PHY direct access is used. That means
    accessing PHY registers via the MDIO bus the switch is on.
    
    For MT7530 switch with 40MHz XTAL on a board with ESW_P1_LED_1 pulled high,
    the core clock frequency won't be set to 500MHz, causing the switch to
    egress and ingress frames improperly.
    
    Run mt7530_pll_setup() after PHY direct access is set on the modifiable
    trap register.
    
    With these two changes, all MT7530 switches with 25MHz and 40MHz, and
    P1_LED_1 pulled high or low, will egress and ingress frames properly.
    
    Link: https://github.com/BPI-SINOVOIP/BPI-R2-bsp/blob/4a5dd143f2172ec97a2872fa29c7c4cd520f45b5/linux-mt/drivers/net/ethernet/mediatek/gsw_mt7623.c#L1039
    Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
    Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
    Link: https://lore.kernel.org/r/20240320-for-net-mt7530-fix-25mhz-xtal-with-direct-phy-access-v1-1-d92f605f1160@arinc9.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: dsa: mt7530: fix mirroring frames received on local port [+ + +]
Author: Arınç ÜNAL <arinc.unal@arinc9.com>
Date:   Sat Apr 13 16:01:39 2024 +0300

    net: dsa: mt7530: fix mirroring frames received on local port
    
    [ Upstream commit d59cf049c8378677053703e724808836f180888e ]
    
    This switch intellectual property provides a bit on the ARL global control
    register which controls allowing mirroring frames which are received on the
    local port (monitor port). This bit is unset after reset.
    
    This ability must be enabled to fully support the port mirroring feature on
    this switch intellectual property.
    
    Therefore, this patch fixes the traffic not being reflected on a port,
    which would be configured like below:
    
      tc qdisc add dev swp0 clsact
    
      tc filter add dev swp0 ingress matchall skip_sw \
      action mirred egress mirror dev swp0
    
    As a side note, this configuration provides the hairpinning feature for a
    single port.
    
    Fixes: 37feab6076aa ("net: dsa: mt7530: add support for port mirroring")
    Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dsa: mt7530: set all CPU ports in MT7531_CPU_PMAP [+ + +]
Author: Arınç ÜNAL <arinc.unal@arinc9.com>
Date:   Sat Jun 17 09:26:44 2023 +0300

    net: dsa: mt7530: set all CPU ports in MT7531_CPU_PMAP
    
    commit ff221029a51fd54cacac66e193e0c75e4de940e7 upstream.
    
    MT7531_CPU_PMAP represents the destination port mask for trapped-to-CPU
    frames (further restricted by PCR_MATRIX).
    
    Currently the driver sets the first CPU port as the single port in this bit
    mask, which works fine regardless of whether the device tree defines port
    5, 6 or 5+6 as CPU ports. This is because the logic coincides with DSA's
    logic of picking the first CPU port as the CPU port that all user ports are
    affine to, by default.
    
    An upcoming change would like to influence DSA's selection of the default
    CPU port to no longer be the first one, and in that case, this logic needs
    adaptation.
    
    Since there is no observed leakage or duplication of frames if all CPU
    ports are defined in this bit mask, simply include them all.
    
    Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
    Suggested-by: Vladimir Oltean <olteanv@gmail.com>
    Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
    Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: ethernet: ti: am65-cpsw-nuss: cleanup DMA Channels before using them [+ + +]
Author: Siddharth Vadapalli <s-vadapalli@ti.com>
Date:   Wed Apr 17 15:24:25 2024 +0530

    net: ethernet: ti: am65-cpsw-nuss: cleanup DMA Channels before using them
    
    [ Upstream commit c24cd679b075b0e953ea167b0aa2b2d59e4eba7f ]
    
    The TX and RX DMA Channels used by the driver to exchange data with CPSW
    are not guaranteed to be in a clean state during driver initialization.
    The Bootloader could have used the same DMA Channels without cleaning them
    up in the event of failure. Thus, reset and disable the DMA Channels to
    ensure that they are in a clean state before using them.
    
    Fixes: 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver")
    Reported-by: Schuyler Patton <spatton@ti.com>
    Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
    Reviewed-by: Roger Quadros <rogerq@kernel.org>
    Link: https://lore.kernel.org/r/20240417095425.2253876-1-s-vadapalli@ti.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: usb: ax88179_178a: avoid writing the mac address before first reading [+ + +]
Author: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Date:   Wed Apr 17 10:55:13 2024 +0200

    net: usb: ax88179_178a: avoid writing the mac address before first reading
    
    commit 56f78615bcb1c3ba58a5d9911bad3d9185cf141b upstream.
    
    After the commit d2689b6a86b9 ("net: usb: ax88179_178a: avoid two
    consecutive device resets"), reset operation, in which the default mac
    address from the device is read, is not executed from bind operation and
    the random address, that is pregenerated just in case, is direclty written
    the first time in the device, so the default one from the device is not
    even read. This writing is not dangerous because is volatile and the
    default mac address is not missed.
    
    In order to avoid this and keep the simplification to have only one
    reset and reduce the delays, restore the reset from bind operation and
    remove the reset that is commanded from open operation. The behavior is
    the same but everything is ready for usbnet_probe.
    
    Tested with ASIX AX88179 USB Gigabit Ethernet devices.
    Restore the old behavior for the rest of possible devices because I don't
    have the hardware to test.
    
    cc: stable@vger.kernel.org # 6.6+
    Fixes: d2689b6a86b9 ("net: usb: ax88179_178a: avoid two consecutive device resets")
    Reported-by: Jarkko Palviainen <jarkko.palviainen@gmail.com>
    Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
    Link: https://lore.kernel.org/r/20240417085524.219532-1-jtornosm@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
netfilter: br_netfilter: skip conntrack input hook for promisc packets [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue Apr 9 11:24:59 2024 +0200

    netfilter: br_netfilter: skip conntrack input hook for promisc packets
    
    [ Upstream commit 751de2012eafa4d46d8081056761fa0e9cc8a178 ]
    
    For historical reasons, when bridge device is in promisc mode, packets
    that are directed to the taps follow bridge input hook path. This patch
    adds a workaround to reset conntrack for these packets.
    
    Jianbo Liu reports warning splats in their test infrastructure where
    cloned packets reach the br_netfilter input hook to confirm the
    conntrack object.
    
    Scratch one bit from BR_INPUT_SKB_CB to annotate that this packet has
    reached the input hook because it is passed up to the bridge device to
    reach the taps.
    
    [   57.571874] WARNING: CPU: 1 PID: 0 at net/bridge/br_netfilter_hooks.c:616 br_nf_local_in+0x157/0x180 [br_netfilter]
    [   57.572749] Modules linked in: xt_MASQUERADE nf_conntrack_netlink nfnetlink iptable_nat xt_addrtype xt_conntrack nf_nat br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_isc si ib_umad rdma_cm ib_ipoib iw_cm ib_cm mlx5_ib ib_uverbs ib_core mlx5ctl mlx5_core
    [   57.575158] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.8.0+ #19
    [   57.575700] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
    [   57.576662] RIP: 0010:br_nf_local_in+0x157/0x180 [br_netfilter]
    [   57.577195] Code: fe ff ff 41 bd 04 00 00 00 be 04 00 00 00 e9 4a ff ff ff be 04 00 00 00 48 89 ef e8 f3 a9 3c e1 66 83 ad b4 00 00 00 04 eb 91 <0f> 0b e9 f1 fe ff ff 0f 0b e9 df fe ff ff 48 89 df e8 b3 53 47 e1
    [   57.578722] RSP: 0018:ffff88885f845a08 EFLAGS: 00010202
    [   57.579207] RAX: 0000000000000002 RBX: ffff88812dfe8000 RCX: 0000000000000000
    [   57.579830] RDX: ffff88885f845a60 RSI: ffff8881022dc300 RDI: 0000000000000000
    [   57.580454] RBP: ffff88885f845a60 R08: 0000000000000001 R09: 0000000000000003
    [   57.581076] R10: 00000000ffff1300 R11: 0000000000000002 R12: 0000000000000000
    [   57.581695] R13: ffff8881047ffe00 R14: ffff888108dbee00 R15: ffff88814519b800
    [   57.582313] FS:  0000000000000000(0000) GS:ffff88885f840000(0000) knlGS:0000000000000000
    [   57.583040] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [   57.583564] CR2: 000000c4206aa000 CR3: 0000000103847001 CR4: 0000000000370eb0
    [   57.584194] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
    0000000000000000
    [   57.584820] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
    0000000000000400
    [   57.585440] Call Trace:
    [   57.585721]  <IRQ>
    [   57.585976]  ? __warn+0x7d/0x130
    [   57.586323]  ? br_nf_local_in+0x157/0x180 [br_netfilter]
    [   57.586811]  ? report_bug+0xf1/0x1c0
    [   57.587177]  ? handle_bug+0x3f/0x70
    [   57.587539]  ? exc_invalid_op+0x13/0x60
    [   57.587929]  ? asm_exc_invalid_op+0x16/0x20
    [   57.588336]  ? br_nf_local_in+0x157/0x180 [br_netfilter]
    [   57.588825]  nf_hook_slow+0x3d/0xd0
    [   57.589188]  ? br_handle_vlan+0x4b/0x110
    [   57.589579]  br_pass_frame_up+0xfc/0x150
    [   57.589970]  ? br_port_flags_change+0x40/0x40
    [   57.590396]  br_handle_frame_finish+0x346/0x5e0
    [   57.590837]  ? ipt_do_table+0x32e/0x430
    [   57.591221]  ? br_handle_local_finish+0x20/0x20
    [   57.591656]  br_nf_hook_thresh+0x4b/0xf0 [br_netfilter]
    [   57.592286]  ? br_handle_local_finish+0x20/0x20
    [   57.592802]  br_nf_pre_routing_finish+0x178/0x480 [br_netfilter]
    [   57.593348]  ? br_handle_local_finish+0x20/0x20
    [   57.593782]  ? nf_nat_ipv4_pre_routing+0x25/0x60 [nf_nat]
    [   57.594279]  br_nf_pre_routing+0x24c/0x550 [br_netfilter]
    [   57.594780]  ? br_nf_hook_thresh+0xf0/0xf0 [br_netfilter]
    [   57.595280]  br_handle_frame+0x1f3/0x3d0
    [   57.595676]  ? br_handle_local_finish+0x20/0x20
    [   57.596118]  ? br_handle_frame_finish+0x5e0/0x5e0
    [   57.596566]  __netif_receive_skb_core+0x25b/0xfc0
    [   57.597017]  ? __napi_build_skb+0x37/0x40
    [   57.597418]  __netif_receive_skb_list_core+0xfb/0x220
    
    Fixes: 62e7151ae3eb ("netfilter: bridge: confirm multicast packets before passing them up the stack")
    Reported-by: Jianbo Liu <jianbol@nvidia.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: flowtable: incorrect pppoe tuple [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Thu Apr 11 00:09:00 2024 +0200

    netfilter: flowtable: incorrect pppoe tuple
    
    [ Upstream commit 6db5dc7b351b9569940cd1cf445e237c42cd6d27 ]
    
    pppoe traffic reaching ingress path does not match the flowtable entry
    because the pppoe header is expected to be at the network header offset.
    This bug causes a mismatch in the flow table lookup, so pppoe packets
    enter the classical forwarding path.
    
    Fixes: 72efd585f714 ("netfilter: flowtable: add pppoe support")
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: flowtable: validate pppoe header [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue Apr 9 13:47:33 2024 +0200

    netfilter: flowtable: validate pppoe header
    
    [ Upstream commit 87b3593bed1868b2d9fe096c01bcdf0ea86cbebf ]
    
    Ensure there is sufficient room to access the protocol field of the
    PPPoe header. Validate it once before the flowtable lookup, then use a
    helper function to access protocol field.
    
    Reported-by: syzbot+b6f07e1c07ef40199081@syzkaller.appspotmail.com
    Fixes: 72efd585f714 ("netfilter: flowtable: add pppoe support")
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_tables: Fix potential data-race in __nft_expr_type_get() [+ + +]
Author: Ziyang Xuan <william.xuanziyang@huawei.com>
Date:   Sun Apr 7 14:56:04 2024 +0800

    netfilter: nf_tables: Fix potential data-race in __nft_expr_type_get()
    
    [ Upstream commit f969eb84ce482331a991079ab7a5c4dc3b7f89bf ]
    
    nft_unregister_expr() can concurrent with __nft_expr_type_get(),
    and there is not any protection when iterate over nf_tables_expressions
    list in __nft_expr_type_get(). Therefore, there is potential data-race
    of nf_tables_expressions list entry.
    
    Use list_for_each_entry_rcu() to iterate over nf_tables_expressions
    list in __nft_expr_type_get(), and use rcu_read_lock() in the caller
    nft_expr_type_get() to protect the entire type query process.
    
    Fixes: ef1f7df9170d ("netfilter: nf_tables: expression ops overloading")
    Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_tables: Fix potential data-race in __nft_obj_type_get() [+ + +]
Author: Ziyang Xuan <william.xuanziyang@huawei.com>
Date:   Sun Apr 7 14:56:05 2024 +0800

    netfilter: nf_tables: Fix potential data-race in __nft_obj_type_get()
    
    [ Upstream commit d78d867dcea69c328db30df665be5be7d0148484 ]
    
    nft_unregister_obj() can concurrent with __nft_obj_type_get(),
    and there is not any protection when iterate over nf_tables_objects
    list in __nft_obj_type_get(). Therefore, there is potential data-race
    of nf_tables_objects list entry.
    
    Use list_for_each_entry_rcu() to iterate over nf_tables_objects
    list in __nft_obj_type_get(), and use rcu_read_lock() in the caller
    nft_obj_type_get() to protect the entire type query process.
    
    Fixes: e50092404c1b ("netfilter: nf_tables: add stateful objects")
    Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nft_set_pipapo: do not free live element [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Wed Apr 10 21:05:13 2024 +0200

    netfilter: nft_set_pipapo: do not free live element
    
    [ Upstream commit 3cfc9ec039af60dbd8965ae085b2c2ccdcfbe1cc ]
    
    Pablo reports a crash with large batches of elements with a
    back-to-back add/remove pattern.  Quoting Pablo:
    
      add_elem("00000000") timeout 100 ms
      ...
      add_elem("0000000X") timeout 100 ms
      del_elem("0000000X") <---------------- delete one that was just added
      ...
      add_elem("00005000") timeout 100 ms
    
      1) nft_pipapo_remove() removes element 0000000X
      Then, KASAN shows a splat.
    
    Looking at the remove function there is a chance that we will drop a
    rule that maps to a non-deactivated element.
    
    Removal happens in two steps, first we do a lookup for key k and return the
    to-be-removed element and mark it as inactive in the next generation.
    Then, in a second step, the element gets removed from the set/map.
    
    The _remove function does not work correctly if we have more than one
    element that share the same key.
    
    This can happen if we insert an element into a set when the set already
    holds an element with same key, but the element mapping to the existing
    key has timed out or is not active in the next generation.
    
    In such case its possible that removal will unmap the wrong element.
    If this happens, we will leak the non-deactivated element, it becomes
    unreachable.
    
    The element that got deactivated (and will be freed later) will
    remain reachable in the set data structure, this can result in
    a crash when such an element is retrieved during lookup (stale
    pointer).
    
    Add a check that the fully matching key does in fact map to the element
    that we have marked as inactive in the deactivation step.
    If not, we need to continue searching.
    
    Add a bug/warn trap at the end of the function as well, the remove
    function must not ever be called with an invisible/unreachable/non-existent
    element.
    
    v2: avoid uneeded temporary variable (Stefano)
    
    Fixes: 3c4287f62044 ("nf_tables: Add set type for arbitrary concatenation of ranges")
    Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nilfs2: fix OOB in nilfs_set_de_type [+ + +]
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Tue Apr 16 03:20:48 2024 +0900

    nilfs2: fix OOB in nilfs_set_de_type
    
    commit c4a7dc9523b59b3e73fd522c73e95e072f876b16 upstream.
    
    The size of the nilfs_type_by_mode array in the fs/nilfs2/dir.c file is
    defined as "S_IFMT >> S_SHIFT", but the nilfs_set_de_type() function,
    which uses this array, specifies the index to read from the array in the
    same way as "(mode & S_IFMT) >> S_SHIFT".
    
    static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode
     *inode)
    {
            umode_t mode = inode->i_mode;
    
            de->file_type = nilfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; // oob
    }
    
    However, when the index is determined this way, an out-of-bounds (OOB)
    error occurs by referring to an index that is 1 larger than the array size
    when the condition "mode & S_IFMT == S_IFMT" is satisfied.  Therefore, a
    patch to resize the nilfs_type_by_mode array should be applied to prevent
    OOB errors.
    
    Link: https://lkml.kernel.org/r/20240415182048.7144-1-konishi.ryusuke@gmail.com
    Reported-by: syzbot+2e22057de05b9f3b30d8@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=2e22057de05b9f3b30d8
    Fixes: 2ba466d74ed7 ("nilfs2: directory entry operations")
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Tested-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nouveau: fix instmem race condition around ptr stores [+ + +]
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu Apr 11 11:15:09 2024 +1000

    nouveau: fix instmem race condition around ptr stores
    
    commit fff1386cc889d8fb4089d285f883f8cba62d82ce upstream.
    
    Running a lot of VK CTS in parallel against nouveau, once every
    few hours you might see something like this crash.
    
    BUG: kernel NULL pointer dereference, address: 0000000000000008
    PGD 8000000114e6e067 P4D 8000000114e6e067 PUD 109046067 PMD 0
    Oops: 0000 [#1] PREEMPT SMP PTI
    CPU: 7 PID: 53891 Comm: deqp-vk Not tainted 6.8.0-rc6+ #27
    Hardware name: Gigabyte Technology Co., Ltd. Z390 I AORUS PRO WIFI/Z390 I AORUS PRO WIFI-CF, BIOS F8 11/05/2021
    RIP: 0010:gp100_vmm_pgt_mem+0xe3/0x180 [nouveau]
    Code: c7 48 01 c8 49 89 45 58 85 d2 0f 84 95 00 00 00 41 0f b7 46 12 49 8b 7e 08 89 da 42 8d 2c f8 48 8b 47 08 41 83 c7 01 48 89 ee <48> 8b 40 08 ff d0 0f 1f 00 49 8b 7e 08 48 89 d9 48 8d 75 04 48 c1
    RSP: 0000:ffffac20c5857838 EFLAGS: 00010202
    RAX: 0000000000000000 RBX: 00000000004d8001 RCX: 0000000000000001
    RDX: 00000000004d8001 RSI: 00000000000006d8 RDI: ffffa07afe332180
    RBP: 00000000000006d8 R08: ffffac20c5857ad0 R09: 0000000000ffff10
    R10: 0000000000000001 R11: ffffa07af27e2de0 R12: 000000000000001c
    R13: ffffac20c5857ad0 R14: ffffa07a96fe9040 R15: 000000000000001c
    FS:  00007fe395eed7c0(0000) GS:ffffa07e2c980000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000008 CR3: 000000011febe001 CR4: 00000000003706f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    
    ...
    
     ? gp100_vmm_pgt_mem+0xe3/0x180 [nouveau]
     ? gp100_vmm_pgt_mem+0x37/0x180 [nouveau]
     nvkm_vmm_iter+0x351/0xa20 [nouveau]
     ? __pfx_nvkm_vmm_ref_ptes+0x10/0x10 [nouveau]
     ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
     ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
     ? __lock_acquire+0x3ed/0x2170
     ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
     nvkm_vmm_ptes_get_map+0xc2/0x100 [nouveau]
     ? __pfx_nvkm_vmm_ref_ptes+0x10/0x10 [nouveau]
     ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
     nvkm_vmm_map_locked+0x224/0x3a0 [nouveau]
    
    Adding any sort of useful debug usually makes it go away, so I hand
    wrote the function in a line, and debugged the asm.
    
    Every so often pt->memory->ptrs is NULL. This ptrs ptr is set in
    the nv50_instobj_acquire called from nvkm_kmap.
    
    If Thread A and Thread B both get to nv50_instobj_acquire around
    the same time, and Thread A hits the refcount_set line, and in
    lockstep thread B succeeds at refcount_inc_not_zero, there is a
    chance the ptrs value won't have been stored since refcount_set
    is unordered. Force a memory barrier here, I picked smp_mb, since
    we want it on all CPUs and it's write followed by a read.
    
    v2: use paired smp_rmb/smp_wmb.
    
    Cc: <stable@vger.kernel.org>
    Fixes: be55287aa5ba ("drm/nouveau/imem/nv50: embed nvkm_instobj directly into nv04_instobj")
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Danilo Krummrich <dakr@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240411011510.2546857-1-airlied@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
PCI/ASPM: Fix deadlock when enabling ASPM [+ + +]
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Jan 30 11:02:43 2024 +0100

    PCI/ASPM: Fix deadlock when enabling ASPM
    
    commit 1e560864159d002b453da42bd2c13a1805515a20 upstream.
    
    A last minute revert in 6.7-final introduced a potential deadlock when
    enabling ASPM during probe of Qualcomm PCIe controllers as reported by
    lockdep:
    
      ============================================
      WARNING: possible recursive locking detected
      6.7.0 #40 Not tainted
      --------------------------------------------
      kworker/u16:5/90 is trying to acquire lock:
      ffffacfa78ced000 (pci_bus_sem){++++}-{3:3}, at: pcie_aspm_pm_state_change+0x58/0xdc
    
                  but task is already holding lock:
      ffffacfa78ced000 (pci_bus_sem){++++}-{3:3}, at: pci_walk_bus+0x34/0xbc
    
                  other info that might help us debug this:
       Possible unsafe locking scenario:
    
             CPU0
             ----
        lock(pci_bus_sem);
        lock(pci_bus_sem);
    
                   *** DEADLOCK ***
    
      Call trace:
       print_deadlock_bug+0x25c/0x348
       __lock_acquire+0x10a4/0x2064
       lock_acquire+0x1e8/0x318
       down_read+0x60/0x184
       pcie_aspm_pm_state_change+0x58/0xdc
       pci_set_full_power_state+0xa8/0x114
       pci_set_power_state+0xc4/0x120
       qcom_pcie_enable_aspm+0x1c/0x3c [pcie_qcom]
       pci_walk_bus+0x64/0xbc
       qcom_pcie_host_post_init_2_7_0+0x28/0x34 [pcie_qcom]
    
    The deadlock can easily be reproduced on machines like the Lenovo ThinkPad
    X13s by adding a delay to increase the race window during asynchronous
    probe where another thread can take a write lock.
    
    Add a new pci_set_power_state_locked() and associated helper functions that
    can be called with the PCI bus semaphore held to avoid taking the read lock
    twice.
    
    Link: https://lore.kernel.org/r/ZZu0qx2cmn7IwTyQ@hovoldconsulting.com
    Link: https://lore.kernel.org/r/20240130100243.11011-1-johan+linaro@kernel.org
    Fixes: f93e71aea6c6 ("Revert "PCI/ASPM: Remove pcie_aspm_pm_state_change()"")
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: <stable@vger.kernel.org>    # 6.7
    [bhelgaas: backported to v6.1.y, which contains b9c370b61d73 ("Revert
     "PCI/ASPM: Remove pcie_aspm_pm_state_change()""), a backport of
     f93e71aea6c6.  This omits the drivers/pci/controller/dwc/pcie-qcom.c hunk
     that updates qcom_pcie_enable_aspm(), which was added by 9f4f3dfad8cf
     ("PCI: qcom: Enable ASPM for platforms supporting 1.9.0 ops"), which is not
     present in v6.1.87.]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
PCI/DPC: Use FIELD_GET() [+ + +]
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Wed Oct 18 14:32:51 2023 +0300

    PCI/DPC: Use FIELD_GET()
    
    [ Upstream commit 9a9eec4765737b9b2a8d6ae03de6480a5f12dd5c ]
    
    Use FIELD_GET() to remove dependencies on the field position, i.e., the
    shift value. No functional change intended.
    
    Link: https://lore.kernel.org/r/20231018113254.17616-5-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
PCI: Avoid FLR for SolidRun SNET DPU rev 1 [+ + +]
Author: Alvaro Karsz <alvaro.karsz@solid-run.com>
Date:   Tue Jan 10 18:56:37 2023 +0200

    PCI: Avoid FLR for SolidRun SNET DPU rev 1
    
    [ Upstream commit d089d69cc1f824936eeaa4fa172f8fa1a0949eaa ]
    
    This patch fixes a FLR bug on the SNET DPU rev 1 by setting the
    PCI_DEV_FLAGS_NO_FLR_RESET flag.
    
    As there is a quirk to avoid FLR (quirk_no_flr), I added a new quirk
    to check the rev ID before calling to quirk_no_flr.
    
    Without this patch, a SNET DPU rev 1 may hang when FLR is applied.
    
    Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
    Acked-by: Bjorn Helgaas <bhelgaas@google.com>
    Message-Id: <20230110165638.123745-3-alvaro.karsz@solid-run.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: Delay after FLR of Solidigm P44 Pro NVMe [+ + +]
Author: Mike Pastore <mike@oobak.org>
Date:   Sun May 7 02:35:19 2023 -0500

    PCI: Delay after FLR of Solidigm P44 Pro NVMe
    
    [ Upstream commit 0ac448e0d29d6ba978684b3fa2e3ac7294ec2475 ]
    
    Prevent KVM hang when a Solidgm P44 Pro NVMe is passed through to a guest
    via IOMMU and the guest is subsequently rebooted.
    
    A similar issue was identified and patched by 51ba09452d11 ("PCI: Delay
    after FLR of Intel DC P3700 NVMe") and the same fix can be applied for this
    case. (Intel spun off their NAND and SSD business as Solidigm and sold it
    to SK Hynix in late 2021.)
    
    Link: https://lore.kernel.org/r/20230507073519.9737-1-mike@oobak.org
    Signed-off-by: Mike Pastore <mike@oobak.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: Execute quirk_enable_clear_retrain_link() earlier [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Sun Jun 11 18:19:23 2023 +0100

    PCI: Execute quirk_enable_clear_retrain_link() earlier
    
    [ Upstream commit 07a8d698de50c4740ac6f709c43e23a6da6e4dbc ]
    
    Make quirk_enable_clear_retrain_link() an early quirk so that any later
    fixups can rely on dev->clear_retrain_link to have been already
    initialised.
    
    [bhelgaas: reorder to just before it becomes possible to call
    pcie_retrain_link() earlier]
    Link: https://lore.kernel.org/r/alpine.DEB.2.21.2305310049000.59226@angie.orcam.me.uk
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: Simplify pcie_capability_clear_and_set_word() to ..._clear_word() [+ + +]
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Thu Oct 26 15:19:23 2023 +0300

    PCI: Simplify pcie_capability_clear_and_set_word() to ..._clear_word()
    
    [ Upstream commit 0fce6e5c87faec2c8bf28d2abc8cb595f4e244b6 ]
    
    When using pcie_capability_clear_and_set_word() but not actually *setting*
    anything, use pcie_capability_clear_word() instead.
    
    Link: https://lore.kernel.org/r/20231026121924.2164-1-ilpo.jarvinen@linux.intel.com
    Link: https://lore.kernel.org/r/20231026121924.2164-2-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    [bhelgaas: squash]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: switchtec: Add support for PCIe Gen5 devices [+ + +]
Author: Kelvin Cao <kelvin.cao@microchip.com>
Date:   Fri Jun 23 17:00:03 2023 -0700

    PCI: switchtec: Add support for PCIe Gen5 devices
    
    [ Upstream commit 0fb53e64705ae0fabd9593102e0f0e6812968802 ]
    
    Advertise support of Gen5 devices in the driver's device ID table and
    add the same IDs for the switchtec quirks. Also update driver code to
    accommodate them.
    
    Link: https://lore.kernel.org/r/20230624000003.2315364-3-kelvin.cao@microchip.com
    Signed-off-by: Kelvin Cao <kelvin.cao@microchip.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

PCI: switchtec: Use normal comment style [+ + +]
Author: Kelvin Cao <kelvin.cao@microchip.com>
Date:   Fri Jun 23 17:00:02 2023 -0700

    PCI: switchtec: Use normal comment style
    
    [ Upstream commit 846691f5483d61259db2f4d6a3dce8b98d518794 ]
    
    Use normal comment style '/* */' for device ID description.
    
    Link: https://lore.kernel.org/r/20230624000003.2315364-2-kelvin.cao@microchip.com
    Signed-off-by: Kelvin Cao <kelvin.cao@microchip.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
    Stable-dep-of: 0fb53e64705a ("PCI: switchtec: Add support for PCIe Gen5 devices")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
random: handle creditable entropy from atomic process context [+ + +]
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Wed Apr 17 13:38:29 2024 +0200

    random: handle creditable entropy from atomic process context
    
    commit e871abcda3b67d0820b4182ebe93435624e9c6a4 upstream.
    
    The entropy accounting changes a static key when the RNG has
    initialized, since it only ever initializes once. Static key changes,
    however, cannot be made from atomic context, so depending on where the
    last creditable entropy comes from, the static key change might need to
    be deferred to a worker.
    
    Previously the code used the execute_in_process_context() helper
    function, which accounts for whether or not the caller is
    in_interrupt(). However, that doesn't account for the case where the
    caller is actually in process context but is holding a spinlock.
    
    This turned out to be the case with input_handle_event() in
    drivers/input/input.c contributing entropy:
    
      [<ffffffd613025ba0>] die+0xa8/0x2fc
      [<ffffffd613027428>] bug_handler+0x44/0xec
      [<ffffffd613016964>] brk_handler+0x90/0x144
      [<ffffffd613041e58>] do_debug_exception+0xa0/0x148
      [<ffffffd61400c208>] el1_dbg+0x60/0x7c
      [<ffffffd61400c000>] el1h_64_sync_handler+0x38/0x90
      [<ffffffd613011294>] el1h_64_sync+0x64/0x6c
      [<ffffffd613102d88>] __might_resched+0x1fc/0x2e8
      [<ffffffd613102b54>] __might_sleep+0x44/0x7c
      [<ffffffd6130b6eac>] cpus_read_lock+0x1c/0xec
      [<ffffffd6132c2820>] static_key_enable+0x14/0x38
      [<ffffffd61400ac08>] crng_set_ready+0x14/0x28
      [<ffffffd6130df4dc>] execute_in_process_context+0xb8/0xf8
      [<ffffffd61400ab30>] _credit_init_bits+0x118/0x1dc
      [<ffffffd6138580c8>] add_timer_randomness+0x264/0x270
      [<ffffffd613857e54>] add_input_randomness+0x38/0x48
      [<ffffffd613a80f94>] input_handle_event+0x2b8/0x490
      [<ffffffd613a81310>] input_event+0x6c/0x98
    
    According to Guoyong, it's not really possible to refactor the various
    drivers to never hold a spinlock there. And in_atomic() isn't reliable.
    
    So, rather than trying to be too fancy, just punt the change in the
    static key to a workqueue always. There's basically no drawback of doing
    this, as the code already needed to account for the static key not
    changing immediately, and given that it's just an optimization, there's
    not exactly a hurry to change the static key right away, so deferal is
    fine.
    
    Reported-by: Guoyong Wang <guoyong.wang@mediatek.com>
    Cc: stable@vger.kernel.org
    Fixes: f5bda35fba61 ("random: use static branch for crng_ready()")
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
RDMA/cm: Print the old state when cm_destroy_id gets timeout [+ + +]
Author: Mark Zhang <markzhang@nvidia.com>
Date:   Fri Mar 22 13:20:49 2024 +0200

    RDMA/cm: Print the old state when cm_destroy_id gets timeout
    
    [ Upstream commit b68e1acb5834ed1a2ad42d9d002815a8bae7c0b6 ]
    
    The old state is helpful for debugging, as the current state is always
    IB_CM_IDLE when timeout happens.
    
    Fixes: 96d9cbe2f2ff ("RDMA/cm: add timeout to cm_destroy_id wait")
    Signed-off-by: Mark Zhang <markzhang@nvidia.com>
    Link: https://lore.kernel.org/r/20240322112049.2022994-1-markzhang@nvidia.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/mlx5: Fix port number for counter query in multi-port configuration [+ + +]
Author: Michael Guralnik <michaelgur@nvidia.com>
Date:   Wed Apr 3 12:03:46 2024 +0300

    RDMA/mlx5: Fix port number for counter query in multi-port configuration
    
    [ Upstream commit be121ffb384f53e966ee7299ffccc6eeb61bc73d ]
    
    Set the correct port when querying PPCNT in multi-port configuration.
    Distinguish between cases where switchdev mode was enabled to multi-port
    configuration and don't overwrite the queried port to 1 in multi-port
    case.
    
    Fixes: 74b30b3ad5ce ("RDMA/mlx5: Set local port to one when accessing counters")
    Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
    Link: https://lore.kernel.org/r/9bfcc8ade958b760a51408c3ad654a01b11f7d76.1712134988.git.leon@kernel.org
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/rxe: Fix the problem "mutex_destroy missing" [+ + +]
Author: Yanjun.Zhu <yanjun.zhu@linux.dev>
Date:   Thu Mar 14 07:51:40 2024 +0100

    RDMA/rxe: Fix the problem "mutex_destroy missing"
    
    [ Upstream commit 481047d7e8391d3842ae59025806531cdad710d9 ]
    
    When a mutex lock is not used any more, the function mutex_destroy
    should be called to mark the mutex lock uninitialized.
    
    Fixes: 8700e3e7c485 ("Soft RoCE driver")
    Signed-off-by: Yanjun.Zhu <yanjun.zhu@linux.dev>
    Link: https://lore.kernel.org/r/20240314065140.27468-1-yanjun.zhu@linux.dev
    Reviewed-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "usb: cdc-wdm: close race between read and workqueue" [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Apr 18 16:33:28 2024 +0200

    Revert "usb: cdc-wdm: close race between read and workqueue"
    
    commit 1607830dadeefc407e4956336d9fcd9e9defd810 upstream.
    
    This reverts commit 339f83612f3a569b194680768b22bf113c26a29d.
    
    It has been found to cause problems in a number of Chromebook devices,
    so revert the change until it can be brought back in a safe way.
    
    Link: https://lore.kernel.org/r/385a3519-b45d-48c5-a6fd-a3fdb6bec92f@chromium.org
    Reported-by:: Aleksander Morgado <aleksandermj@chromium.org>
    Fixes: 339f83612f3a ("usb: cdc-wdm: close race between read and workqueue")
    Cc: stable <stable@kernel.org>
    Cc: Oliver Neukum <oneukum@suse.com>
    Cc: Bjørn Mork <bjorn@mork.no>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/cio: fix race condition during online processing [+ + +]
Author: Peter Oberparleiter <oberpar@linux.ibm.com>
Date:   Wed Apr 10 11:46:19 2024 +0200

    s390/cio: fix race condition during online processing
    
    [ Upstream commit 2d8527f2f911fab84aec04df4788c0c23af3df48 ]
    
    A race condition exists in ccw_device_set_online() that can cause the
    online process to fail, leaving the affected device in an inconsistent
    state. As a result, subsequent attempts to set that device online fail
    with return code ENODEV.
    
    The problem occurs when a path verification request arrives after
    a wait for final device state completed, but before the result state
    is evaluated.
    
    Fix this by ensuring that the CCW-device lock is held between
    determining final state and checking result state.
    
    Note that since:
    
    commit 2297791c92d0 ("s390/cio: dont unregister subchannel from child-drivers")
    
    path verification requests are much more likely to occur during boot,
    resulting in an increased chance of this race condition occurring.
    
    Fixes: 2297791c92d0 ("s390/cio: dont unregister subchannel from child-drivers")
    Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
    Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
    Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
s390/qdio: handle deferred cc1 [+ + +]
Author: Peter Oberparleiter <oberpar@linux.ibm.com>
Date:   Wed Apr 10 11:46:18 2024 +0200

    s390/qdio: handle deferred cc1
    
    [ Upstream commit 607638faf2ff1cede37458111496e7cc6c977f6f ]
    
    A deferred condition code 1 response indicates that I/O was not started
    and should be retried. The current QDIO implementation handles a cc1
    response as I/O error, resulting in a failed QDIO setup. This can happen
    for example when a path verification request arrives at the same time
    as QDIO setup I/O is started.
    
    Fix this by retrying the QDIO setup I/O when a cc1 response is received.
    
    Note that since
    
    commit 2297791c92d0 ("s390/cio: dont unregister subchannel from child-drivers")
    commit 5ef1dc40ffa6 ("s390/cio: fix invalid -EBUSY on ccw_device_start")
    
    deferred cc1 responses are much more likely to occur. See the commit
    message of the latter for more background information.
    
    Fixes: 2297791c92d0 ("s390/cio: dont unregister subchannel from child-drivers")
    Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
    Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/ftrace: Limit length in subsystem-enable tests [+ + +]
Author: Yuanhe Shu <xiangzao@linux.alibaba.com>
Date:   Mon Feb 26 11:18:16 2024 +0800

    selftests/ftrace: Limit length in subsystem-enable tests
    
    commit 1a4ea83a6e67f1415a1f17c1af5e9c814c882bb5 upstream.
    
    While sched* events being traced and sched* events continuously happen,
    "[xx] event tracing - enable/disable with subsystem level files" would
    not stop as on some slower systems it seems to take forever.
    Select the first 100 lines of output would be enough to judge whether
    there are more than 3 types of sched events.
    
    Fixes: 815b18ea66d6 ("ftracetest: Add basic event tracing test cases")
    Cc: stable@vger.kernel.org
    Signed-off-by: Yuanhe Shu <xiangzao@linux.alibaba.com>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
serial/pmac_zilog: Remove flawed mitigation for rx irq flood [+ + +]
Author: Finn Thain <fthain@linux-m68k.org>
Date:   Mon Apr 8 19:23:43 2024 +1000

    serial/pmac_zilog: Remove flawed mitigation for rx irq flood
    
    commit 1be3226445362bfbf461c92a5bcdb1723f2e4907 upstream.
    
    The mitigation was intended to stop the irq completely. That may be
    better than a hard lock-up but it turns out that you get a crash anyway
    if you're using pmac_zilog as a serial console:
    
    ttyPZ0: pmz: rx irq flood !
    BUG: spinlock recursion on CPU#0, swapper/0
    
    That's because the pr_err() call in pmz_receive_chars() results in
    pmz_console_write() attempting to lock a spinlock already locked in
    pmz_interrupt(). With CONFIG_DEBUG_SPINLOCK=y, this produces a fatal
    BUG splat. The spinlock in question is the one in struct uart_port.
    
    Even when it's not fatal, the serial port rx function ceases to work.
    Also, the iteration limit doesn't play nicely with QEMU, as can be
    seen in the bug report linked below.
    
    A web search for other reports of the error message "pmz: rx irq flood"
    didn't produce anything. So I don't think this code is needed any more.
    Remove it.
    
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Nicholas Piggin <npiggin@gmail.com>
    Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
    Cc: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
    Cc: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
    Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
    Cc: stable@kernel.org
    Cc: linux-m68k@lists.linux-m68k.org
    Link: https://github.com/vivier/qemu-m68k/issues/44
    Link: https://lore.kernel.org/all/1078874617.9746.36.camel@gaston/
    Acked-by: Michael Ellerman <mpe@ellerman.id.au>
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Finn Thain <fthain@linux-m68k.org>
    Link: https://lore.kernel.org/r/e853cf2c762f23101cd2ddec0cc0c2be0e72685f.1712568223.git.fthain@linux-m68k.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
serial: mxs-auart: add spinlock around changing cts state [+ + +]
Author: Emil Kronborg <emil.kronborg@protonmail.com>
Date:   Wed Mar 20 12:15:36 2024 +0000

    serial: mxs-auart: add spinlock around changing cts state
    
    commit 54c4ec5f8c471b7c1137a1f769648549c423c026 upstream.
    
    The uart_handle_cts_change() function in serial_core expects the caller
    to hold uport->lock. For example, I have seen the below kernel splat,
    when the Bluetooth driver is loaded on an i.MX28 board.
    
        [   85.119255] ------------[ cut here ]------------
        [   85.124413] WARNING: CPU: 0 PID: 27 at /drivers/tty/serial/serial_core.c:3453 uart_handle_cts_change+0xb4/0xec
        [   85.134694] Modules linked in: hci_uart bluetooth ecdh_generic ecc wlcore_sdio configfs
        [   85.143314] CPU: 0 PID: 27 Comm: kworker/u3:0 Not tainted 6.6.3-00021-gd62a2f068f92 #1
        [   85.151396] Hardware name: Freescale MXS (Device Tree)
        [   85.156679] Workqueue: hci0 hci_power_on [bluetooth]
        (...)
        [   85.191765]  uart_handle_cts_change from mxs_auart_irq_handle+0x380/0x3f4
        [   85.198787]  mxs_auart_irq_handle from __handle_irq_event_percpu+0x88/0x210
        (...)
    
    Cc: stable@vger.kernel.org
    Fixes: 4d90bb147ef6 ("serial: core: Document and assert lock requirements for irq helpers")
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Emil Kronborg <emil.kronborg@protonmail.com>
    Link: https://lore.kernel.org/r/20240320121530.11348-1-emil.kronborg@protonmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: stm32: Reset .throttled state in .startup() [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Wed Apr 17 11:03:28 2024 +0200

    serial: stm32: Reset .throttled state in .startup()
    
    commit ea2624b5b829b8f93c0dce25721d835969b34faf upstream.
    
    When an UART is opened that still has .throttled set from a previous
    open, the RX interrupt is enabled but the irq handler doesn't consider
    it. This easily results in a stuck irq with the effect to occupy the CPU
    in a tight loop.
    
    So reset the throttle state in .startup() to ensure that RX irqs are
    handled.
    
    Fixes: d1ec8a2eabe9 ("serial: stm32: update throttle and unthrottle ops for dma mode")
    Cc: stable@vger.kernel.org
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Link: https://lore.kernel.org/r/a784f80d3414f7db723b2ec66efc56e1ad666cbf.1713344161.git.u.kleine-koenig@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: stm32: Return IRQ_NONE in the ISR if no handling happend [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Wed Apr 17 11:03:27 2024 +0200

    serial: stm32: Return IRQ_NONE in the ISR if no handling happend
    
    commit 13c785323b36b845300b256d0e5963c3727667d7 upstream.
    
    If there is a stuck irq that the handler doesn't address, returning
    IRQ_HANDLED unconditionally makes it impossible for the irq core to
    detect the problem and disable the irq. So only return IRQ_HANDLED if
    an event was handled.
    
    A stuck irq is still problematic, but with this change at least it only
    makes the UART nonfunctional instead of occupying the (usually only) CPU
    by 100% and so stall the whole machine.
    
    Fixes: 48a6092fb41f ("serial: stm32-usart: Add STM32 USART Driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Link: https://lore.kernel.org/r/5f92603d0dfd8a5b8014b2b10a902d91e0bb881f.1713344161.git.u.kleine-koenig@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
speakup: Avoid crash on very long word [+ + +]
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sat Mar 23 17:48:43 2024 +0100

    speakup: Avoid crash on very long word
    
    commit c8d2f34ea96ea3bce6ba2535f867f0d4ee3b22e1 upstream.
    
    In case a console is set up really large and contains a really long word
    (> 256 characters), we have to stop before the length of the word buffer.
    
    Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Fixes: c6e3fd22cd538 ("Staging: add speakup to the staging directory")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20240323164843.1426997-1-samuel.thibault@ens-lyon.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
SUNRPC: Fix rpcgss_context trace event acceptor field [+ + +]
Author: Steven Rostedt (Google) <rostedt@goodmis.org>
Date:   Wed Apr 10 12:38:13 2024 -0400

    SUNRPC: Fix rpcgss_context trace event acceptor field
    
    commit a4833e3abae132d613ce7da0e0c9a9465d1681fa upstream.
    
    The rpcgss_context trace event acceptor field is a dynamically sized
    string that records the "data" parameter. But this parameter is also
    dependent on the "len" field to determine the size of the data.
    
    It needs to use __string_len() helper macro where the length can be passed
    in. It also incorrectly uses strncpy() to save it instead of
    __assign_str(). As these macros can change, it is not wise to open code
    them in trace events.
    
    As of commit c759e609030c ("tracing: Remove __assign_str_len()"),
    __assign_str() can be used for both __string() and __string_len() fields.
    Before that commit, __assign_str_len() is required to be used. This needs
    to be noted for backporting. (In actuality, commit c1fa617caeb0 ("tracing:
    Rework __assign_str() and __string() to not duplicate getting the string")
    is the commit that makes __string_str_len() obsolete).
    
    Cc: stable@vger.kernel.org
    Fixes: 0c77668ddb4e ("SUNRPC: Introduce trace points in rpc_auth_gss.ko")
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
thunderbolt: Add debug log for link controller power quirk [+ + +]
Author: Mika Westerberg <mika.westerberg@linux.intel.com>
Date:   Mon Feb 27 12:45:09 2023 +0200

    thunderbolt: Add debug log for link controller power quirk
    
    [ Upstream commit ccdb0900a0c3b0b56af5f547cceb64ee8d09483f ]
    
    Add a debug log to this quirk as well so we can see what quirks have
    been applied when debugging.
    
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

thunderbolt: Avoid notify PM core about runtime PM resume [+ + +]
Author: Gil Fine <gil.fine@linux.intel.com>
Date:   Fri Mar 1 15:11:18 2024 +0200

    thunderbolt: Avoid notify PM core about runtime PM resume
    
    commit dcd12acaf384c30437fa5a9a1f71df06fc9835fd upstream.
    
    Currently we notify PM core about occurred wakes after any resume. This
    is not actually needed after resume from runtime suspend. Hence, notify
    PM core about occurred wakes only after resume from system sleep. Also,
    if the wake occurred in USB4 router upstream port, we don't notify the
    PM core about it since it is not actually needed and can cause
    unexpected autowake (e.g. if /sys/power/wakeup_count is used).
    
    While there add the missing kernel-doc for tb_switch_resume().
    
    Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thunderbolt: Fix wake configurations after device unplug [+ + +]
Author: Gil Fine <gil.fine@linux.intel.com>
Date:   Fri Mar 1 15:22:53 2024 +0200

    thunderbolt: Fix wake configurations after device unplug
    
    commit c38fa07dc69f0b9e6f43ecab96dc7861a70c827c upstream.
    
    Currently we don't configure correctly the wake events after unplug of device
    router. What can happen is that the downstream ports of host router will be
    configured to wake on: USB4-wake and wake-on-disconnect, but not on
    wake-on-connect. This may cause the later plugged device not to wake the
    domain and fail in enumeration. Fix this by clearing downstream port's "USB4
    Port is Configured" bit, after unplug of a device router.
    
    Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thunderbolt: Log function name of the called quirk [+ + +]
Author: Mika Westerberg <mika.westerberg@linux.intel.com>
Date:   Fri Feb 3 15:57:59 2023 +0200

    thunderbolt: Log function name of the called quirk
    
    [ Upstream commit f14d177e0be652ef7b265753f08f2a7d31935668 ]
    
    This is useful when debugging whether a quirk has been matched or not.
    
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tun: limit printing rate when illegal packet received by tun dev [+ + +]
Author: Lei Chen <lei.chen@smartx.com>
Date:   Sun Apr 14 22:02:46 2024 -0400

    tun: limit printing rate when illegal packet received by tun dev
    
    [ Upstream commit f8bbc07ac535593139c875ffa19af924b1084540 ]
    
    vhost_worker will call tun call backs to receive packets. If too many
    illegal packets arrives, tun_do_read will keep dumping packet contents.
    When console is enabled, it will costs much more cpu time to dump
    packet and soft lockup will be detected.
    
    net_ratelimit mechanism can be used to limit the dumping rate.
    
    PID: 33036    TASK: ffff949da6f20000  CPU: 23   COMMAND: "vhost-32980"
     #0 [fffffe00003fce50] crash_nmi_callback at ffffffff89249253
     #1 [fffffe00003fce58] nmi_handle at ffffffff89225fa3
     #2 [fffffe00003fceb0] default_do_nmi at ffffffff8922642e
     #3 [fffffe00003fced0] do_nmi at ffffffff8922660d
     #4 [fffffe00003fcef0] end_repeat_nmi at ffffffff89c01663
        [exception RIP: io_serial_in+20]
        RIP: ffffffff89792594  RSP: ffffa655314979e8  RFLAGS: 00000002
        RAX: ffffffff89792500  RBX: ffffffff8af428a0  RCX: 0000000000000000
        RDX: 00000000000003fd  RSI: 0000000000000005  RDI: ffffffff8af428a0
        RBP: 0000000000002710   R8: 0000000000000004   R9: 000000000000000f
        R10: 0000000000000000  R11: ffffffff8acbf64f  R12: 0000000000000020
        R13: ffffffff8acbf698  R14: 0000000000000058  R15: 0000000000000000
        ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
     #5 [ffffa655314979e8] io_serial_in at ffffffff89792594
     #6 [ffffa655314979e8] wait_for_xmitr at ffffffff89793470
     #7 [ffffa65531497a08] serial8250_console_putchar at ffffffff897934f6
     #8 [ffffa65531497a20] uart_console_write at ffffffff8978b605
     #9 [ffffa65531497a48] serial8250_console_write at ffffffff89796558
     #10 [ffffa65531497ac8] console_unlock at ffffffff89316124
     #11 [ffffa65531497b10] vprintk_emit at ffffffff89317c07
     #12 [ffffa65531497b68] printk at ffffffff89318306
     #13 [ffffa65531497bc8] print_hex_dump at ffffffff89650765
     #14 [ffffa65531497ca8] tun_do_read at ffffffffc0b06c27 [tun]
     #15 [ffffa65531497d38] tun_recvmsg at ffffffffc0b06e34 [tun]
     #16 [ffffa65531497d68] handle_rx at ffffffffc0c5d682 [vhost_net]
     #17 [ffffa65531497ed0] vhost_worker at ffffffffc0c644dc [vhost]
     #18 [ffffa65531497f10] kthread at ffffffff892d2e72
     #19 [ffffa65531497f50] ret_from_fork at ffffffff89c0022f
    
    Fixes: ef3db4a59542 ("tun: avoid BUG, dump packet on GSO errors")
    Signed-off-by: Lei Chen <lei.chen@smartx.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Acked-by: Jason Wang <jasowang@redhat.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Link: https://lore.kernel.org/r/20240415020247.2207781-1-lei.chen@smartx.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
usb: Disable USB3 LPM at shutdown [+ + +]
Author: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date:   Tue Mar 5 14:51:38 2024 +0800

    usb: Disable USB3 LPM at shutdown
    
    commit d920a2ed8620be04a3301e1a9c2b7cc1de65f19d upstream.
    
    SanDisks USB3 storage may disapper after system reboot:
    
    usb usb2-port3: link state change
    xhci_hcd 0000:00:14.0: clear port3 link state change, portsc: 0x2c0
    usb usb2-port3: do warm reset, port only
    xhci_hcd 0000:00:14.0: xhci_hub_status_data: stopping usb2 port polling
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x2b0, return 0x2b0
    usb usb2-port3: not warm reset yet, waiting 50ms
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x2f0, return 0x2f0
    usb usb2-port3: not warm reset yet, waiting 200ms
    ...
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x6802c0, return 0x7002c0
    usb usb2-port3: not warm reset yet, waiting 200ms
    xhci_hcd 0000:00:14.0: clear port3 reset change, portsc: 0x4802c0
    xhci_hcd 0000:00:14.0: clear port3 warm(BH) reset change, portsc: 0x4002c0
    xhci_hcd 0000:00:14.0: clear port3 link state change, portsc: 0x2c0
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x2c0, return 0x2c0
    usb usb2-port3: not enabled, trying warm reset again...
    
    This is due to the USB device still cause port change event after xHCI is
    shuted down:
    
    xhci_hcd 0000:38:00.0: // Setting command ring address to 0xffffe001
    xhci_hcd 0000:38:00.0: xhci_resume: starting usb3 port polling.
    xhci_hcd 0000:38:00.0: xhci_hub_status_data: stopping usb4 port polling
    xhci_hcd 0000:38:00.0: xhci_hub_status_data: stopping usb3 port polling
    xhci_hcd 0000:38:00.0: hcd_pci_runtime_resume: 0
    xhci_hcd 0000:38:00.0: xhci_shutdown: stopping usb3 port polling.
    xhci_hcd 0000:38:00.0: // Halt the HC
    xhci_hcd 0000:38:00.0: xhci_shutdown completed - status = 1
    xhci_hcd 0000:00:14.0: xhci_shutdown: stopping usb1 port polling.
    xhci_hcd 0000:00:14.0: // Halt the HC
    xhci_hcd 0000:00:14.0: xhci_shutdown completed - status = 1
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x1203, return 0x203
    xhci_hcd 0000:00:14.0: set port reset, actual port 2-3 status  = 0x1311
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x201203, return 0x100203
    xhci_hcd 0000:00:14.0: clear port3 reset change, portsc: 0x1203
    xhci_hcd 0000:00:14.0: clear port3 warm(BH) reset change, portsc: 0x1203
    xhci_hcd 0000:00:14.0: clear port3 link state change, portsc: 0x1203
    xhci_hcd 0000:00:14.0: clear port3 connect change, portsc: 0x1203
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x1203, return 0x203
    usb 2-3: device not accepting address 2, error -108
    xhci_hcd 0000:00:14.0: xHCI dying or halted, can't queue_command
    xhci_hcd 0000:00:14.0: Set port 2-3 link state, portsc: 0x1203, write 0x11261
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x1263, return 0x263
    xhci_hcd 0000:00:14.0: set port reset, actual port 2-3 status  = 0x1271
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x12b1, return 0x2b1
    usb usb2-port3: not reset yet, waiting 60ms
    ACPI: PM: Preparing to enter system sleep state S5
    xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x12f1, return 0x2f1
    usb usb2-port3: not reset yet, waiting 200ms
    reboot: Restarting system
    
    The port change event is caused by LPM transition, so disabling LPM at shutdown
    to make sure the device is in U0 for warmboot.
    
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Cc: stable <stable@kernel.org>
    Link: https://lore.kernel.org/r/20240305065140.66801-1-kai.heng.feng@canonical.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc2: host: Fix dereference issue in DDMA completion flow. [+ + +]
Author: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Date:   Tue Apr 9 12:27:54 2024 +0000

    usb: dwc2: host: Fix dereference issue in DDMA completion flow.
    
    commit eed04fa96c48790c1cce73c8a248e9d460b088f8 upstream.
    
    Fixed variable dereference issue in DDMA completion flow.
    
    Fixes: b258e4268850 ("usb: dwc2: host: Fix ISOC flow in DDMA mode")
    CC: stable@vger.kernel.org
    Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
    Closes: https://lore.kernel.org/linux-usb/2024040834-ethically-rumble-701f@gregkh/T/#m4c4b83bef0ebb4b67fe2e0a7d6466cbb6f416e39
    Signed-off-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
    Link: https://lore.kernel.org/r/cc826d3ef53c934d8e6d98870f17f3cdc3d2755d.1712665387.git.Minas.Harutyunyan@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_ncm: Fix UAF ncm object at re-bind after usb ep transport error [+ + +]
Author: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
Date:   Wed Mar 27 11:35:50 2024 +0900

    usb: gadget: f_ncm: Fix UAF ncm object at re-bind after usb ep transport error
    
    commit 6334b8e4553cc69f51e383c9de545082213d785e upstream.
    
    When ncm function is working and then stop usb0 interface for link down,
    eth_stop() is called. At this piont, accidentally if usb transport error
    should happen in usb_ep_enable(), 'in_ep' and/or 'out_ep' may not be enabled.
    
    After that, ncm_disable() is called to disable for ncm unbind
    but gether_disconnect() is never called since 'in_ep' is not enabled.
    
    As the result, ncm object is released in ncm unbind
    but 'dev->port_usb' associated to 'ncm->port' is not NULL.
    
    And when ncm bind again to recover netdev, ncm object is reallocated
    but usb0 interface is already associated to previous released ncm object.
    
    Therefore, once usb0 interface is up and eth_start_xmit() is called,
    released ncm object is dereferrenced and it might cause use-after-free memory.
    
    [function unlink via configfs]
      usb0: eth_stop dev->port_usb=ffffff9b179c3200
      --> error happens in usb_ep_enable().
      NCM: ncm_disable: ncm=ffffff9b179c3200
      --> no gether_disconnect() since ncm->port.in_ep->enabled is false.
      NCM: ncm_unbind: ncm unbind ncm=ffffff9b179c3200
      NCM: ncm_free: ncm free ncm=ffffff9b179c3200   <-- released ncm
    
    [function link via configfs]
      NCM: ncm_alloc: ncm alloc ncm=ffffff9ac4f8a000
      NCM: ncm_bind: ncm bind ncm=ffffff9ac4f8a000
      NCM: ncm_set_alt: ncm=ffffff9ac4f8a000 alt=0
      usb0: eth_open dev->port_usb=ffffff9b179c3200  <-- previous released ncm
      usb0: eth_start dev->port_usb=ffffff9b179c3200 <--
      eth_start_xmit()
      --> dev->wrap()
      Unable to handle kernel paging request at virtual address dead00000000014f
    
    This patch addresses the issue by checking if 'ncm->netdev' is not NULL at
    ncm_disable() to call gether_disconnect() to deassociate 'dev->port_usb'.
    It's more reasonable to check 'ncm->netdev' to call gether_connect/disconnect
    rather than check 'ncm->port.in_ep->enabled' since it might not be enabled
    but the gether connection might be established.
    
    Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
    Cc: stable <stable@kernel.org>
    Link: https://lore.kernel.org/r/20240327023550.51214-1-Norihiko.Hama@alpsalpine.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: new quirk to reduce the SET_ADDRESS request timeout [+ + +]
Author: Hardik Gajjar <hgajjar@de.adit-jv.com>
Date:   Fri Oct 27 17:20:29 2023 +0200

    usb: new quirk to reduce the SET_ADDRESS request timeout
    
    [ Upstream commit 5a1ccf0c72cf917ff3ccc131d1bb8d19338ffe52 ]
    
    This patch introduces a new USB quirk,
    USB_QUIRK_SHORT_SET_ADDRESS_REQ_TIMEOUT, which modifies the timeout value
    for the SET_ADDRESS request. The standard timeout for USB request/command
    is 5000 ms, as recommended in the USB 3.2 specification (section 9.2.6.1).
    
    However, certain scenarios, such as connecting devices through an APTIV
    hub, can lead to timeout errors when the device enumerates as full speed
    initially and later switches to high speed during chirp negotiation.
    
    In such cases, USB analyzer logs reveal that the bus suspends for
    5 seconds due to incorrect chirp parsing and resumes only after two
    consecutive timeout errors trigger a hub driver reset.
    
    Packet(54) Dir(?) Full Speed J(997.100 us) Idle(  2.850 us)
    _______| Time Stamp(28 . 105 910 682)
    _______|_____________________________________________________________Ch0
    Packet(55) Dir(?) Full Speed J(997.118 us) Idle(  2.850 us)
    _______| Time Stamp(28 . 106 910 632)
    _______|_____________________________________________________________Ch0
    Packet(56) Dir(?) Full Speed J(399.650 us) Idle(222.582 us)
    _______| Time Stamp(28 . 107 910 600)
    _______|_____________________________________________________________Ch0
    Packet(57) Dir Chirp J( 23.955 ms) Idle(115.169 ms)
    _______| Time Stamp(28 . 108 532 832)
    _______|_____________________________________________________________Ch0
    Packet(58) Dir(?) Full Speed J (Suspend)( 5.347 sec) Idle(  5.366 us)
    _______| Time Stamp(28 . 247 657 600)
    _______|_____________________________________________________________Ch0
    
    This 5-second delay in device enumeration is undesirable, particularly
    in automotive applications where quick enumeration is crucial
    (ideally within 3 seconds).
    
    The newly introduced quirks provide the flexibility to align with a
    3-second time limit, as required in specific contexts like automotive
    applications.
    
    By reducing the SET_ADDRESS request timeout to 500 ms, the
    system can respond more swiftly to errors, initiate rapid recovery, and
    ensure efficient device enumeration. This change is vital for scenarios
    where rapid smartphone enumeration and screen projection are essential.
    
    To use the quirk, please write "vendor_id:product_id:p" to
    /sys/bus/usb/drivers/hub/module/parameter/quirks
    
    For example,
    echo "0x2c48:0x0132:p" > /sys/bus/usb/drivers/hub/module/parameters/quirks"
    
    Signed-off-by: Hardik Gajjar <hgajjar@de.adit-jv.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/20231027152029.104363-2-hgajjar@de.adit-jv.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: pci-quirks: Reduce the length of a spinlock section in usb_amd_find_chipset_info() [+ + +]
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Thu Mar 23 20:40:22 2023 +0100

    usb: pci-quirks: Reduce the length of a spinlock section in usb_amd_find_chipset_info()
    
    [ Upstream commit c03ff66dc0e0cbad9ed0c29500843e1da8533118 ]
    
    'info' is local to the function. There is no need to zeroing it within
    a spin_lock section. Moreover, there is no need to explicitly initialize
    the .need_pll_quirk field.
    
    Initialize the structure when defined and remove the now useless memset().
    
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Link: https://lore.kernel.org/r/08ee42fced6af6bd56892cd14f2464380ab071fa.1679600396.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
USB: serial: option: add Fibocom FM135-GL variants [+ + +]
Author: bolan wang <bolan.wang@fibocom.com>
Date:   Wed Mar 6 19:03:39 2024 +0800

    USB: serial: option: add Fibocom FM135-GL variants
    
    commit 356952b13af5b2c338df1e06889fd1b5e12cbbf4 upstream.
    
    Update the USB serial option driver support for the Fibocom
    FM135-GL LTE modules.
    - VID:PID 2cb7:0115, FM135-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    
    0x0115: mbim, diag, at, pipe
    
    Here are the outputs of usb-devices:
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 16 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0115 Rev=05.15
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=Fibocom Module
    S:  SerialNumber=12345678
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) 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=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: bolan wang <bolan.wang@fibocom.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add Lonsung U8300/U9300 product [+ + +]
Author: Coia Prant <coiaprant@gmail.com>
Date:   Mon Apr 15 07:26:25 2024 -0700

    USB: serial: option: add Lonsung U8300/U9300 product
    
    commit cf16ffa17c398434a77b8a373e69287c95b60de2 upstream.
    
    Update the USB serial option driver to support Longsung U8300/U9300.
    
    For U8300
    
    Interface 4 is used by for QMI interface in stock firmware of U8300, the
    router which uses U8300 modem.
    Interface 5 is used by for ADB interface in stock firmware of U8300, the
    router which uses U8300 modem.
    
    Interface mapping is:
    0: unknown (Debug), 1: AT (Modem), 2: AT, 3: PPP (NDIS / Pipe), 4: QMI, 5: ADB
    
    T:  Bus=05 Lev=01 Prnt=03 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=1c9e ProdID=9b05 Rev=03.18
    S:  Manufacturer=Android
    S:  Product=Android
    C:  #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff 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=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    For U9300
    
    Interface 1 is used by for ADB interface in stock firmware of U9300, the
    router which uses U9300 modem.
    Interface 4 is used by for QMI interface in stock firmware of U9300, the
    router which uses U9300 modem.
    
    Interface mapping is:
    0: ADB, 1: AT (Modem), 2: AT, 3: PPP (NDIS / Pipe), 4: QMI
    
    Note: Interface 3 of some models of the U9300 series can send AT commands.
    
    T:  Bus=05 Lev=01 Prnt=05 Port=04 Cnt=01 Dev#=  6 Spd=480 MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1c9e ProdID=9b3c Rev=03.18
    S:  Manufacturer=Android
    S:  Product=Android
    C:  #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    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=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    
    Tested successfully using Modem Manager on U9300.
    Tested successfully AT commands using If=1, If=2 and If=3 on U9300.
    
    Signed-off-by: Coia Prant <coiaprant@gmail.com>
    Reviewed-by: Lars Melin <larsm17@gmail.com>
    [ johan: drop product defines, trim commit message ]
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add Rolling RW101-GL and RW135-GL support [+ + +]
Author: Vanillan Wang <vanillanwang@163.com>
Date:   Tue Apr 16 18:02:55 2024 +0800

    USB: serial: option: add Rolling RW101-GL and RW135-GL support
    
    commit 311f97a4c7c22a01f8897bddf00428dfd0668e79 upstream.
    
    Update the USB serial option driver support for the Rolling
    LTE modules.
    
    - VID:PID 33f8:01a2, RW101-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    0x01a2: mbim, diag, at, pipe
    - VID:PID 33f8:01a3, RW101-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    0x01a3: mbim, pipe
    - VID:PID 33f8:01a4, RW101-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    0x01a4: mbim, diag, at, pipe
    - VID:PID 33f8:0104, RW101-GL for laptop debug M.2 cards(with RMNET
    interface for /Linux/Chrome OS)
    0x0104: RMNET, diag, at, pipe
    - VID:PID 33f8:0115, RW135-GL for laptop debug M.2 cards(with MBIM
    interface for /Linux/Chrome OS)
    0x0115: MBIM, diag, at, pipe
    
    Here are the outputs of usb-devices:
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  5 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=01a2 Rev=05.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=12345678
    C:  #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) 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=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) 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=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  8 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=01a3 Rev=05.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=12345678
    C:  #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 17 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=01a4 Rev=05.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=12345678
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) 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=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) 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=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
    D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=33f8 ProdID=0104 Rev=05.04
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=ba2eb033
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA
    I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
    E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 16 Spd=480 MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=0115 Rev=05.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling Module
    S:  SerialNumber=12345678
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) 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=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Vanillan Wang <vanillanwang@163.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add support for Fibocom FM650/FG650 [+ + +]
Author: Chuanhong Guo <gch981213@gmail.com>
Date:   Tue Mar 12 14:29:12 2024 +0800

    USB: serial: option: add support for Fibocom FM650/FG650
    
    commit fb1f4584b1215e8c209f6b3a4028ed8351a0e961 upstream.
    
    Fibocom FM650/FG650 are 5G modems with ECM/NCM/RNDIS/MBIM modes.
    This patch adds support to all 4 modes.
    
    In all 4 modes, the first serial port is the AT console while the other
    3 appear to be diagnostic interfaces for dumping modem logs.
    
    usb-devices output for all modes:
    
    ECM:
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  5 Spd=5000 MxCh= 0
    D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0a04 Rev=04.04
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=FG650 Module
    S:  SerialNumber=0123456789ABCDEF
    C:  #Ifs= 5 Cfg#= 1 Atr=c0 MxPwr=504mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    NCM:
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  6 Spd=5000 MxCh= 0
    D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0a05 Rev=04.04
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=FG650 Module
    S:  SerialNumber=0123456789ABCDEF
    C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=504mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    RNDIS:
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=5000 MxCh= 0
    D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0a06 Rev=04.04
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=FG650 Module
    S:  SerialNumber=0123456789ABCDEF
    C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=504mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    MBIM:
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  7 Spd=5000 MxCh= 0
    D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
    P:  Vendor=2cb7 ProdID=0a07 Rev=04.04
    S:  Manufacturer=Fibocom Wireless Inc.
    S:  Product=FG650 Module
    S:  SerialNumber=0123456789ABCDEF
    C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=504mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
    
    Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add Telit FN920C04 rmnet compositions [+ + +]
Author: Daniele Palmas <dnlplm@gmail.com>
Date:   Thu Apr 18 13:34:30 2024 +0200

    USB: serial: option: add Telit FN920C04 rmnet compositions
    
    commit 582ee2f9d268d302595db3e36b985e5cbb93284d upstream.
    
    Add the following Telit FN920C04 compositions:
    
    0x10a0: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#=  5 Spd=480  MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a0 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    0x10a4: rmnet + tty (AT) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a4 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    0x10a9: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#=  9 Spd=480  MxCh= 0
    D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a9 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: support Quectel EM060K sub-models [+ + +]
Author: Jerry Meng <jerry-meng@foxmail.com>
Date:   Mon Apr 15 15:04:29 2024 +0800

    USB: serial: option: support Quectel EM060K sub-models
    
    commit c840244aba7ad2b83ed904378b36bd6aef25511c upstream.
    
    EM060K_129, EM060K_12a, EM060K_12b and EM0060K_12c are EM060K's sub-models,
    having the same name "Quectel EM060K-GL" and the same interface layout.
    
    MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
    
    T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 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=0129 Rev= 5.04
    S:  Manufacturer=Quectel
    S:  Product=Quectel EM060K-GL
    S:  SerialNumber=f6fa08b6
    C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA
    A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=81(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=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:* If#= 3 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=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 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=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 5 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=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
    E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=8f(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Jerry Meng <jerry-meng@foxmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: xhci: Add timeout argument in address_device USB HCD callback [+ + +]
Author: Hardik Gajjar <hgajjar@de.adit-jv.com>
Date:   Fri Oct 27 17:20:28 2023 +0200

    usb: xhci: Add timeout argument in address_device USB HCD callback
    
    [ Upstream commit a769154c7cac037914ba375ae88aae55b2c853e0 ]
    
    - The HCD address_device callback now accepts a user-defined timeout value
      in milliseconds, providing better control over command execution times.
    - The default timeout value for the address_device command has been set
      to 5000 ms, aligning with the USB 3.2 specification. However, this
      timeout can be adjusted as needed.
    - The xhci_setup_device function has been updated to accept the timeout
      value, allowing it to specify the maximum wait time for the command
      operation to complete.
    - The hub driver has also been updated to accommodate the newly added
      timeout parameter during the SET_ADDRESS request.
    
    Signed-off-by: Hardik Gajjar <hgajjar@de.adit-jv.com>
    Reviewed-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20231027152029.104363-1-hgajjar@de.adit-jv.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 5a1ccf0c72cf ("usb: new quirk to reduce the SET_ADDRESS request timeout")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/boot: Construct PE/COFF .text section from assembler [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:19 2024 +0200

    x86/boot: Construct PE/COFF .text section from assembler
    
    [ Commit efa089e63b56bdc5eca754b995cb039dd7a5457e upstream ]
    
    Now that the size of the setup block is visible to the assembler, it is
    possible to populate the PE/COFF header fields from the asm code
    directly, instead of poking the values into the binary using the build
    tool. This will make it easier to reorganize the section layout without
    having to tweak the build tool in lockstep.
    
    This change has no impact on the resulting bzImage binary.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230915171623.655440-15-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Define setup size in linker script [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:17 2024 +0200

    x86/boot: Define setup size in linker script
    
    [ Commit 093ab258e3fb1d1d3afdfd4a69403d44ce90e360 upstream ]
    
    The setup block contains the real mode startup code that is used when
    booting from a legacy BIOS, along with the boot_params/setup_data that
    is used by legacy x86 bootloaders to pass the command line and initial
    ramdisk parameters, among other things.
    
    The setup block also contains the PE/COFF header of the entire combined
    image, which includes the compressed kernel image, the decompressor and
    the EFI stub.
    
    This PE header describes the layout of the executable image in memory,
    and currently, the fact that the setup block precedes it makes it rather
    fiddly to get the right values into the right place in the final image.
    
    Let's make things a bit easier by defining the setup_size in the linker
    script so it can be referenced from the asm code directly, rather than
    having to rely on the build tool to calculate it. For the time being,
    add 64 bytes of fixed padding for the .reloc and .compat sections - this
    will be removed in a subsequent patch after the PE/COFF header has been
    reorganized.
    
    This change has no impact on the resulting bzImage binary when
    configured with CONFIG_EFI_MIXED=y.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230915171623.655440-13-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Derive file size from _edata symbol [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:18 2024 +0200

    x86/boot: Derive file size from _edata symbol
    
    [ Commit aeb92067f6ae994b541d7f9752fe54ed3d108bcc upstream ]
    
    Tweak the linker script so that the value of _edata represents the
    decompressor binary's file size rounded up to the appropriate alignment.
    This removes the need to calculate it in the build tool, and will make
    it easier to refer to the file size from the header directly in
    subsequent changes to the PE header layout.
    
    While adding _edata to the sed regex that parses the compressed
    vmlinux's symbol list, tweak the regex a bit for conciseness.
    
    This change has no impact on the resulting bzImage binary when
    configured with CONFIG_EFI_STUB=y.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230915171623.655440-14-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Drop PE/COFF .reloc section [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:20 2024 +0200

    x86/boot: Drop PE/COFF .reloc section
    
    [ Commit fa5750521e0a4efbc1af05223da9c4bbd6c21c83 upstream ]
    
    Ancient buggy EFI loaders may have required a .reloc section to be
    present at some point in time, but this has not been true for a long
    time so the .reloc section can just be dropped.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230915171623.655440-16-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Drop redundant code setting the root device [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:13 2024 +0200

    x86/boot: Drop redundant code setting the root device
    
    [ Commit 7448e8e5d15a3c4df649bf6d6d460f78396f7e1e upstream ]
    
    The root device defaults to 0,0 and is no longer configurable at build
    time [0], so there is no need for the build tool to ever write to this
    field.
    
    [0] 079f85e624189292 ("x86, build: Do not set the root_dev field in bzImage")
    
    This change has no impact on the resulting bzImage binary.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230912090051.4014114-23-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Drop references to startup_64 [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:14 2024 +0200

    x86/boot: Drop references to startup_64
    
    [ Commit b618d31f112bea3d2daea19190d63e567f32a4db upstream ]
    
    The x86 boot image generation tool assign a default value to startup_64
    and subsequently parses the actual value from zoffset.h but it never
    actually uses the value anywhere. So remove this code.
    
    This change has no impact on the resulting bzImage binary.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230912090051.4014114-25-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Grab kernel_info offset from zoffset header directly [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:15 2024 +0200

    x86/boot: Grab kernel_info offset from zoffset header directly
    
    [ Commit 2e765c02dcbfc2a8a4527c621a84b9502f6b9bd2 upstream ]
    
    Instead of parsing zoffset.h and poking the kernel_info offset value
    into the header from the build tool, just grab the value directly in the
    asm file that describes this header.
    
    This change has no impact on the resulting bzImage binary.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230915171623.655440-11-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Increase section and file alignment to 4k/512 [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:22 2024 +0200

    x86/boot: Increase section and file alignment to 4k/512
    
    [ Commit 3e3eabe26dc88692d34cf76ca0e0dd331481cc15 upstream ]
    
    Align x86 with other EFI architectures, and increase the section
    alignment to the EFI page size (4k), so that firmware is able to honour
    the section permission attributes and map code read-only and data
    non-executable.
    
    There are a number of requirements that have to be taken into account:
    - the sign tools get cranky when there are gaps between sections in the
      file view of the image
    - the virtual offset of each section must be aligned to the image's
      section alignment
    - the file offset *and size* of each section must be aligned to the
      image's file alignment
    - the image size must be aligned to the section alignment
    - each section's virtual offset must be greater than or equal to the
      size of the headers.
    
    In order to meet all these requirements, while avoiding the need for
    lots of padding to accommodate the .compat section, the latter is placed
    at an arbitrary offset towards the end of the image, but aligned to the
    minimum file alignment (512 bytes). The space before the .text section
    is therefore distributed between the PE header, the .setup section and
    the .compat section, leaving no gaps in the file coverage, making the
    signing tools happy.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230915171623.655440-18-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Omit compression buffer from PE/COFF image memory footprint [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:12 2024 +0200

    x86/boot: Omit compression buffer from PE/COFF image memory footprint
    
    [ Commit 8eace5b3555606e684739bef5bcdfcfe68235257 upstream ]
    
    Now that the EFI stub decompresses the kernel and hands over to the
    decompressed image directly, there is no longer a need to provide a
    decompression buffer as part of the .BSS allocation of the PE/COFF
    image. It also means the PE/COFF image can be loaded anywhere in memory,
    and setting the preferred image base is unnecessary. So drop the
    handling of this from the header and from the build tool.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230912090051.4014114-22-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Remove the 'bugger off' message [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:11 2024 +0200

    x86/boot: Remove the 'bugger off' message
    
    [ Commit 768171d7ebbce005210e1cf8456f043304805c15 upstream ]
    
    Ancient (pre-2003) x86 kernels could boot from a floppy disk straight from
    the BIOS, using a small real mode boot stub at the start of the image
    where the BIOS would expect the boot record (or boot block) to appear.
    
    Due to its limitations (kernel size < 1 MiB, no support for IDE, USB or
    El Torito floppy emulation), this support was dropped, and a Linux aware
    bootloader is now always required to boot the kernel from a legacy BIOS.
    
    To smoothen this transition, the boot stub was not removed entirely, but
    replaced with one that just prints an error message telling the user to
    install a bootloader.
    
    As it is unlikely that anyone doing direct floppy boot with such an
    ancient kernel is going to upgrade to v6.5+ and expect that this boot
    method still works, printing this message is kind of pointless, and so
    it should be possible to remove the logic that emits it.
    
    Let's free up this space so it can be used to expand the PE header in a
    subsequent patch.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
    Link: https://lore.kernel.org/r/20230912090051.4014114-21-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Set EFI handover offset directly in header asm [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:16 2024 +0200

    x86/boot: Set EFI handover offset directly in header asm
    
    [ Commit eac956345f99dda3d68f4ae6cf7b494105e54780 upstream ]
    
    The offsets of the EFI handover entrypoints are available to the
    assembler when constructing the header, so there is no need to set them
    from the build tool afterwards.
    
    This change has no impact on the resulting bzImage binary.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230915171623.655440-12-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/boot: Split off PE/COFF .data section [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:21 2024 +0200

    x86/boot: Split off PE/COFF .data section
    
    [ Commit 34951f3c28bdf6481d949a20413b2ce7693687b2 upstream ]
    
    Describe the code and data of the decompressor binary using separate
    .text and .data PE/COFF sections, so that we will be able to map them
    using restricted permissions once we increase the section and file
    alignment sufficiently. This avoids the need for memory mappings that
    are writable and executable at the same time, which is something that
    is best avoided for security reasons.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230915171623.655440-17-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/bugs: Fix BHI retpoline check [+ + +]
Author: Josh Poimboeuf <jpoimboe@kernel.org>
Date:   Fri Apr 12 11:10:33 2024 -0700

    x86/bugs: Fix BHI retpoline check
    
    [ Upstream commit 69129794d94c544810e68b2b4eaa7e44063f9bf2 ]
    
    Confusingly, X86_FEATURE_RETPOLINE doesn't mean retpolines are enabled,
    as it also includes the original "AMD retpoline" which isn't a retpoline
    at all.
    
    Also replace cpu_feature_enabled() with boot_cpu_has() because this is
    before alternatives are patched and cpu_feature_enabled()'s fallback
    path is slower than plain old boot_cpu_has().
    
    Fixes: ec9404e40e8f ("x86/bhi: Add BHI mitigation knob")
    Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Link: https://lore.kernel.org/r/ad3807424a3953f0323c011a643405619f2a4927.1712944776.git.jpoimboe@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/cpufeatures: Fix dependencies for GFNI, VAES, and VPCLMULQDQ [+ + +]
Author: Eric Biggers <ebiggers@google.com>
Date:   Tue Apr 16 23:04:34 2024 -0700

    x86/cpufeatures: Fix dependencies for GFNI, VAES, and VPCLMULQDQ
    
    [ Upstream commit 9543f6e26634537997b6e909c20911b7bf4876de ]
    
    Fix cpuid_deps[] to list the correct dependencies for GFNI, VAES, and
    VPCLMULQDQ.  These features don't depend on AVX512, and there exist CPUs
    that support these features but not AVX512.  GFNI actually doesn't even
    depend on AVX.
    
    This prevents GFNI from being unnecessarily disabled if AVX is disabled
    to mitigate the GDS vulnerability.
    
    This also prevents all three features from being unnecessarily disabled
    if AVX512VL (or its dependency AVX512F) were to be disabled, but it
    looks like there isn't any case where this happens anyway.
    
    Fixes: c128dbfa0f87 ("x86/cpufeatures: Enable new SSE/AVX/AVX512 CPU features")
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
    Link: https://lore.kernel.org/r/20240417060434.47101-1-ebiggers@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/efi: Disregard setup header of loaded image [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:08 2024 +0200

    x86/efi: Disregard setup header of loaded image
    
    [ Commit 7e50262229faad0c7b8c54477cd1c883f31cc4a7 upstream ]
    
    The native EFI entrypoint does not take a struct boot_params from the
    loader, but instead, it constructs one from scratch, using the setup
    header data placed at the start of the image.
    
    This setup header is placed in a way that permits legacy loaders to
    manipulate the contents (i.e., to pass the kernel command line or the
    address and size of an initial ramdisk), but EFI boot does not use it in
    that way - it only copies the contents that were placed there at build
    time, but EFI loaders will not (and should not) manipulate the setup
    header to configure the boot. (Commit 63bf28ceb3ebbe76 "efi: x86: Wipe
    setup_data on pure EFI boot" deals with some of the fallout of using
    setup_data in a way that breaks EFI boot.)
    
    Given that none of the non-zero values that are copied from the setup
    header into the EFI stub's struct boot_params are relevant to the boot
    now that the EFI stub no longer enters via the legacy decompressor, the
    copy can be omitted altogether.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230912090051.4014114-19-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/efi: Drop alignment flags from PE section headers [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:10 2024 +0200

    x86/efi: Drop alignment flags from PE section headers
    
    [ Commit bfab35f552ab3dd6d017165bf9de1d1d20f198cc upstream ]
    
    The section header flags for alignment are documented in the PE/COFF
    spec as being applicable to PE object files only, not to PE executables
    such as the Linux bzImage, so let's drop them from the PE header.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230912090051.4014114-20-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/efi: Drop EFI stub .bss from .data section [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:07 2024 +0200

    x86/efi: Drop EFI stub .bss from .data section
    
    [ Commit 5f51c5d0e905608ba7be126737f7c84a793ae1aa upstream ]
    
    Now that the EFI stub always zero inits its BSS section upon entry,
    there is no longer a need to place the BSS symbols carried by the stub
    into the .data section.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230912090051.4014114-18-ardb@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/efistub: Reinstate soft limit for initrd loading [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:09 2024 +0200

    x86/efistub: Reinstate soft limit for initrd loading
    
    [ Commit decd347c2a75d32984beb8807d470b763a53b542 upstream ]
    
    Commit
    
      8117961d98fb2 ("x86/efi: Disregard setup header of loaded image")
    
    dropped the memcopy of the image's setup header into the boot_params
    struct provided to the core kernel, on the basis that EFI boot does not
    need it and should rely only on a single protocol to interface with the
    boot chain. It is also a prerequisite for being able to increase the
    section alignment to 4k, which is needed to enable memory protections
    when running in the boot services.
    
    So only the setup_header fields that matter to the core kernel are
    populated explicitly, and everything else is ignored. One thing was
    overlooked, though: the initrd_addr_max field in the setup_header is not
    used by the core kernel, but it is used by the EFI stub itself when it
    loads the initrd, where its default value of INT_MAX is used as the soft
    limit for memory allocation.
    
    This means that, in the old situation, the initrd was virtually always
    loaded in the lower 2G of memory, but now, due to initrd_addr_max being
    0x0, the initrd may end up anywhere in memory. This should not be an
    issue principle, as most systems can deal with this fine. However, it
    does appear to tickle some problems in older UEFI implementations, where
    the memory ends up being corrupted, resulting in errors when unpacking
    the initramfs.
    
    So set the initrd_addr_max field to INT_MAX like it was before.
    
    Fixes: 8117961d98fb2 ("x86/efi: Disregard setup header of loaded image")
    Reported-by: Radek Podgorny <radek@podgorny.cz>
    Closes: https://lore.kernel.org/all/a99a831a-8ad5-4cb0-bff9-be637311f771@podgorny.cz
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/efistub: Remap kernel text read-only before dropping NX attribute [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:29 2024 +0200

    x86/efistub: Remap kernel text read-only before dropping NX attribute
    
    [ Commit 9c55461040a9264b7e44444c53d26480b438eda6 upstream ]
    
    Currently, the EFI stub invokes the EFI memory attributes protocol to
    strip any NX restrictions from the entire loaded kernel, resulting in
    all code and data being mapped read-write-execute.
    
    The point of the EFI memory attributes protocol is to remove the need
    for all memory allocations to be mapped with both write and execute
    permissions by default, and make it the OS loader's responsibility to
    transition data mappings to code mappings where appropriate.
    
    Even though the UEFI specification does not appear to leave room for
    denying memory attribute changes based on security policy, let's be
    cautious and avoid relying on the ability to create read-write-execute
    mappings. This is trivially achievable, given that the amount of kernel
    code executing via the firmware's 1:1 mapping is rather small and
    limited to the .head.text region. So let's drop the NX restrictions only
    on that subregion, but not before remapping it as read-only first.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/efistub: Use 1:1 file:memory mapping for PE/COFF .compat section [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:23 2024 +0200

    x86/efistub: Use 1:1 file:memory mapping for PE/COFF .compat section
    
    [ Commit 1ad55cecf22f05f1c884adf63cc09d3c3e609ebf upstream ]
    
    The .compat section is a dummy PE section that contains the address of
    the 32-bit entrypoint of the 64-bit kernel image if it is bootable from
    32-bit firmware (i.e., CONFIG_EFI_MIXED=y)
    
    This section is only 8 bytes in size and is only referenced from the
    loader, and so it is placed at the end of the memory view of the image,
    to avoid the need for padding it to 4k, which is required for sections
    appearing in the middle of the image.
    
    Unfortunately, this violates the PE/COFF spec, and even if most EFI
    loaders will work correctly (including the Tianocore reference
    implementation), PE loaders do exist that reject such images, on the
    basis that both the file and memory views of the file contents should be
    described by the section headers in a monotonically increasing manner
    without leaving any gaps.
    
    So reorganize the sections to avoid this issue. This results in a slight
    padding overhead (< 4k) which can be avoided if desired by disabling
    CONFIG_EFI_MIXED (which is only needed in rare cases these days)
    
    Fixes: 3e3eabe26dc8 ("x86/boot: Increase section and file alignment to 4k/512")
    Reported-by: Mike Beaton <mjsbeaton@gmail.com>
    Link: https://lkml.kernel.org/r/CAHzAAWQ6srV6LVNdmfbJhOwhBw5ZzxxZZ07aHt9oKkfYAdvuQQ%40mail.gmail.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/head/64: Add missing __head annotation to startup_64_load_idt() [+ + +]
Author: Hou Wenlong <houwenlong.hwl@antgroup.com>
Date:   Fri Apr 19 10:11:25 2024 +0200

    x86/head/64: Add missing __head annotation to startup_64_load_idt()
    
    [ Commit 7f6874eddd81cb2ed784642a7a4321671e158ffe upstream ]
    
    This function is currently only used in the head code and is only called
    from startup_64_setup_env(). Although it would be inlined by the
    compiler, it would be better to mark it as __head too in case it doesn't.
    
    Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/efcc5b5e18af880e415d884e072bf651c1fa7c34.1689130310.git.houwenlong.hwl@antgroup.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/head/64: Move the __head definition to [+ + +]
Author: Hou Wenlong <houwenlong.hwl@antgroup.com>
Date:   Fri Apr 19 10:11:26 2024 +0200

    x86/head/64: Move the __head definition to <asm/init.h>
    
    [ Commit d2a285d65bfde3218fd0c3b88794d0135ced680b upstream ]
    
    Move the __head section definition to a header to widen its use.
    
    An upcoming patch will mark the code as __head in mem_encrypt_identity.c too.
    
    Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/0583f57977be184689c373fe540cbd7d85ca2047.1697525407.git.houwenlong.hwl@antgroup.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/mm: Remove P*D_PAGE_MASK and P*D_PAGE_SIZE macros [+ + +]
Author: Pasha Tatashin <pasha.tatashin@soleen.com>
Date:   Fri Apr 19 10:11:24 2024 +0200

    x86/mm: Remove P*D_PAGE_MASK and P*D_PAGE_SIZE macros
    
    [ Commit 82328227db8f0b9b5f77bb5afcd47e59d0e4d08f upstream ]
    
    Other architectures and the common mm/ use P*D_MASK, and P*D_SIZE.
    Remove the duplicated P*D_PAGE_MASK and P*D_PAGE_SIZE which are only
    used in x86/*.
    
    Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Acked-by: Mike Rapoport <rppt@linux.ibm.com>
    Link: https://lore.kernel.org/r/20220516185202.604654-1-tatashin@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/quirks: Include linux/pnp.h for arch_pnpbios_disabled() [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue May 16 21:35:38 2023 +0200

    x86/quirks: Include linux/pnp.h for arch_pnpbios_disabled()
    
    [ Upstream commit 056b44a4d10907ec8153863b2a0564e808ef1440 ]
    
    arch_pnpbios_disabled() is defined in architecture code on x86, but this
    does not include the appropriate header, causing a warning:
    
    arch/x86/kernel/platform-quirks.c:42:13: error: no previous prototype for 'arch_pnpbios_disabled' [-Werror=missing-prototypes]
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
    Link: https://lore.kernel.org/all/20230516193549.544673-10-arnd%40kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/sev: Move early startup code into .head.text section [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:28 2024 +0200

    x86/sev: Move early startup code into .head.text section
    
    [ Commit 428080c9b19bfda37c478cd626dbd3851db1aff9 upstream ]
    
    In preparation for implementing rigorous build time checks to enforce
    that only code that can support it will be called from the early 1:1
    mapping of memory, move SEV init code that is called in this manner to
    the .head.text section.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
    Link: https://lore.kernel.org/r/20240227151907.387873-19-ardb+git@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/sme: Move early SME kernel encryption handling into .head.text [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Apr 19 10:11:27 2024 +0200

    x86/sme: Move early SME kernel encryption handling into .head.text
    
    [ Commit 48204aba801f1b512b3abed10b8e1a63e03f3dd1 upstream ]
    
    The .head.text section is the initial primary entrypoint of the core
    kernel, and is entered with the CPU executing from a 1:1 mapping of
    memory. Such code must never access global variables using absolute
    references, as these are based on the kernel virtual mapping which is
    not active yet at this point.
    
    Given that the SME startup code is also called from this early execution
    context, move it into .head.text as well. This will allow more thorough
    build time checks in the future to ensure that early startup code only
    uses RIP-relative references to global variables.
    
    Also replace some occurrences of __pa_symbol() [which relies on the
    compiler generating an absolute reference, which is not guaranteed] and
    an open coded RIP-relative access with RIP_REL_REF().
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
    Link: https://lore.kernel.org/r/20240227151907.387873-18-ardb+git@google.com
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>