Changelog in Linux kernel 5.15.171

 
ACPI: CPPC: Make rmw_lock a raw_spin_lock [+ + +]
Author: Pierre Gondois <pierre.gondois@arm.com>
Date:   Mon Oct 28 13:56:56 2024 +0100

    ACPI: CPPC: Make rmw_lock a raw_spin_lock
    
    [ Upstream commit 1c10941e34c5fdc0357e46a25bd130d9cf40b925 ]
    
    The following BUG was triggered:
    
    =============================
    [ BUG: Invalid wait context ]
    6.12.0-rc2-XXX #406 Not tainted
    -----------------------------
    kworker/1:1/62 is trying to lock:
    ffffff8801593030 (&cpc_ptr->rmw_lock){+.+.}-{3:3}, at: cpc_write+0xcc/0x370
    other info that might help us debug this:
    context-{5:5}
    2 locks held by kworker/1:1/62:
      #0: ffffff897ef5ec98 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x2c/0x50
      #1: ffffff880154e238 (&sg_policy->update_lock){....}-{2:2}, at: sugov_update_shared+0x3c/0x280
    stack backtrace:
    CPU: 1 UID: 0 PID: 62 Comm: kworker/1:1 Not tainted 6.12.0-rc2-g9654bd3e8806 #406
    Workqueue:  0x0 (events)
    Call trace:
      dump_backtrace+0xa4/0x130
      show_stack+0x20/0x38
      dump_stack_lvl+0x90/0xd0
      dump_stack+0x18/0x28
      __lock_acquire+0x480/0x1ad8
      lock_acquire+0x114/0x310
      _raw_spin_lock+0x50/0x70
      cpc_write+0xcc/0x370
      cppc_set_perf+0xa0/0x3a8
      cppc_cpufreq_fast_switch+0x40/0xc0
      cpufreq_driver_fast_switch+0x4c/0x218
      sugov_update_shared+0x234/0x280
      update_load_avg+0x6ec/0x7b8
      dequeue_entities+0x108/0x830
      dequeue_task_fair+0x58/0x408
      __schedule+0x4f0/0x1070
      schedule+0x54/0x130
      worker_thread+0xc0/0x2e8
      kthread+0x130/0x148
      ret_from_fork+0x10/0x20
    
    sugov_update_shared() locks a raw_spinlock while cpc_write() locks a
    spinlock.
    
    To have a correct wait-type order, update rmw_lock to a raw spinlock and
    ensure that interrupts will be disabled on the CPU holding it.
    
    Fixes: 60949b7b8054 ("ACPI: CPPC: Fix MASK_VAL() usage")
    Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
    Link: https://patch.msgid.link/20241028125657.1271512-1-pierre.gondois@arm.com
    [ rjw: Changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ACPI: PRM: Change handler_addr type to void pointer [+ + +]
Author: Sudeep Holla <sudeep.holla@arm.com>
Date:   Tue Jun 28 13:53:43 2022 +0100

    ACPI: PRM: Change handler_addr type to void pointer
    
    [ Upstream commit 353efd5e97a7973d78f2634274b57309d0966e29 ]
    
    handler_addr is a virtual address passed to efi_call_virt_pointer.
    While x86 currently type cast it into the pointer in it's arch specific
    arch_efi_call_virt() implementation, ARM64 is restrictive for right
    reasons.
    
    Convert the handler_addr type from u64 to void pointer.
    
    Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
    Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Stable-dep-of: 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context [+ + +]
Author: Koba Ko <kobak@nvidia.com>
Date:   Sun Oct 13 04:50:10 2024 +0800

    ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context
    
    [ Upstream commit 088984c8d54c0053fc4ae606981291d741c5924b ]
    
    PRMT needs to find the correct type of block to translate the PA-VA
    mapping for EFI runtime services.
    
    The issue arises because the PRMT is finding a block of type
    EFI_CONVENTIONAL_MEMORY, which is not appropriate for runtime services
    as described in Section 2.2.2 (Runtime Services) of the UEFI
    Specification [1]. Since the PRM handler is a type of runtime service,
    this causes an exception when the PRM handler is called.
    
        [Firmware Bug]: Unable to handle paging request in EFI runtime service
        WARNING: CPU: 22 PID: 4330 at drivers/firmware/efi/runtime-wrappers.c:341
            __efi_queue_work+0x11c/0x170
        Call trace:
    
    Let PRMT find a block with EFI_MEMORY_RUNTIME for PRM handler and PRM
    context.
    
    If no suitable block is found, a warning message will be printed, but
    the procedure continues to manage the next PRM handler.
    
    However, if the PRM handler is actually called without proper allocation,
    it would result in a failure during error handling.
    
    By using the correct memory types for runtime services, ensure that the
    PRM handler and the context are properly mapped in the virtual address
    space during runtime, preventing the paging request error.
    
    The issue is really that only memory that has been remapped for runtime
    by the firmware can be used by the PRM handler, and so the region needs
    to have the EFI_MEMORY_RUNTIME attribute.
    
    Link: https://uefi.org/sites/default/files/resources/UEFI_Spec_2_10_Aug29.pdf # [1]
    Fixes: cefc7ca46235 ("ACPI: PRM: implement OperationRegion handler for the PlatformRtMechanism subtype")
    Cc: All applicable <stable@vger.kernel.org>
    Signed-off-by: Koba Ko <kobak@nvidia.com>
    Reviewed-by: Matthew R. Ochs <mochs@nvidia.com>
    Reviewed-by: Zhang Rui <rui.zhang@intel.com>
    Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
    Link: https://patch.msgid.link/20241012205010.4165798-1-kobak@nvidia.com
    [ rjw: Subject and changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ACPI: PRM: Remove unnecessary blank lines [+ + +]
Author: Aubrey Li <aubrey.li@intel.com>
Date:   Wed Oct 20 11:23:16 2021 +0800

    ACPI: PRM: Remove unnecessary blank lines
    
    [ Upstream commit caa2bd07f5c5f09acf62072906daeaa667e2b645 ]
    
    Just remove unnecessary blank lines, no other code changes
    
    Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Stable-dep-of: 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ASoC: cs42l51: Fix some error handling paths in cs42l51_probe() [+ + +]
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Sat Oct 26 22:46:34 2024 +0200

    ASoC: cs42l51: Fix some error handling paths in cs42l51_probe()
    
    [ Upstream commit d221b844ee79823ffc29b7badc4010bdb0960224 ]
    
    If devm_gpiod_get_optional() fails, we need to disable previously enabled
    regulators, as done in the other error handling path of the function.
    
    Also, gpiod_set_value_cansleep(, 1) needs to be called to undo a
    potential gpiod_set_value_cansleep(, 0).
    If the "reset" gpio is not defined, this additional call is just a no-op.
    
    This behavior is the same as the one already in the .remove() function.
    
    Fixes: 11b9cd748e31 ("ASoC: cs42l51: add reset management")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
    Link: https://patch.msgid.link/a5e5f4b9fb03f46abd2c93ed94b5c395972ce0d1.1729975570.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpf: Fix out-of-bounds write in trie_get_next_key() [+ + +]
Author: Byeonguk Jeong <jungbu2855@gmail.com>
Date:   Sat Oct 26 14:02:43 2024 +0900

    bpf: Fix out-of-bounds write in trie_get_next_key()
    
    [ Upstream commit 13400ac8fb80c57c2bfb12ebd35ee121ce9b4d21 ]
    
    trie_get_next_key() allocates a node stack with size trie->max_prefixlen,
    while it writes (trie->max_prefixlen + 1) nodes to the stack when it has
    full paths from the root to leaves. For example, consider a trie with
    max_prefixlen is 8, and the nodes with key 0x00/0, 0x00/1, 0x00/2, ...
    0x00/8 inserted. Subsequent calls to trie_get_next_key with _key with
    .prefixlen = 8 make 9 nodes be written on the node stack with size 8.
    
    Fixes: b471f2f1de8b ("bpf: implement MAP_GET_NEXT_KEY command for LPM_TRIE map")
    Signed-off-by: Byeonguk Jeong <jungbu2855@gmail.com>
    Reviewed-by: Toke Høiland-Jørgensen <toke@kernel.org>
    Tested-by: Hou Tao <houtao1@huawei.com>
    Acked-by: Hou Tao <houtao1@huawei.com>
    Link: https://lore.kernel.org/r/Zxx384ZfdlFYnz6J@localhost.localdomain
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
cgroup: Fix potential overflow issue when checking max_depth [+ + +]
Author: Xiu Jianfeng <xiujianfeng@huawei.com>
Date:   Sat Oct 12 07:22:46 2024 +0000

    cgroup: Fix potential overflow issue when checking max_depth
    
    [ Upstream commit 3cc4e13bb1617f6a13e5e6882465984148743cf4 ]
    
    cgroup.max.depth is the maximum allowed descent depth below the current
    cgroup. If the actual descent depth is equal or larger, an attempt to
    create a new child cgroup will fail. However due to the cgroup->max_depth
    is of int type and having the default value INT_MAX, the condition
    'level > cgroup->max_depth' will never be satisfied, and it will cause
    an overflow of the level after it reaches to INT_MAX.
    
    Fix it by starting the level from 0 and using '>=' instead.
    
    It's worth mentioning that this issue is unlikely to occur in reality,
    as it's impossible to have a depth of INT_MAX hierarchy, but should be
    be avoided logically.
    
    Fixes: 1a926e0bbab8 ("cgroup: implement hierarchy limits")
    Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
    Reviewed-by: Michal Koutný <mkoutny@suse.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/i915: Fix potential context UAFs [+ + +]
Author: Rob Clark <robdclark@chromium.org>
Date:   Tue Jan 3 15:49:46 2023 -0800

    drm/i915: Fix potential context UAFs
    
    commit afce71ff6daa9c0f852df0727fe32c6fb107f0fa upstream.
    
    gem_context_register() makes the context visible to userspace, and which
    point a separate thread can trigger the I915_GEM_CONTEXT_DESTROY ioctl.
    So we need to ensure that nothing uses the ctx ptr after this.  And we
    need to ensure that adding the ctx to the xarray is the *last* thing
    that gem_context_register() does with the ctx pointer.
    
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Fixes: eb4dedae920a ("drm/i915/gem: Delay tracking the GEM context until it is registered")
    Fixes: a4c1cdd34e2c ("drm/i915/gem: Delay context creation (v3)")
    Fixes: 49bd54b390c2 ("drm/i915: Track all user contexts per client")
    Cc: <stable@vger.kernel.org> # v5.10+
    Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
    [tursulin: Stable and fixes tags add/tidy.]
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230103234948.1218393-1-robdclark@gmail.com
    (cherry picked from commit bed4b455cf5374e68879be56971c1da563bcd90c)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [ Sherry: bp to fix CVE-2023-52913, ignore context conflicts due to
      missing commit 49bd54b390c2 "drm/i915: Track all user contexts per
      client")]
    Signed-off-by: Sherry Yang <sherry.yang@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
firmware: arm_sdei: Fix the input parameter of cpuhp_remove_state() [+ + +]
Author: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Date:   Wed Oct 16 16:47:40 2024 +0800

    firmware: arm_sdei: Fix the input parameter of cpuhp_remove_state()
    
    [ Upstream commit c83212d79be2c9886d3e6039759ecd388fd5fed1 ]
    
    In sdei_device_freeze(), the input parameter of cpuhp_remove_state() is
    passed as 'sdei_entry_point' by mistake. Change it to 'sdei_hp_state'.
    
    Fixes: d2c48b2387eb ("firmware: arm_sdei: Fix sleep from invalid context BUG")
    Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
    Reviewed-by: James Morse <james.morse@arm.com>
    Link: https://lore.kernel.org/r/20241016084740.183353-1-wangxiongfeng2@huawei.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fs/ntfs3: Additional check in ni_clear() [+ + +]
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date:   Mon Sep 9 15:39:10 2024 +0300

    fs/ntfs3: Additional check in ni_clear()
    
    [ Upstream commit d178944db36b3369b78a08ba520de109b89bf2a9 ]
    
    Checking of NTFS_FLAGS_LOG_REPLAYING added to prevent access to
    uninitialized bitmap during replay process.
    
    Reported-by: syzbot+3bfd2cc059ab93efcdb4@syzkaller.appspotmail.com
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

fs/ntfs3: Check if more than chunk-size bytes are written [+ + +]
Author: Andrew Ballance <andrewjballance@gmail.com>
Date:   Wed May 15 07:38:33 2024 -0500

    fs/ntfs3: Check if more than chunk-size bytes are written
    
    [ Upstream commit 9931122d04c6d431b2c11b5bb7b10f28584067f0 ]
    
    A incorrectly formatted chunk may decompress into
    more than LZNT_CHUNK_SIZE bytes and a index out of bounds
    will occur in s_max_off.
    
    Signed-off-by: Andrew Ballance <andrewjballance@gmail.com>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

fs/ntfs3: Fix possible deadlock in mi_read [+ + +]
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date:   Wed Aug 28 11:55:53 2024 +0300

    fs/ntfs3: Fix possible deadlock in mi_read
    
    [ Upstream commit 03b097099eef255fbf85ea6a786ae3c91b11f041 ]
    
    Mutex lock with another subclass used in ni_lock_dir().
    
    Reported-by: syzbot+bc7ca0ae4591cb2550f9@syzkaller.appspotmail.com
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

fs/ntfs3: Fix warning possible deadlock in ntfs_set_state [+ + +]
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date:   Mon Aug 19 16:26:22 2024 +0300

    fs/ntfs3: Fix warning possible deadlock in ntfs_set_state
    
    [ Upstream commit 5b2db723455a89dc96743d34d8bdaa23a402db2f ]
    
    Use non-zero subkey to skip analyzer warnings.
    
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Reported-by: syzbot+c2ada45c23d98d646118@syzkaller.appspotmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
gtp: allow -1 to be specified as file description from userspace [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue Oct 22 16:48:25 2024 +0200

    gtp: allow -1 to be specified as file description from userspace
    
    [ Upstream commit 7515e37bce5c428a56a9b04ea7e96b3f53f17150 ]
    
    Existing user space applications maintained by the Osmocom project are
    breaking since a recent fix that addresses incorrect error checking.
    
    Restore operation for user space programs that specify -1 as file
    descriptor to skip GTPv0 or GTPv1 only sockets.
    
    Fixes: defd8b3c37b0 ("gtp: fix a potential NULL pointer dereference")
    Reported-by: Pau Espin Pedrol <pespin@sysmocom.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Tested-by: Oliver Smith <osmith@sysmocom.de>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20241022144825.66740-1-pablo@netfilter.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iio: adc: ad7124: fix division by zero in ad7124_set_channel_odr() [+ + +]
Author: Zicheng Qu <quzicheng@huawei.com>
Date:   Tue Oct 22 13:43:30 2024 +0000

    iio: adc: ad7124: fix division by zero in ad7124_set_channel_odr()
    
    commit efa353ae1b0541981bc96dbf2e586387d0392baa upstream.
    
    In the ad7124_write_raw() function, parameter val can potentially
    be zero. This may lead to a division by zero when DIV_ROUND_CLOSEST()
    is called within ad7124_set_channel_odr(). The ad7124_write_raw()
    function is invoked through the sequence: iio_write_channel_raw() ->
    iio_write_channel_attribute() -> iio_channel_write(), with no checks
    in place to ensure val is non-zero.
    
    Cc: stable@vger.kernel.org
    Fixes: 7b8d045e497a ("iio: adc: ad7124: allow more than 8 channels")
    Signed-off-by: Zicheng Qu <quzicheng@huawei.com>
    Reviewed-by: Nuno Sa <nuno.sa@analog.com>
    Link: https://patch.msgid.link/20241022134330.574601-1-quzicheng@huawei.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: veml6030: fix microlux value calculation [+ + +]
Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Date:   Wed Oct 16 19:04:31 2024 +0200

    iio: light: veml6030: fix microlux value calculation
    
    commit 63dd163cd61dda6f38343776b42331cc6b7e56e0 upstream.
    
    The raw value conversion to obtain a measurement in lux as
    INT_PLUS_MICRO does not calculate the decimal part properly to display
    it as micro (in this case microlux). It only calculates the module to
    obtain the decimal part from a resolution that is 10000 times the
    provided in the datasheet (0.5376 lux/cnt for the veml6030). The
    resulting value must still be multiplied by 100 to make it micro.
    
    This bug was introduced with the original implementation of the driver.
    
    Only the illuminance channel is fixed becuase the scale is non sensical
    for the intensity channels anyway.
    
    Cc: stable@vger.kernel.org
    Fixes: 7b779f573c48 ("iio: light: add driver for veml6030 ambient light sensor")
    Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
    Link: https://patch.msgid.link/20241016-veml6030-fix-processed-micro-v1-1-4a5644796437@gmail.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipv4: ip_tunnel: Fix suspicious RCU usage warning in ip_tunnel_init_flow() [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Tue Oct 22 09:38:22 2024 +0300

    ipv4: ip_tunnel: Fix suspicious RCU usage warning in ip_tunnel_init_flow()
    
    [ Upstream commit ad4a3ca6a8e886f6491910a3ae5d53595e40597d ]
    
    There are code paths from which the function is called without holding
    the RCU read lock, resulting in a suspicious RCU usage warning [1].
    
    Fix by using l3mdev_master_upper_ifindex_by_index() which will acquire
    the RCU read lock before calling
    l3mdev_master_upper_ifindex_by_index_rcu().
    
    [1]
    WARNING: suspicious RCU usage
    6.12.0-rc3-custom-gac8f72681cf2 #141 Not tainted
    -----------------------------
    net/core/dev.c:876 RCU-list traversed in non-reader section!!
    
    other info that might help us debug this:
    
    rcu_scheduler_active = 2, debug_locks = 1
    1 lock held by ip/361:
     #0: ffffffff86fc7cb0 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x377/0xf60
    
    stack backtrace:
    CPU: 3 UID: 0 PID: 361 Comm: ip Not tainted 6.12.0-rc3-custom-gac8f72681cf2 #141
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    Call Trace:
     <TASK>
     dump_stack_lvl+0xba/0x110
     lockdep_rcu_suspicious.cold+0x4f/0xd6
     dev_get_by_index_rcu+0x1d3/0x210
     l3mdev_master_upper_ifindex_by_index_rcu+0x2b/0xf0
     ip_tunnel_bind_dev+0x72f/0xa00
     ip_tunnel_newlink+0x368/0x7a0
     ipgre_newlink+0x14c/0x170
     __rtnl_newlink+0x1173/0x19c0
     rtnl_newlink+0x6c/0xa0
     rtnetlink_rcv_msg+0x3cc/0xf60
     netlink_rcv_skb+0x171/0x450
     netlink_unicast+0x539/0x7f0
     netlink_sendmsg+0x8c1/0xd80
     ____sys_sendmsg+0x8f9/0xc20
     ___sys_sendmsg+0x197/0x1e0
     __sys_sendmsg+0x122/0x1f0
     do_syscall_64+0xbb/0x1d0
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Fixes: db53cd3d88dc ("net: Handle l3mdev in ip_tunnel_init_flow")
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Link: https://patch.msgid.link/20241022063822.462057-1-idosch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ksmbd: fix user-after-free from session log off [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Tue Oct 8 22:42:57 2024 +0900

    ksmbd: fix user-after-free from session log off
    
    [ Upstream commit 7aa8804c0b67b3cb263a472d17f2cb50d7f1a930 ]
    
    There is racy issue between smb2 session log off and smb2 session setup.
    It will cause user-after-free from session log off.
    This add session_lock when setting SMB2_SESSION_EXPIRED and referece
    count to session struct not to free session while it is being used.
    
    Cc: stable@vger.kernel.org # v5.15+
    Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-25282
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: Linux 5.15.171 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Nov 8 16:25:56 2024 +0100

    Linux 5.15.171
    
    Link: https://lore.kernel.org/r/20241106120259.955073160@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Hardik Garg <hargar@linux.microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mac80211: Add support to trigger sta disconnect on hardware restart [+ + +]
Author: Youghandhar Chintala <youghand@codeaurora.org>
Date:   Tue Mar 8 17:23:24 2022 +0530

    mac80211: Add support to trigger sta disconnect on hardware restart
    
    [ Upstream commit 7d352ccf1e9935b5222ca84e8baeb07a0c8f94b9 ]
    
    Currently in case of target hardware restart, we just reconfig and
    re-enable the security keys and enable the network queues to start
    data traffic back from where it was interrupted.
    
    Many ath10k wifi chipsets have sequence numbers for the data
    packets assigned by firmware and the mac sequence number will
    restart from zero after target hardware restart leading to mismatch
    in the sequence number expected by the remote peer vs the sequence
    number of the frame sent by the target firmware.
    
    This mismatch in sequence number will cause out-of-order packets
    on the remote peer and all the frames sent by the device are dropped
    until we reach the sequence number which was sent before we restarted
    the target hardware
    
    In order to fix this, we trigger a sta disconnect, in case of target
    hw restart. After this there will be a fresh connection and thereby
    avoiding the dropping of frames by remote peer.
    
    The right fix would be to pull the entire data path into the host
    which is not feasible or would need lots of complex changes and
    will still be inefficient.
    
    Tested on ath10k using WCN3990, QCA6174
    
    Signed-off-by: Youghandhar Chintala <youghand@codeaurora.org>
    Link: https://lore.kernel.org/r/20220308115325.5246-2-youghand@codeaurora.org
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Stable-dep-of: 07a6e3b78a65 ("wifi: iwlwifi: mvm: Fix response handling in iwl_mvm_send_recovery_cmd()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mac80211: always have ieee80211_sta_restart() [+ + +]
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sat Mar 12 22:19:58 2022 +0100

    mac80211: always have ieee80211_sta_restart()
    
    commit 3fa5a0f5b0d69e31c6476cd81afeca3cc25a4927 upstream.
    
    When CONFIG_PM isn't defined we don't have the function
    ieee80211_sta_restart() compiled in, but we always need
    it now for firmware restart. Move it out of the ifdef.
    
    Fixes: 7d352ccf1e99 ("mac80211: Add support to trigger sta disconnect on hardware restart")
    Link: https://lore.kernel.org/r/20220312221957.1fa96c72db51.I8ecaa5f9402fede0272161e0531ab930b97fba3e@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mac80211: do drv_reconfig_complete() before restarting all [+ + +]
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Nov 29 15:32:40 2021 +0200

    mac80211: do drv_reconfig_complete() before restarting all
    
    [ Upstream commit 13dee10b30c058ee2c58c5da00339cc0d4201aa6 ]
    
    When we reconfigure, the driver might do some things to complete
    the reconfiguration. It's strange and could be broken in some
    cases because we restart other works (e.g. remain-on-channel and
    TX) before this happens, yet only start queues later.
    
    Change this to do the reconfig complete when reconfiguration is
    actually complete, not when we've already started doing other
    things again.
    
    For iwlwifi, this should fix a race where the reconfig can race
    with TX, for ath10k and ath11k that also use this it won't make
    a difference because they just start queues there, and mac80211
    also stopped the queues and will restart them later as before.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211129152938.cab99f22fe19.Iefe494687f15fd85f77c1b989d1149c8efdfdc36@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Stable-dep-of: 07a6e3b78a65 ("wifi: iwlwifi: mvm: Fix response handling in iwl_mvm_send_recovery_cmd()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mac80211: MAC80211_MESSAGE_TRACING should depend on TRACING [+ + +]
Author: Geert Uytterhoeven <geert@linux-m68k.org>
Date:   Tue Sep 24 14:08:57 2024 +0200

    mac80211: MAC80211_MESSAGE_TRACING should depend on TRACING
    
    [ Upstream commit b3e046c31441d182b954fc2f57b2dc38c71ad4bc ]
    
    When tracing is disabled, there is no point in asking the user about
    enabling tracing of all mac80211 debug messages.
    
    Fixes: 3fae0273168026ed ("mac80211: trace debug messages")
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Link: https://patch.msgid.link/85bbe38ce0df13350f45714e2dc288cc70947a19.1727179690.git.geert@linux-m68k.org
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
misc: sgi-gru: Don't disable preemption in GRU driver [+ + +]
Author: Dimitri Sivanich <sivanich@hpe.com>
Date:   Thu Sep 19 07:34:50 2024 -0500

    misc: sgi-gru: Don't disable preemption in GRU driver
    
    [ Upstream commit b983b271662bd6104d429b0fd97af3333ba760bf ]
    
    Disabling preemption in the GRU driver is unnecessary, and clashes with
    sleeping locks in several code paths.  Remove preempt_disable and
    preempt_enable from the GRU driver.
    
    Signed-off-by: Dimitri Sivanich <sivanich@hpe.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm/page_alloc: call check_new_pages() while zone spinlock is not held [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Tue Mar 22 14:43:57 2022 -0700

    mm/page_alloc: call check_new_pages() while zone spinlock is not held
    
    [ Upstream commit 3313204c8ad553cf93f1ee8cc89456c73a7df938 ]
    
    For high order pages not using pcp, rmqueue() is currently calling the
    costly check_new_pages() while zone spinlock is held, and hard irqs
    masked.
    
    This is not needed, we can release the spinlock sooner to reduce zone
    spinlock contention.
    
    Note that after this patch, we call __mod_zone_freepage_state() before
    deciding to leak the page because it is in bad state.
    
    Link: https://lkml.kernel.org/r/20220304170215.1868106-1-eric.dumazet@gmail.com
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Shakeel Butt <shakeelb@google.com>
    Acked-by: David Rientjes <rientjes@google.com>
    Acked-by: Mel Gorman <mgorman@techsingularity.net>
    Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Wei Xu <weixugc@google.com>
    Cc: Greg Thelen <gthelen@google.com>
    Cc: Hugh Dickins <hughd@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Stable-dep-of: 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm/page_alloc: explicitly define how __GFP_HIGH non-blocking allocations accesses reserves [+ + +]
Author: Mel Gorman <mgorman@techsingularity.net>
Date:   Fri Jan 13 11:12:16 2023 +0000

    mm/page_alloc: explicitly define how __GFP_HIGH non-blocking allocations accesses reserves
    
    [ Upstream commit 1ebbb21811b76c3b932959787f37985af36f62fa ]
    
    GFP_ATOMIC allocations get flagged ALLOC_HARDER which is a vague
    description.  In preparation for the removal of GFP_ATOMIC redefine
    __GFP_ATOMIC to simply mean non-blocking and renaming ALLOC_HARDER to
    ALLOC_NON_BLOCK accordingly.  __GFP_HIGH is required for access to
    reserves but non-blocking is granted more access.  For example, GFP_NOWAIT
    is non-blocking but has no special access to reserves.  A __GFP_NOFAIL
    blocking allocation is granted access similar to __GFP_HIGH if the only
    alternative is an OOM kill.
    
    Link: https://lkml.kernel.org/r/20230113111217.14134-6-mgorman@techsingularity.net
    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: NeilBrown <neilb@suse.de>
    Cc: Thierry Reding <thierry.reding@gmail.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm/page_alloc: explicitly define what alloc flags deplete min reserves [+ + +]
Author: Mel Gorman <mgorman@techsingularity.net>
Date:   Fri Jan 13 11:12:15 2023 +0000

    mm/page_alloc: explicitly define what alloc flags deplete min reserves
    
    [ Upstream commit ab3508854353793cd35e348fde89a5c09b2fd8b5 ]
    
    As there are more ALLOC_ flags that affect reserves, define what flags
    affect reserves and clarify the effect of each flag.
    
    Link: https://lkml.kernel.org/r/20230113111217.14134-5-mgorman@techsingularity.net
    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: NeilBrown <neilb@suse.de>
    Cc: Thierry Reding <thierry.reding@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm/page_alloc: explicitly record high-order atomic allocations in alloc_flags [+ + +]
Author: Mel Gorman <mgorman@techsingularity.net>
Date:   Fri Jan 13 11:12:14 2023 +0000

    mm/page_alloc: explicitly record high-order atomic allocations in alloc_flags
    
    [ Upstream commit eb2e2b425c6984ca8034448a3f2c680622bd3d4d ]
    
    A high-order ALLOC_HARDER allocation is assumed to be atomic.  While that
    is accurate, it changes later in the series.  In preparation, explicitly
    record high-order atomic allocations in gfp_to_alloc_flags().
    
    Link: https://lkml.kernel.org/r/20230113111217.14134-4-mgorman@techsingularity.net
    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: NeilBrown <neilb@suse.de>
    Cc: Thierry Reding <thierry.reding@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm/page_alloc: fix tracepoint mm_page_alloc_zone_locked() [+ + +]
Author: Wonhyuk Yang <vvghjk1234@gmail.com>
Date:   Thu May 19 14:08:54 2022 -0700

    mm/page_alloc: fix tracepoint mm_page_alloc_zone_locked()
    
    [ Upstream commit 10e0f7530205799e7e971aba699a7cb3a47456de ]
    
    Currently, trace point mm_page_alloc_zone_locked() doesn't show correct
    information.
    
    First, when alloc_flag has ALLOC_HARDER/ALLOC_CMA, page can be allocated
    from MIGRATE_HIGHATOMIC/MIGRATE_CMA.  Nevertheless, tracepoint use
    requested migration type not MIGRATE_HIGHATOMIC and MIGRATE_CMA.
    
    Second, after commit 44042b4498728 ("mm/page_alloc: allow high-order pages
    to be stored on the per-cpu lists") percpu-list can store high order
    pages.  But trace point determine whether it is a refiil of percpu-list by
    comparing requested order and 0.
    
    To handle these problems, make mm_page_alloc_zone_locked() only be called
    by __rmqueue_smallest with correct migration type.  With a new argument
    called percpu_refill, it can show roughly whether it is a refill of
    percpu-list.
    
    Link: https://lkml.kernel.org/r/20220512025307.57924-1-vvghjk1234@gmail.com
    Signed-off-by: Wonhyuk Yang <vvghjk1234@gmail.com>
    Acked-by: Mel Gorman <mgorman@suse.de>
    Cc: Baik Song An <bsahn@etri.re.kr>
    Cc: Hong Yeon Kim <kimhy@etri.re.kr>
    Cc: Taeung Song <taeung@reallinux.co.kr>
    Cc: <linuxgeek@linuxgeek.io>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves [+ + +]
Author: Matt Fleming <mfleming@cloudflare.com>
Date:   Fri Oct 11 13:07:37 2024 +0100

    mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves
    
    [ Upstream commit 281dd25c1a018261a04d1b8bf41a0674000bfe38 ]
    
    Under memory pressure it's possible for GFP_ATOMIC order-0 allocations to
    fail even though free pages are available in the highatomic reserves.
    GFP_ATOMIC allocations cannot trigger unreserve_highatomic_pageblock()
    since it's only run from reclaim.
    
    Given that such allocations will pass the watermarks in
    __zone_watermark_unusable_free(), it makes sense to fallback to highatomic
    reserves the same way that ALLOC_OOM can.
    
    This fixes order-0 page allocation failures observed on Cloudflare's fleet
    when handling network packets:
    
      kswapd1: page allocation failure: order:0, mode:0x820(GFP_ATOMIC),
      nodemask=(null),cpuset=/,mems_allowed=0-7
      CPU: 10 PID: 696 Comm: kswapd1 Kdump: loaded Tainted: G           O 6.6.43-CUSTOM #1
      Hardware name: MACHINE
      Call Trace:
       <IRQ>
       dump_stack_lvl+0x3c/0x50
       warn_alloc+0x13a/0x1c0
       __alloc_pages_slowpath.constprop.0+0xc9d/0xd10
       __alloc_pages+0x327/0x340
       __napi_alloc_skb+0x16d/0x1f0
       bnxt_rx_page_skb+0x96/0x1b0 [bnxt_en]
       bnxt_rx_pkt+0x201/0x15e0 [bnxt_en]
       __bnxt_poll_work+0x156/0x2b0 [bnxt_en]
       bnxt_poll+0xd9/0x1c0 [bnxt_en]
       __napi_poll+0x2b/0x1b0
       bpf_trampoline_6442524138+0x7d/0x1000
       __napi_poll+0x5/0x1b0
       net_rx_action+0x342/0x740
       handle_softirqs+0xcf/0x2b0
       irq_exit_rcu+0x6c/0x90
       sysvec_apic_timer_interrupt+0x72/0x90
       </IRQ>
    
    [mfleming@cloudflare.com: update comment]
      Link: https://lkml.kernel.org/r/20241015125158.3597702-1-matt@readmodwrite.com
    Link: https://lkml.kernel.org/r/20241011120737.3300370-1-matt@readmodwrite.com
    Link: https://lore.kernel.org/all/CAGis_TWzSu=P7QJmjD58WWiu3zjMTVKSzdOwWE8ORaGytzWJwQ@mail.gmail.com/
    Fixes: 1d91df85f399 ("mm/page_alloc: handle a missing case for memalloc_nocma_{save/restore} APIs")
    Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
    Suggested-by: Vlastimil Babka <vbabka@suse.cz>
    Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm/page_alloc: rename ALLOC_HIGH to ALLOC_MIN_RESERVE [+ + +]
Author: Mel Gorman <mgorman@techsingularity.net>
Date:   Fri Jan 13 11:12:12 2023 +0000

    mm/page_alloc: rename ALLOC_HIGH to ALLOC_MIN_RESERVE
    
    [ Upstream commit 524c48072e5673f4511f1ad81493e2485863fd65 ]
    
    Patch series "Discard __GFP_ATOMIC", v3.
    
    Neil's patch has been residing in mm-unstable as commit 2fafb4fe8f7a ("mm:
    discard __GFP_ATOMIC") for a long time and recently brought up again.
    Most recently, I was worried that __GFP_HIGH allocations could use
    high-order atomic reserves which is unintentional but there was no
    response so lets revisit -- this series reworks how min reserves are used,
    protects highorder reserves and then finishes with Neil's patch with very
    minor modifications so it fits on top.
    
    There was a review discussion on renaming __GFP_DIRECT_RECLAIM to
    __GFP_ALLOW_BLOCKING but I didn't think it was that big an issue and is
    orthogonal to the removal of __GFP_ATOMIC.
    
    There were some concerns about how the gfp flags affect the min reserves
    but it never reached a solid conclusion so I made my own attempt.
    
    The series tries to iron out some of the details on how reserves are used.
    ALLOC_HIGH becomes ALLOC_MIN_RESERVE and ALLOC_HARDER becomes
    ALLOC_NON_BLOCK and documents how the reserves are affected.  For example,
    ALLOC_NON_BLOCK (no direct reclaim) on its own allows 25% of the min
    reserve.  ALLOC_MIN_RESERVE (__GFP_HIGH) allows 50% and both combined
    allows deeper access again.  ALLOC_OOM allows access to 75%.
    
    High-order atomic allocations are explicitly handled with the caveat that
    no __GFP_ATOMIC flag means that any high-order allocation that specifies
    GFP_HIGH and cannot enter direct reclaim will be treated as if it was
    GFP_ATOMIC.
    
    This patch (of 6):
    
    __GFP_HIGH aliases to ALLOC_HIGH but the name does not really hint what it
    means.  As ALLOC_HIGH is internal to the allocator, rename it to
    ALLOC_MIN_RESERVE to document that the min reserves can be depleted.
    
    Link: https://lkml.kernel.org/r/20230113111217.14134-1-mgorman@techsingularity.net
    Link: https://lkml.kernel.org/r/20230113111217.14134-2-mgorman@techsingularity.net
    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: NeilBrown <neilb@suse.de>
    Cc: Thierry Reding <thierry.reding@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm/page_alloc: split out buddy removal code from rmqueue into separate helper [+ + +]
Author: Mel Gorman <mgorman@techsingularity.net>
Date:   Fri Jun 24 13:54:19 2022 +0100

    mm/page_alloc: split out buddy removal code from rmqueue into separate helper
    
    [ Upstream commit 589d9973c1d2c3344a94a57441071340b0c71097 ]
    
    This is a preparation page to allow the buddy removal code to be reused in
    a later patch.
    
    No functional change.
    
    Link: https://lkml.kernel.org/r/20220624125423.6126-4-mgorman@techsingularity.net
    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Tested-by: Minchan Kim <minchan@kernel.org>
    Acked-by: Minchan Kim <minchan@kernel.org>
    Reviewed-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Tested-by: Yu Zhao <yuzhao@google.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Marcelo Tosatti <mtosatti@redhat.com>
    Cc: Marek Szyprowski <m.szyprowski@samsung.com>
    Cc: Michal Hocko <mhocko@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm/page_alloc: treat RT tasks similar to __GFP_HIGH [+ + +]
Author: Mel Gorman <mgorman@techsingularity.net>
Date:   Fri Jan 13 11:12:13 2023 +0000

    mm/page_alloc: treat RT tasks similar to __GFP_HIGH
    
    [ Upstream commit c988dcbecf3fd5430921eaa3fe9054754f76d185 ]
    
    RT tasks are allowed to dip below the min reserve but ALLOC_HARDER is
    typically combined with ALLOC_MIN_RESERVE so RT tasks are a little
    unusual.  While there is some justification for allowing RT tasks access
    to memory reserves, there is a strong chance that a RT task that is also
    under memory pressure is at risk of missing deadlines anyway.  Relax how
    much reserves an RT task can access by treating it the same as __GFP_HIGH
    allocations.
    
    Note that in a future kernel release that the RT special casing will be
    removed.  Hard realtime tasks should be locking down resources in advance
    and ensuring enough memory is available.  Even a soft-realtime task like
    audio or video live decoding which cannot jitter should be allocating both
    memory and any disk space required up-front before the recording starts
    instead of relying on reserves.  At best, reserve access will only delay
    the problem by a very short interval.
    
    Link: https://lkml.kernel.org/r/20230113111217.14134-3-mgorman@techsingularity.net
    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: NeilBrown <neilb@suse.de>
    Cc: Thierry Reding <thierry.reding@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm: shmem: fix data-race in shmem_getattr() [+ + +]
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Mon Sep 9 21:35:58 2024 +0900

    mm: shmem: fix data-race in shmem_getattr()
    
    commit d949d1d14fa281ace388b1de978e8f2cd52875cf upstream.
    
    I got the following KCSAN report during syzbot testing:
    
    ==================================================================
    BUG: KCSAN: data-race in generic_fillattr / inode_set_ctime_current
    
    write to 0xffff888102eb3260 of 4 bytes by task 6565 on cpu 1:
     inode_set_ctime_to_ts include/linux/fs.h:1638 [inline]
     inode_set_ctime_current+0x169/0x1d0 fs/inode.c:2626
     shmem_mknod+0x117/0x180 mm/shmem.c:3443
     shmem_create+0x34/0x40 mm/shmem.c:3497
     lookup_open fs/namei.c:3578 [inline]
     open_last_lookups fs/namei.c:3647 [inline]
     path_openat+0xdbc/0x1f00 fs/namei.c:3883
     do_filp_open+0xf7/0x200 fs/namei.c:3913
     do_sys_openat2+0xab/0x120 fs/open.c:1416
     do_sys_open fs/open.c:1431 [inline]
     __do_sys_openat fs/open.c:1447 [inline]
     __se_sys_openat fs/open.c:1442 [inline]
     __x64_sys_openat+0xf3/0x120 fs/open.c:1442
     x64_sys_call+0x1025/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:258
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0x54/0x120 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    read to 0xffff888102eb3260 of 4 bytes by task 3498 on cpu 0:
     inode_get_ctime_nsec include/linux/fs.h:1623 [inline]
     inode_get_ctime include/linux/fs.h:1629 [inline]
     generic_fillattr+0x1dd/0x2f0 fs/stat.c:62
     shmem_getattr+0x17b/0x200 mm/shmem.c:1157
     vfs_getattr_nosec fs/stat.c:166 [inline]
     vfs_getattr+0x19b/0x1e0 fs/stat.c:207
     vfs_statx_path fs/stat.c:251 [inline]
     vfs_statx+0x134/0x2f0 fs/stat.c:315
     vfs_fstatat+0xec/0x110 fs/stat.c:341
     __do_sys_newfstatat fs/stat.c:505 [inline]
     __se_sys_newfstatat+0x58/0x260 fs/stat.c:499
     __x64_sys_newfstatat+0x55/0x70 fs/stat.c:499
     x64_sys_call+0x141f/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:263
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0x54/0x120 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    value changed: 0x2755ae53 -> 0x27ee44d3
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 0 UID: 0 PID: 3498 Comm: udevd Not tainted 6.11.0-rc6-syzkaller-00326-gd1f2d51b711a-dirty #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
    ==================================================================
    
    When calling generic_fillattr(), if you don't hold read lock, data-race
    will occur in inode member variables, which can cause unexpected
    behavior.
    
    Since there is no special protection when shmem_getattr() calls
    generic_fillattr(), data-race occurs by functions such as shmem_unlink()
    or shmem_mknod(). This can cause unexpected results, so commenting it out
    is not enough.
    
    Therefore, when calling generic_fillattr() from shmem_getattr(), it is
    appropriate to protect the inode using inode_lock_shared() and
    inode_unlock_shared() to prevent data-race.
    
    Link: https://lkml.kernel.org/r/20240909123558.70229-1-aha310510@gmail.com
    Fixes: 44a30220bc0a ("shmem: recalculate file inode when fstat")
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    Reported-by: syzbot <syzkaller@googlegroup.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Yu Zhao <yuzhao@google.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/sched: stop qdisc_tree_reduce_backlog on TC_H_ROOT [+ + +]
Author: Pedro Tammela <pctammela@mojatatu.com>
Date:   Thu Oct 24 12:55:47 2024 -0400

    net/sched: stop qdisc_tree_reduce_backlog on TC_H_ROOT
    
    [ Upstream commit 2e95c4384438adeaa772caa560244b1a2efef816 ]
    
    In qdisc_tree_reduce_backlog, Qdiscs with major handle ffff: are assumed
    to be either root or ingress. This assumption is bogus since it's valid
    to create egress qdiscs with major handle ffff:
    Budimir Markovic found that for qdiscs like DRR that maintain an active
    class list, it will cause a UAF with a dangling class pointer.
    
    In 066a3b5b2346, the concern was to avoid iterating over the ingress
    qdisc since its parent is itself. The proper fix is to stop when parent
    TC_H_ROOT is reached because the only way to retrieve ingress is when a
    hierarchy which does not contain a ffff: major handle call into
    qdisc_lookup with TC_H_MAJ(TC_H_ROOT).
    
    In the scenario where major ffff: is an egress qdisc in any of the tree
    levels, the updates will also propagate to TC_H_ROOT, which then the
    iteration must stop.
    
    Fixes: 066a3b5b2346 ("[NET_SCHED] sch_api: fix qdisc_tree_decrease_qlen() loop")
    Reported-by: Budimir Markovic <markovicbudimir@gmail.com>
    Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Tested-by: Victor Nogueira <victor@mojatatu.com>
    Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    
     net/sched/sch_api.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    Reviewed-by: Simon Horman <horms@kernel.org>
    
    Link: https://patch.msgid.link/20241024165547.418570-1-jhs@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: amd: mvme147: Fix probe banner message [+ + +]
Author: Daniel Palmer <daniel@0x0f.com>
Date:   Mon Oct 7 19:43:17 2024 +0900

    net: amd: mvme147: Fix probe banner message
    
    [ Upstream commit 82c5b53140faf89c31ea2b3a0985a2f291694169 ]
    
    Currently this driver prints this line with what looks like
    a rogue format specifier when the device is probed:
    [    2.840000] eth%d: MVME147 at 0xfffe1800, irq 12, Hardware Address xx:xx:xx:xx:xx:xx
    
    Change the printk() for netdev_info() and move it after the
    registration has completed so it prints out the name of the
    interface properly.
    
    Signed-off-by: Daniel Palmer <daniel@0x0f.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension [+ + +]
Author: Benoît Monin <benoit.monin@gmx.fr>
Date:   Thu Oct 24 16:01:54 2024 +0200

    net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension
    
    [ Upstream commit 04c20a9356f283da623903e81e7c6d5df7e4dc3c ]
    
    As documented in skbuff.h, devices with NETIF_F_IPV6_CSUM capability
    can only checksum TCP and UDP over IPv6 if the IP header does not
    contains extension.
    
    This is enforced for UDP packets emitted from user-space to an IPv6
    address as they go through ip6_make_skb(), which calls
    __ip6_append_data() where a check is done on the header size before
    setting CHECKSUM_PARTIAL.
    
    But the introduction of UDP encapsulation with fou6 added a code-path
    where it is possible to get an skb with a partial UDP checksum and an
    IPv6 header with extension:
    * fou6 adds a UDP header with a partial checksum if the inner packet
    does not contains a valid checksum.
    * ip6_tunnel adds an IPv6 header with a destination option extension
    header if encap_limit is non-zero (the default value is 4).
    
    The thread linked below describes in more details how to reproduce the
    problem with GRE-in-UDP tunnel.
    
    Add a check on the network header size in skb_csum_hwoffload_help() to
    make sure no IPv6 packet with extension header is handed to a network
    device with NETIF_F_IPV6_CSUM capability.
    
    Link: https://lore.kernel.org/netdev/26548921.1r3eYUQgxm@benoit.monin/T/#u
    Fixes: aa3463d65e7b ("fou: Add encap ops for IPv6 tunnels")
    Signed-off-by: Benoît Monin <benoit.monin@gmx.fr>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/5fbeecfc311ea182aa1d1c771725ab8b4cac515e.1729778144.git.benoit.monin@gmx.fr
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: stmmac: TSO: Fix unbalanced DMA map/unmap for non-paged SKB data [+ + +]
Author: Furong Xu <0x1207@gmail.com>
Date:   Mon Oct 21 14:10:23 2024 +0800

    net: stmmac: TSO: Fix unbalanced DMA map/unmap for non-paged SKB data
    
    [ Upstream commit 66600fac7a984dea4ae095411f644770b2561ede ]
    
    In case the non-paged data of a SKB carries protocol header and protocol
    payload to be transmitted on a certain platform that the DMA AXI address
    width is configured to 40-bit/48-bit, or the size of the non-paged data
    is bigger than TSO_MAX_BUFF_SIZE on a certain platform that the DMA AXI
    address width is configured to 32-bit, then this SKB requires at least
    two DMA transmit descriptors to serve it.
    
    For example, three descriptors are allocated to split one DMA buffer
    mapped from one piece of non-paged data:
        dma_desc[N + 0],
        dma_desc[N + 1],
        dma_desc[N + 2].
    Then three elements of tx_q->tx_skbuff_dma[] will be allocated to hold
    extra information to be reused in stmmac_tx_clean():
        tx_q->tx_skbuff_dma[N + 0],
        tx_q->tx_skbuff_dma[N + 1],
        tx_q->tx_skbuff_dma[N + 2].
    Now we focus on tx_q->tx_skbuff_dma[entry].buf, which is the DMA buffer
    address returned by DMA mapping call. stmmac_tx_clean() will try to
    unmap the DMA buffer _ONLY_IF_ tx_q->tx_skbuff_dma[entry].buf
    is a valid buffer address.
    
    The expected behavior that saves DMA buffer address of this non-paged
    data to tx_q->tx_skbuff_dma[entry].buf is:
        tx_q->tx_skbuff_dma[N + 0].buf = NULL;
        tx_q->tx_skbuff_dma[N + 1].buf = NULL;
        tx_q->tx_skbuff_dma[N + 2].buf = dma_map_single();
    Unfortunately, the current code misbehaves like this:
        tx_q->tx_skbuff_dma[N + 0].buf = dma_map_single();
        tx_q->tx_skbuff_dma[N + 1].buf = NULL;
        tx_q->tx_skbuff_dma[N + 2].buf = NULL;
    
    On the stmmac_tx_clean() side, when dma_desc[N + 0] is closed by the
    DMA engine, tx_q->tx_skbuff_dma[N + 0].buf is a valid buffer address
    obviously, then the DMA buffer will be unmapped immediately.
    There may be a rare case that the DMA engine does not finish the
    pending dma_desc[N + 1], dma_desc[N + 2] yet. Now things will go
    horribly wrong, DMA is going to access a unmapped/unreferenced memory
    region, corrupted data will be transmited or iommu fault will be
    triggered :(
    
    In contrast, the for-loop that maps SKB fragments behaves perfectly
    as expected, and that is how the driver should do for both non-paged
    data and paged frags actually.
    
    This patch corrects DMA map/unmap sequences by fixing the array index
    for tx_q->tx_skbuff_dma[entry].buf when assigning DMA buffer address.
    
    Tested and verified on DWXGMAC CORE 3.20a
    
    Reported-by: Suraj Jaiswal <quic_jsuraj@quicinc.com>
    Fixes: f748be531d70 ("stmmac: support new GMAC4")
    Signed-off-by: Furong Xu <0x1207@gmail.com>
    Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20241021061023.2162701-1-0x1207@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netdevsim: Add trailing zero to terminate the string in nsim_nexthop_bucket_activity_write() [+ + +]
Author: Zichen Xie <zichenxie0106@gmail.com>
Date:   Tue Oct 22 12:19:08 2024 -0500

    netdevsim: Add trailing zero to terminate the string in nsim_nexthop_bucket_activity_write()
    
    [ Upstream commit 4ce1f56a1eaced2523329bef800d004e30f2f76c ]
    
    This was found by a static analyzer.
    We should not forget the trailing zero after copy_from_user()
    if we will further do some string operations, sscanf() in this
    case. Adding a trailing zero will ensure that the function
    performs properly.
    
    Fixes: c6385c0b67c5 ("netdevsim: Allow reporting activity on nexthop buckets")
    Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
    Reviewed-by: Petr Machata <petrm@nvidia.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20241022171907.8606-1-zichenxie0106@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netfilter: Fix use-after-free in get_info() [+ + +]
Author: Dong Chenchen <dongchenchen2@huawei.com>
Date:   Thu Oct 24 09:47:01 2024 +0800

    netfilter: Fix use-after-free in get_info()
    
    [ Upstream commit f48d258f0ac540f00fa617dac496c4c18b5dc2fa ]
    
    ip6table_nat module unload has refcnt warning for UAF. call trace is:
    
    WARNING: CPU: 1 PID: 379 at kernel/module/main.c:853 module_put+0x6f/0x80
    Modules linked in: ip6table_nat(-)
    CPU: 1 UID: 0 PID: 379 Comm: ip6tables Not tainted 6.12.0-rc4-00047-gc2ee9f594da8-dirty #205
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
    BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
    RIP: 0010:module_put+0x6f/0x80
    Call Trace:
     <TASK>
     get_info+0x128/0x180
     do_ip6t_get_ctl+0x6a/0x430
     nf_getsockopt+0x46/0x80
     ipv6_getsockopt+0xb9/0x100
     rawv6_getsockopt+0x42/0x190
     do_sock_getsockopt+0xaa/0x180
     __sys_getsockopt+0x70/0xc0
     __x64_sys_getsockopt+0x20/0x30
     do_syscall_64+0xa2/0x1a0
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Concurrent execution of module unload and get_info() trigered the warning.
    The root cause is as follows:
    
    cpu0                                  cpu1
    module_exit
    //mod->state = MODULE_STATE_GOING
      ip6table_nat_exit
        xt_unregister_template
            kfree(t)
            //removed from templ_list
                                          getinfo()
                                              t = xt_find_table_lock
                                                    list_for_each_entry(tmpl, &xt_templates[af]...)
                                                            if (strcmp(tmpl->name, name))
                                                                    continue;  //table not found
                                                            try_module_get
                                                    list_for_each_entry(t, &xt_net->tables[af]...)
                                                            return t;  //not get refcnt
                                              module_put(t->me) //uaf
        unregister_pernet_subsys
        //remove table from xt_net list
    
    While xt_table module was going away and has been removed from
    xt_templates list, we couldnt get refcnt of xt_table->me. Check
    module in xt_net->tables list re-traversal to fix it.
    
    Fixes: fdacd57c79b7 ("netfilter: x_tables: never register tables by default")
    Signed-off-by: Dong Chenchen <dongchenchen2@huawei.com>
    Reviewed-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nft_payload: sanitize offset and length before calling skb_checksum() [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Wed Oct 30 23:13:48 2024 +0100

    netfilter: nft_payload: sanitize offset and length before calling skb_checksum()
    
    [ Upstream commit d5953d680f7e96208c29ce4139a0e38de87a57fe ]
    
    If access to offset + length is larger than the skbuff length, then
    skb_checksum() triggers BUG_ON().
    
    skb_checksum() internally subtracts the length parameter while iterating
    over skbuff, BUG_ON(len) at the end of it checks that the expected
    length to be included in the checksum calculation is fully consumed.
    
    Fixes: 7ec3f7b47b8d ("netfilter: nft_payload: add packet mangling support")
    Reported-by: Slavin Liu <slavin-ayu@qq.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
NFS: remove revoked delegation from server's delegation list [+ + +]
Author: Dai Ngo <dai.ngo@oracle.com>
Date:   Tue Oct 8 15:58:07 2024 -0700

    NFS: remove revoked delegation from server's delegation list
    
    [ Upstream commit 7ef60108069b7e3cc66432304e1dd197d5c0a9b5 ]
    
    After the delegation is returned to the NFS server remove it
    from the server's delegations list to reduce the time it takes
    to scan this list.
    
    Network trace captured while running the below script shows the
    time taken to service the CB_RECALL increases gradually due to
    the overhead of traversing the delegation list in
    nfs_delegation_find_inode_server.
    
    The NFS server in this test is a Solaris server which issues
    CB_RECALL when receiving the all-zero stateid in the SETATTR.
    
    mount=/mnt/data
    for i in $(seq 1 20)
    do
       echo $i
       mkdir $mount/testtarfile$i
       time  tar -C $mount/testtarfile$i -xf 5000_files.tar
    done
    
    Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
    Reviewed-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nilfs2: fix kernel bug due to missing clearing of checked flag [+ + +]
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Oct 18 04:33:10 2024 +0900

    nilfs2: fix kernel bug due to missing clearing of checked flag
    
    commit 41e192ad2779cae0102879612dfe46726e4396aa upstream.
    
    Syzbot reported that in directory operations after nilfs2 detects
    filesystem corruption and degrades to read-only,
    __block_write_begin_int(), which is called to prepare block writes, may
    fail the BUG_ON check for accesses exceeding the folio/page size,
    triggering a kernel bug.
    
    This was found to be because the "checked" flag of a page/folio was not
    cleared when it was discarded by nilfs2's own routine, which causes the
    sanity check of directory entries to be skipped when the directory
    page/folio is reloaded.  So, fix that.
    
    This was necessary when the use of nilfs2's own page discard routine was
    applied to more than just metadata files.
    
    Link: https://lkml.kernel.org/r/20241017193359.5051-1-konishi.ryusuke@gmail.com
    Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: syzbot+d6ca2daf692c7a82f959@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=d6ca2daf692c7a82f959
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

nilfs2: fix potential deadlock with newly created symlinks [+ + +]
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Sun Oct 20 13:51:28 2024 +0900

    nilfs2: fix potential deadlock with newly created symlinks
    
    commit b3a033e3ecd3471248d474ef263aadc0059e516a upstream.
    
    Syzbot reported that page_symlink(), called by nilfs_symlink(), triggers
    memory reclamation involving the filesystem layer, which can result in
    circular lock dependencies among the reader/writer semaphore
    nilfs->ns_segctor_sem, s_writers percpu_rwsem (intwrite) and the
    fs_reclaim pseudo lock.
    
    This is because after commit 21fc61c73c39 ("don't put symlink bodies in
    pagecache into highmem"), the gfp flags of the page cache for symbolic
    links are overwritten to GFP_KERNEL via inode_nohighmem().
    
    This is not a problem for symlinks read from the backing device, because
    the __GFP_FS flag is dropped after inode_nohighmem() is called.  However,
    when a new symlink is created with nilfs_symlink(), the gfp flags remain
    overwritten to GFP_KERNEL.  Then, memory allocation called from
    page_symlink() etc.  triggers memory reclamation including the FS layer,
    which may call nilfs_evict_inode() or nilfs_dirty_inode().  And these can
    cause a deadlock if they are called while nilfs->ns_segctor_sem is held:
    
    Fix this issue by dropping the __GFP_FS flag from the page cache GFP flags
    of newly created symlinks in the same way that nilfs_new_inode() and
    __nilfs_read_inode() do, as a workaround until we adopt nofs allocation
    scope consistently or improve the locking constraints.
    
    Link: https://lkml.kernel.org/r/20241020050003.4308-1-konishi.ryusuke@gmail.com
    Fixes: 21fc61c73c39 ("don't put symlink bodies in pagecache into highmem")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: syzbot+9ef37ac20608f4836256@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=9ef37ac20608f4836256
    Tested-by: syzbot+9ef37ac20608f4836256@syzkaller.appspotmail.com
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ocfs2: pass u64 to ocfs2_truncate_inline maybe overflow [+ + +]
Author: Edward Adam Davis <eadavis@qq.com>
Date:   Wed Oct 16 19:43:47 2024 +0800

    ocfs2: pass u64 to ocfs2_truncate_inline maybe overflow
    
    [ Upstream commit bc0a2f3a73fcdac651fca64df39306d1e5ebe3b0 ]
    
    Syzbot reported a kernel BUG in ocfs2_truncate_inline.  There are two
    reasons for this: first, the parameter value passed is greater than
    ocfs2_max_inline_data_with_xattr, second, the start and end parameters of
    ocfs2_truncate_inline are "unsigned int".
    
    So, we need to add a sanity check for byte_start and byte_len right before
    ocfs2_truncate_inline() in ocfs2_remove_inode_range(), if they are greater
    than ocfs2_max_inline_data_with_xattr return -EINVAL.
    
    Link: https://lkml.kernel.org/r/tencent_D48DB5122ADDAEDDD11918CFB68D93258C07@qq.com
    Fixes: 1afc32b95233 ("ocfs2: Write support for inline data")
    Signed-off-by: Edward Adam Davis <eadavis@qq.com>
    Reported-by: syzbot+81092778aac03460d6b7@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=81092778aac03460d6b7
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Gang He <ghe@suse.com>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/bnxt_re: synchronize the qp-handle table array [+ + +]
Author: Selvin Xavier <selvin.xavier@broadcom.com>
Date:   Mon Oct 14 06:36:15 2024 -0700

    RDMA/bnxt_re: synchronize the qp-handle table array
    
    [ Upstream commit 76d3ddff7153cc0bcc14a63798d19f5d0693ea71 ]
    
    There is a race between the CREQ tasklet and destroy qp when accessing the
    qp-handle table. There is a chance of reading a valid qp-handle in the
    CREQ tasklet handler while the QP is already moving ahead with the
    destruction.
    
    Fixing this race by implementing a table-lock to synchronize the access.
    
    Fixes: f218d67ef004 ("RDMA/bnxt_re: Allow posting when QPs are in error")
    Fixes: 84cf229f4001 ("RDMA/bnxt_re: Fix the qp table indexing")
    Link: https://patch.msgid.link/r/1728912975-19346-3-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/cxgb4: Dump vendor specific QP details [+ + +]
Author: Leon Romanovsky <leon@kernel.org>
Date:   Mon Oct 7 20:55:17 2024 +0300

    RDMA/cxgb4: Dump vendor specific QP details
    
    [ Upstream commit 89f8c6f197f480fe05edf91eb9359d5425869d04 ]
    
    Restore the missing functionality to dump vendor specific QP details,
    which was mistakenly removed in the commit mentioned in Fixes line.
    
    Fixes: 5cc34116ccec ("RDMA: Add dedicated QP resource tracker function")
    Link: https://patch.msgid.link/r/ed9844829135cfdcac7d64285688195a5cd43f82.1728323026.git.leonro@nvidia.com
    Reported-by: Dr. David Alan Gilbert <linux@treblig.org>
    Closes: https://lore.kernel.org/all/Zv_4qAxuC0dLmgXP@gallifrey
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/mlx5: Round max_rd_atomic/max_dest_rd_atomic up instead of down [+ + +]
Author: Patrisious Haddad <phaddad@nvidia.com>
Date:   Thu Oct 10 11:50:23 2024 +0300

    RDMA/mlx5: Round max_rd_atomic/max_dest_rd_atomic up instead of down
    
    [ Upstream commit 78ed28e08e74da6265e49e19206e1bcb8b9a7f0d ]
    
    After the cited commit below max_dest_rd_atomic and max_rd_atomic values
    are being rounded down to the next power of 2. As opposed to the old
    behavior and mlx4 driver where they used to be rounded up instead.
    
    In order to stay consistent with older code and other drivers, revert to
    using fls round function which rounds up to the next power of 2.
    
    Fixes: f18e26af6aba ("RDMA/mlx5: Convert modify QP to use MLX5_SET macros")
    Link: https://patch.msgid.link/r/d85515d6ef21a2fa8ef4c8293dce9b58df8a6297.1728550179.git.leon@kernel.org
    Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
    Reviewed-by: Maher Sanalla <msanalla@nvidia.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "driver core: Fix uevent_show() vs driver detach race" [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Oct 29 01:23:04 2024 +0100

    Revert "driver core: Fix uevent_show() vs driver detach race"
    
    commit 9a71892cbcdb9d1459c84f5a4c722b14354158a5 upstream.
    
    This reverts commit 15fffc6a5624b13b428bb1c6e9088e32a55eb82c.
    
    This commit causes a regression, so revert it for now until it can come
    back in a way that works for everyone.
    
    Link: https://lore.kernel.org/all/172790598832.1168608.4519484276671503678.stgit@dwillia2-xfh.jf.intel.com/
    Fixes: 15fffc6a5624 ("driver core: Fix uevent_show() vs driver detach race")
    Cc: stable <stable@kernel.org>
    Cc: Ashish Sangwan <a.sangwan@samsung.com>
    Cc: Namjae Jeon <namjae.jeon@samsung.com>
    Cc: Dirk Behme <dirk.behme@de.bosch.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Rafael J. Wysocki <rafael@kernel.org>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "drm/mipi-dsi: Set the fwnode for mipi_dsi_device" [+ + +]
Author: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Date:   Tue Oct 29 09:24:53 2024 +0800

    Revert "drm/mipi-dsi: Set the fwnode for mipi_dsi_device"
    
    This reverts commit ac88a1f41f93499df6f50fd18ea835e6ff4f3200 which is
    commit a26cc2934331b57b5a7164bff344f0a2ec245fc0 upstream.
    
    Reason for revert:
    1. The commit [1] does not land on linux-5.15, so this patch does not
    fix anything.
    
    2. Since the fw_devlink improvements series [2] does not land on
    linux-5.15, using device_set_fwnode() causes the panel to flash during
    bootup.
    
    Incorrect link management may lead to incorrect device initialization,
    affecting firmware node links and consumer relationships.
    The fwnode setting of panel to the DSI device would cause a DSI
    initialization error without series[2], so this patch was reverted to
    avoid using the incomplete fw_devlink functionality.
    
    [1] commit 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust")
    [2] Link: https://lore.kernel.org/all/20230207014207.1678715-1-saravanak@google.com
    
    Cc: stable@vger.kernel.org # 5.15.169
    Cc: stable@vger.kernel.org # 5.10.228
    Cc: stable@vger.kernel.org # 5.4.284
    Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
riscv: efi: Set NX compat flag in PE/COFF header [+ + +]
Author: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Date:   Sun Sep 29 16:02:33 2024 +0200

    riscv: efi: Set NX compat flag in PE/COFF header
    
    [ Upstream commit d41373a4b910961df5a5e3527d7bde6ad45ca438 ]
    
    The IMAGE_DLLCHARACTERISTICS_NX_COMPAT informs the firmware that the
    EFI binary does not rely on pages that are both executable and
    writable.
    
    The flag is used by some distro versions of GRUB to decide if the EFI
    binary may be executed.
    
    As the Linux kernel neither has RWX sections nor needs RWX pages for
    relocation we should set the flag.
    
    Cc: Ard Biesheuvel <ardb@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
    Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
    Fixes: cb7d2dd5612a ("RISC-V: Add PE/COFF header for EFI stub")
    Acked-by: Ard Biesheuvel <ardb@kernel.org>
    Link: https://lore.kernel.org/r/20240929140233.211800-1-heinrich.schuchardt@canonical.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: Remove duplicated GET_RM [+ + +]
Author: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
Date:   Tue Oct 8 17:41:39 2024 +0800

    riscv: Remove duplicated GET_RM
    
    [ Upstream commit 164f66de6bb6ef454893f193c898dc8f1da6d18b ]
    
    The macro GET_RM defined twice in this file, one can be removed.
    
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
    Fixes: 956d705dd279 ("riscv: Unaligned load/store handling for M_MODE")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20241008094141.549248-3-zhangchunyan@iscas.ac.cn
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: Remove unused GENERATING_ASM_OFFSETS [+ + +]
Author: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
Date:   Tue Oct 8 17:41:38 2024 +0800

    riscv: Remove unused GENERATING_ASM_OFFSETS
    
    [ Upstream commit 46d4e5ac6f2f801f97bcd0ec82365969197dc9b1 ]
    
    The macro is not used in the current version of kernel, it looks like
    can be removed to avoid a build warning:
    
    ../arch/riscv/kernel/asm-offsets.c: At top level:
    ../arch/riscv/kernel/asm-offsets.c:7: warning: macro "GENERATING_ASM_OFFSETS" is not used [-Wunused-macros]
        7 | #define GENERATING_ASM_OFFSETS
    
    Fixes: 9639a44394b9 ("RISC-V: Provide a cleaner raw_smp_processor_id()")
    Cc: stable@vger.kernel.org
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
    Link: https://lore.kernel.org/r/20241008094141.549248-2-zhangchunyan@iscas.ac.cn
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: Use '%u' to format the output of 'cpu' [+ + +]
Author: WangYuli <wangyuli@uniontech.com>
Date:   Thu Oct 17 11:20:10 2024 +0800

    riscv: Use '%u' to format the output of 'cpu'
    
    [ Upstream commit e0872ab72630dada3ae055bfa410bf463ff1d1e0 ]
    
    'cpu' is an unsigned integer, so its conversion specifier should
    be %u, not %d.
    
    Suggested-by: Wentao Guan <guanwentao@uniontech.com>
    Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Link: https://lore.kernel.org/all/alpine.DEB.2.21.2409122309090.40372@angie.orcam.me.uk/
    Signed-off-by: WangYuli <wangyuli@uniontech.com>
    Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
    Tested-by: Charlie Jenkins <charlie@rivosinc.com>
    Fixes: f1e58583b9c7 ("RISC-V: Support cpu hotplug")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/4C127DEECDA287C8+20241017032010.96772-1-wangyuli@uniontech.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: vdso: Prevent the compiler from inserting calls to memset() [+ + +]
Author: Alexandre Ghiti <alexghiti@rivosinc.com>
Date:   Wed Oct 16 10:36:24 2024 +0200

    riscv: vdso: Prevent the compiler from inserting calls to memset()
    
    [ Upstream commit bf40167d54d55d4b54d0103713d86a8638fb9290 ]
    
    The compiler is smart enough to insert a call to memset() in
    riscv_vdso_get_cpus(), which generates a dynamic relocation.
    
    So prevent this by using -fno-builtin option.
    
    Fixes: e2c0cdfba7f6 ("RISC-V: User-facing API")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Reviewed-by: Guo Ren <guoren@kernel.org>
    Link: https://lore.kernel.org/r/20241016083625.136311-2-alexghiti@rivosinc.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
scsi: scsi_transport_fc: Allow setting rport state to current state [+ + +]
Author: Benjamin Marzinski <bmarzins@redhat.com>
Date:   Tue Sep 17 19:06:43 2024 -0400

    scsi: scsi_transport_fc: Allow setting rport state to current state
    
    [ Upstream commit d539a871ae47a1f27a609a62e06093fa69d7ce99 ]
    
    The only input fc_rport_set_marginal_state() currently accepts is
    "Marginal" when port_state is "Online", and "Online" when the port_state
    is "Marginal". It should also allow setting port_state to its current
    state, either "Marginal or "Online".
    
    Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
    Link: https://lore.kernel.org/r/20240917230643.966768-1-bmarzins@redhat.com
    Reviewed-by: Ewan D. Milne <emilne@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/mm: fix incorrect buffer->mirror size in hmm2 double_map test [+ + +]
Author: Donet Tom <donettom@linux.ibm.com>
Date:   Fri Sep 27 00:07:52 2024 -0500

    selftests/mm: fix incorrect buffer->mirror size in hmm2 double_map test
    
    [ Upstream commit 76503e1fa1a53ef041a120825d5ce81c7fe7bdd7 ]
    
    The hmm2 double_map test was failing due to an incorrect buffer->mirror
    size.  The buffer->mirror size was 6, while buffer->ptr size was 6 *
    PAGE_SIZE.  The test failed because the kernel's copy_to_user function was
    attempting to copy a 6 * PAGE_SIZE buffer to buffer->mirror.  Since the
    size of buffer->mirror was incorrect, copy_to_user failed.
    
    This patch corrects the buffer->mirror size to 6 * PAGE_SIZE.
    
    Test Result without this patch
    ==============================
     #  RUN           hmm2.hmm2_device_private.double_map ...
     # hmm-tests.c:1680:double_map:Expected ret (-14) == 0 (0)
     # double_map: Test terminated by assertion
     #          FAIL  hmm2.hmm2_device_private.double_map
     not ok 53 hmm2.hmm2_device_private.double_map
    
    Test Result with this patch
    ===========================
     #  RUN           hmm2.hmm2_device_private.double_map ...
     #            OK  hmm2.hmm2_device_private.double_map
     ok 53 hmm2.hmm2_device_private.double_map
    
    Link: https://lkml.kernel.org/r/20240927050752.51066-1-donettom@linux.ibm.com
    Fixes: fee9f6d1b8df ("mm/hmm/test: add selftests for HMM")
    Signed-off-by: Donet Tom <donettom@linux.ibm.com>
    Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Cc: Jérôme Glisse <jglisse@redhat.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Mark Brown <broonie@kernel.org>
    Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
    Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Cc: Jason Gunthorpe <jgg@mellanox.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
 
staging: iio: frequency: ad9832: fix division by zero in ad9832_calc_freqreg() [+ + +]
Author: Zicheng Qu <quzicheng@huawei.com>
Date:   Tue Oct 22 13:43:54 2024 +0000

    staging: iio: frequency: ad9832: fix division by zero in ad9832_calc_freqreg()
    
    commit 6bd301819f8f69331a55ae2336c8b111fc933f3d upstream.
    
    In the ad9832_write_frequency() function, clk_get_rate() might return 0.
    This can lead to a division by zero when calling ad9832_calc_freqreg().
    The check if (fout > (clk_get_rate(st->mclk) / 2)) does not protect
    against the case when fout is 0. The ad9832_write_frequency() function
    is called from ad9832_write(), and fout is derived from a text buffer,
    which can contain any value.
    
    Link: https://lore.kernel.org/all/2024100904-CVE-2024-47663-9bdc@gregkh/
    Fixes: ea707584bac1 ("Staging: IIO: DDS: AD9832 / AD9835 driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zicheng Qu <quzicheng@huawei.com>
    Reviewed-by: Nuno Sa <nuno.sa@analog.com>
    Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
    Link: https://patch.msgid.link/20241022134354.574614-1-quzicheng@huawei.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: phy: Fix API devm_usb_put_phy() can not release the phy [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
Date:   Sun Oct 20 17:33:42 2024 +0800

    usb: phy: Fix API devm_usb_put_phy() can not release the phy
    
    commit fdce49b5da6e0fb6d077986dec3e90ef2b094b50 upstream.
    
    For devm_usb_put_phy(), its comment says it needs to invoke usb_put_phy()
    to release the phy, but it does not do that actually, so it can not fully
    undo what the API devm_usb_get_phy() does, that is wrong, fixed by using
    devres_release() instead of devres_destroy() within the API.
    
    Fixes: cedf8602373a ("usb: phy: move bulk of otg/otg.c to phy/phy.c")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Link: https://lore.kernel.org/r/20241020-usb_phy_fix-v1-1-7f79243b8e1e@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: fix unreleased fwnode_handle in typec_port_register_altmodes() [+ + +]
Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Date:   Mon Oct 21 22:45:29 2024 +0200

    usb: typec: fix unreleased fwnode_handle in typec_port_register_altmodes()
    
    commit 9581acb91eaf5bbe70086bbb6fca808220d358ba upstream.
    
    The 'altmodes_node' fwnode_handle is never released after it is no
    longer required, which leaks the resource.
    
    Add the required call to fwnode_handle_put() when 'altmodes_node' is no
    longer required.
    
    Cc: stable@vger.kernel.org
    Fixes: 7b458a4c5d73 ("usb: typec: Add typec_port_register_altmodes()")
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
    Link: https://lore.kernel.org/r/20241021-typec-class-fwnode_handle_put-v2-1-3281225d3d27@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usbip: tools: Fix detach_port() invalid port error path [+ + +]
Author: Zongmin Zhou <zhouzongmin@kylinos.cn>
Date:   Thu Oct 24 10:27:00 2024 +0800

    usbip: tools: Fix detach_port() invalid port error path
    
    commit e7cd4b811c9e019f5acbce85699c622b30194c24 upstream.
    
    The detach_port() doesn't return error
    when detach is attempted on an invalid port.
    
    Fixes: 40ecdeb1a187 ("usbip: usbip_detach: fix to check for invalid ports")
    Cc: stable@vger.kernel.org
    Reviewed-by: Hongren Zheng <i@zenithal.me>
    Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
    Link: https://lore.kernel.org/r/20241024022700.1236660-1-min_halo@163.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vt: prevent kernel-infoleak in con_font_get() [+ + +]
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Fri Oct 11 02:46:19 2024 +0900

    vt: prevent kernel-infoleak in con_font_get()
    
    commit f956052e00de211b5c9ebaa1958366c23f82ee9e upstream.
    
    font.data may not initialize all memory spaces depending on the implementation
    of vc->vc_sw->con_font_get. This may cause info-leak, so to prevent this, it
    is safest to modify it to initialize the allocated memory space to 0, and it
    generally does not affect the overall performance of the system.
    
    Cc: stable@vger.kernel.org
    Reported-by: syzbot+955da2d57931604ee691@syzkaller.appspotmail.com
    Fixes: 05e2600cb0a4 ("VT: Bump font size limitation to 64x128 pixels")
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    Link: https://lore.kernel.org/r/20241010174619.59662-1-aha310510@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
wifi: ath10k: Fix memory leak in management tx [+ + +]
Author: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
Date:   Tue Oct 15 12:11:03 2024 +0530

    wifi: ath10k: Fix memory leak in management tx
    
    commit e15d84b3bba187aa372dff7c58ce1fd5cb48a076 upstream.
    
    In the current logic, memory is allocated for storing the MSDU context
    during management packet TX but this memory is not being freed during
    management TX completion. Similar leaks are seen in the management TX
    cleanup logic.
    
    Kmemleak reports this problem as below,
    
    unreferenced object 0xffffff80b64ed250 (size 16):
      comm "kworker/u16:7", pid 148, jiffies 4294687130 (age 714.199s)
      hex dump (first 16 bytes):
        00 2b d8 d8 80 ff ff ff c4 74 e9 fd 07 00 00 00  .+.......t......
      backtrace:
        [<ffffffe6e7b245dc>] __kmem_cache_alloc_node+0x1e4/0x2d8
        [<ffffffe6e7adde88>] kmalloc_trace+0x48/0x110
        [<ffffffe6bbd765fc>] ath10k_wmi_tlv_op_gen_mgmt_tx_send+0xd4/0x1d8 [ath10k_core]
        [<ffffffe6bbd3eed4>] ath10k_mgmt_over_wmi_tx_work+0x134/0x298 [ath10k_core]
        [<ffffffe6e78d5974>] process_scheduled_works+0x1ac/0x400
        [<ffffffe6e78d60b8>] worker_thread+0x208/0x328
        [<ffffffe6e78dc890>] kthread+0x100/0x1c0
        [<ffffffe6e78166c0>] ret_from_fork+0x10/0x20
    
    Free the memory during completion and cleanup to fix the leak.
    
    Protect the mgmt_pending_tx idr_remove() operation in
    ath10k_wmi_tlv_op_cleanup_mgmt_tx_send() using ar->data_lock similar to
    other instances.
    
    Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1
    
    Fixes: dc405152bb64 ("ath10k: handle mgmt tx completion event")
    Fixes: c730c477176a ("ath10k: Remove msdu from idr when management pkt send fails")
    Cc: stable@vger.kernel.org
    Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
    Link: https://patch.msgid.link/20241015064103.6060-1-quic_mpubbise@quicinc.com
    Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: brcm80211: BRCM_TRACING should depend on TRACING [+ + +]
Author: Geert Uytterhoeven <geert@linux-m68k.org>
Date:   Tue Sep 24 14:09:32 2024 +0200

    wifi: brcm80211: BRCM_TRACING should depend on TRACING
    
    [ Upstream commit b73b2069528f90ec49d5fa1010a759baa2c2be05 ]
    
    When tracing is disabled, there is no point in asking the user about
    enabling Broadcom wireless device tracing.
    
    Fixes: f5c4f10852d42012 ("brcm80211: Allow trace support to be enabled separately from debug")
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://patch.msgid.link/81a29b15eaacc1ac1fb421bdace9ac0c3385f40f.1727179742.git.geert@linux-m68k.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: iwlegacy: Clear stale interrupts before resuming device [+ + +]
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Tue Oct 1 23:07:45 2024 +0300

    wifi: iwlegacy: Clear stale interrupts before resuming device
    
    commit 07c90acb071b9954e1fecb1e4f4f13d12c544b34 upstream.
    
    iwl4965 fails upon resume from hibernation on my laptop. The reason
    seems to be a stale interrupt which isn't being cleared out before
    interrupts are enabled. We end up with a race beween the resume
    trying to bring things back up, and the restart work (queued form
    the interrupt handler) trying to bring things down. Eventually
    the whole thing blows up.
    
    Fix the problem by clearing out any stale interrupts before
    interrupts get enabled during resume.
    
    Here's a debug log of the indicent:
    [   12.042589] ieee80211 phy0: il_isr ISR inta 0x00000080, enabled 0xaa00008b, fh 0x00000000
    [   12.042625] ieee80211 phy0: il4965_irq_tasklet inta 0x00000080, enabled 0x00000000, fh 0x00000000
    [   12.042651] iwl4965 0000:10:00.0: RF_KILL bit toggled to enable radio.
    [   12.042653] iwl4965 0000:10:00.0: On demand firmware reload
    [   12.042690] ieee80211 phy0: il4965_irq_tasklet End inta 0x00000000, enabled 0xaa00008b, fh 0x00000000, flags 0x00000282
    [   12.052207] ieee80211 phy0: il4965_mac_start enter
    [   12.052212] ieee80211 phy0: il_prep_station Add STA to driver ID 31: ff:ff:ff:ff:ff:ff
    [   12.052244] ieee80211 phy0: il4965_set_hw_ready hardware  ready
    [   12.052324] ieee80211 phy0: il_apm_init Init card's basic functions
    [   12.052348] ieee80211 phy0: il_apm_init L1 Enabled; Disabling L0S
    [   12.055727] ieee80211 phy0: il4965_load_bsm Begin load bsm
    [   12.056140] ieee80211 phy0: il4965_verify_bsm Begin verify bsm
    [   12.058642] ieee80211 phy0: il4965_verify_bsm BSM bootstrap uCode image OK
    [   12.058721] ieee80211 phy0: il4965_load_bsm BSM write complete, poll 1 iterations
    [   12.058734] ieee80211 phy0: __il4965_up iwl4965 is coming up
    [   12.058737] ieee80211 phy0: il4965_mac_start Start UP work done.
    [   12.058757] ieee80211 phy0: __il4965_down iwl4965 is going down
    [   12.058761] ieee80211 phy0: il_scan_cancel_timeout Scan cancel timeout
    [   12.058762] ieee80211 phy0: il_do_scan_abort Not performing scan to abort
    [   12.058765] ieee80211 phy0: il_clear_ucode_stations Clearing ucode stations in driver
    [   12.058767] ieee80211 phy0: il_clear_ucode_stations No active stations found to be cleared
    [   12.058819] ieee80211 phy0: _il_apm_stop Stop card, put in low power state
    [   12.058827] ieee80211 phy0: _il_apm_stop_master stop master
    [   12.058864] ieee80211 phy0: il4965_clear_free_frames 0 frames on pre-allocated heap on clear.
    [   12.058869] ieee80211 phy0: Hardware restart was requested
    [   16.132299] iwl4965 0000:10:00.0: START_ALIVE timeout after 4000ms.
    [   16.132303] ------------[ cut here ]------------
    [   16.132304] Hardware became unavailable upon resume. This could be a software issue prior to suspend or a hardware issue.
    [   16.132338] WARNING: CPU: 0 PID: 181 at net/mac80211/util.c:1826 ieee80211_reconfig+0x8f/0x14b0 [mac80211]
    [   16.132390] Modules linked in: ctr ccm sch_fq_codel xt_tcpudp xt_multiport xt_state iptable_filter iptable_nat nf_nat nf_conntrack nf_defrag_ipv4 ip_tables x_tables binfmt_misc joydev mousedev btusb btrtl btintel btbcm bluetooth ecdh_generic ecc iTCO_wdt i2c_dev iwl4965 iwlegacy coretemp snd_hda_codec_analog pcspkr psmouse mac80211 snd_hda_codec_generic libarc4 sdhci_pci cqhci sha256_generic sdhci libsha256 firewire_ohci snd_hda_intel snd_intel_dspcfg mmc_core snd_hda_codec snd_hwdep firewire_core led_class iosf_mbi snd_hda_core uhci_hcd lpc_ich crc_itu_t cfg80211 ehci_pci ehci_hcd snd_pcm usbcore mfd_core rfkill snd_timer snd usb_common soundcore video parport_pc parport intel_agp wmi intel_gtt backlight e1000e agpgart evdev
    [   16.132456] CPU: 0 UID: 0 PID: 181 Comm: kworker/u8:6 Not tainted 6.11.0-cl+ #143
    [   16.132460] Hardware name: Hewlett-Packard HP Compaq 6910p/30BE, BIOS 68MCU Ver. F.19 07/06/2010
    [   16.132463] Workqueue: async async_run_entry_fn
    [   16.132469] RIP: 0010:ieee80211_reconfig+0x8f/0x14b0 [mac80211]
    [   16.132501] Code: da 02 00 00 c6 83 ad 05 00 00 00 48 89 df e8 98 1b fc ff 85 c0 41 89 c7 0f 84 e9 02 00 00 48 c7 c7 a0 e6 48 a0 e8 d1 77 c4 e0 <0f> 0b eb 2d 84 c0 0f 85 8b 01 00 00 c6 87 ad 05 00 00 00 e8 69 1b
    [   16.132504] RSP: 0018:ffffc9000029fcf0 EFLAGS: 00010282
    [   16.132507] RAX: 0000000000000000 RBX: ffff8880072008e0 RCX: 0000000000000001
    [   16.132509] RDX: ffffffff81f21a18 RSI: 0000000000000086 RDI: 0000000000000001
    [   16.132510] RBP: ffff8880072003c0 R08: 0000000000000000 R09: 0000000000000003
    [   16.132512] R10: 0000000000000000 R11: ffff88807e5b0000 R12: 0000000000000001
    [   16.132514] R13: 0000000000000000 R14: 0000000000000000 R15: 00000000ffffff92
    [   16.132515] FS:  0000000000000000(0000) GS:ffff88807c200000(0000) knlGS:0000000000000000
    [   16.132517] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [   16.132519] CR2: 000055dd43786c08 CR3: 000000000978f000 CR4: 00000000000006f0
    [   16.132521] Call Trace:
    [   16.132525]  <TASK>
    [   16.132526]  ? __warn+0x77/0x120
    [   16.132532]  ? ieee80211_reconfig+0x8f/0x14b0 [mac80211]
    [   16.132564]  ? report_bug+0x15c/0x190
    [   16.132568]  ? handle_bug+0x36/0x70
    [   16.132571]  ? exc_invalid_op+0x13/0x60
    [   16.132573]  ? asm_exc_invalid_op+0x16/0x20
    [   16.132579]  ? ieee80211_reconfig+0x8f/0x14b0 [mac80211]
    [   16.132611]  ? snd_hdac_bus_init_cmd_io+0x24/0x200 [snd_hda_core]
    [   16.132617]  ? pick_eevdf+0x133/0x1c0
    [   16.132622]  ? check_preempt_wakeup_fair+0x70/0x90
    [   16.132626]  ? wakeup_preempt+0x4a/0x60
    [   16.132628]  ? ttwu_do_activate.isra.0+0x5a/0x190
    [   16.132632]  wiphy_resume+0x79/0x1a0 [cfg80211]
    [   16.132675]  ? wiphy_suspend+0x2a0/0x2a0 [cfg80211]
    [   16.132697]  dpm_run_callback+0x75/0x1b0
    [   16.132703]  device_resume+0x97/0x200
    [   16.132707]  async_resume+0x14/0x20
    [   16.132711]  async_run_entry_fn+0x1b/0xa0
    [   16.132714]  process_one_work+0x13d/0x350
    [   16.132718]  worker_thread+0x2be/0x3d0
    [   16.132722]  ? cancel_delayed_work_sync+0x70/0x70
    [   16.132725]  kthread+0xc0/0xf0
    [   16.132729]  ? kthread_park+0x80/0x80
    [   16.132732]  ret_from_fork+0x28/0x40
    [   16.132735]  ? kthread_park+0x80/0x80
    [   16.132738]  ret_from_fork_asm+0x11/0x20
    [   16.132741]  </TASK>
    [   16.132742] ---[ end trace 0000000000000000 ]---
    [   16.132930] ------------[ cut here ]------------
    [   16.132932] WARNING: CPU: 0 PID: 181 at net/mac80211/driver-ops.c:41 drv_stop+0xe7/0xf0 [mac80211]
    [   16.132957] Modules linked in: ctr ccm sch_fq_codel xt_tcpudp xt_multiport xt_state iptable_filter iptable_nat nf_nat nf_conntrack nf_defrag_ipv4 ip_tables x_tables binfmt_misc joydev mousedev btusb btrtl btintel btbcm bluetooth ecdh_generic ecc iTCO_wdt i2c_dev iwl4965 iwlegacy coretemp snd_hda_codec_analog pcspkr psmouse mac80211 snd_hda_codec_generic libarc4 sdhci_pci cqhci sha256_generic sdhci libsha256 firewire_ohci snd_hda_intel snd_intel_dspcfg mmc_core snd_hda_codec snd_hwdep firewire_core led_class iosf_mbi snd_hda_core uhci_hcd lpc_ich crc_itu_t cfg80211 ehci_pci ehci_hcd snd_pcm usbcore mfd_core rfkill snd_timer snd usb_common soundcore video parport_pc parport intel_agp wmi intel_gtt backlight e1000e agpgart evdev
    [   16.133014] CPU: 0 UID: 0 PID: 181 Comm: kworker/u8:6 Tainted: G        W          6.11.0-cl+ #143
    [   16.133018] Tainted: [W]=WARN
    [   16.133019] Hardware name: Hewlett-Packard HP Compaq 6910p/30BE, BIOS 68MCU Ver. F.19 07/06/2010
    [   16.133021] Workqueue: async async_run_entry_fn
    [   16.133025] RIP: 0010:drv_stop+0xe7/0xf0 [mac80211]
    [   16.133048] Code: 48 85 c0 74 0e 48 8b 78 08 89 ea 48 89 de e8 e0 87 04 00 65 ff 0d d1 de c4 5f 0f 85 42 ff ff ff e8 be 52 c2 e0 e9 38 ff ff ff <0f> 0b 5b 5d c3 0f 1f 40 00 41 54 49 89 fc 55 53 48 89 f3 2e 2e 2e
    [   16.133050] RSP: 0018:ffffc9000029fc50 EFLAGS: 00010246
    [   16.133053] RAX: 0000000000000000 RBX: ffff8880072008e0 RCX: ffff88800377f6c0
    [   16.133054] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff8880072008e0
    [   16.133056] RBP: 0000000000000000 R08: ffffffff81f238d8 R09: 0000000000000000
    [   16.133058] R10: ffff8880080520f0 R11: 0000000000000000 R12: ffff888008051c60
    [   16.133060] R13: ffff8880072008e0 R14: 0000000000000000 R15: ffff8880072011d8
    [   16.133061] FS:  0000000000000000(0000) GS:ffff88807c200000(0000) knlGS:0000000000000000
    [   16.133063] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [   16.133065] CR2: 000055dd43786c08 CR3: 000000000978f000 CR4: 00000000000006f0
    [   16.133067] Call Trace:
    [   16.133069]  <TASK>
    [   16.133070]  ? __warn+0x77/0x120
    [   16.133075]  ? drv_stop+0xe7/0xf0 [mac80211]
    [   16.133098]  ? report_bug+0x15c/0x190
    [   16.133100]  ? handle_bug+0x36/0x70
    [   16.133103]  ? exc_invalid_op+0x13/0x60
    [   16.133105]  ? asm_exc_invalid_op+0x16/0x20
    [   16.133109]  ? drv_stop+0xe7/0xf0 [mac80211]
    [   16.133132]  ieee80211_do_stop+0x55a/0x810 [mac80211]
    [   16.133161]  ? fq_codel_reset+0xa5/0xc0 [sch_fq_codel]
    [   16.133164]  ieee80211_stop+0x4f/0x180 [mac80211]
    [   16.133192]  __dev_close_many+0xa2/0x120
    [   16.133195]  dev_close_many+0x90/0x150
    [   16.133198]  dev_close+0x5d/0x80
    [   16.133200]  cfg80211_shutdown_all_interfaces+0x40/0xe0 [cfg80211]
    [   16.133223]  wiphy_resume+0xb2/0x1a0 [cfg80211]
    [   16.133247]  ? wiphy_suspend+0x2a0/0x2a0 [cfg80211]
    [   16.133269]  dpm_run_callback+0x75/0x1b0
    [   16.133273]  device_resume+0x97/0x200
    [   16.133277]  async_resume+0x14/0x20
    [   16.133280]  async_run_entry_fn+0x1b/0xa0
    [   16.133283]  process_one_work+0x13d/0x350
    [   16.133287]  worker_thread+0x2be/0x3d0
    [   16.133290]  ? cancel_delayed_work_sync+0x70/0x70
    [   16.133294]  kthread+0xc0/0xf0
    [   16.133296]  ? kthread_park+0x80/0x80
    [   16.133299]  ret_from_fork+0x28/0x40
    [   16.133302]  ? kthread_park+0x80/0x80
    [   16.133304]  ret_from_fork_asm+0x11/0x20
    [   16.133307]  </TASK>
    [   16.133308] ---[ end trace 0000000000000000 ]---
    [   16.133335] ieee80211 phy0: PM: dpm_run_callback(): wiphy_resume [cfg80211] returns -110
    [   16.133360] ieee80211 phy0: PM: failed to restore async: error -110
    
    Cc: stable@vger.kernel.org
    Cc: Stanislaw Gruszka <stf_xl@wp.pl>
    Cc: Kalle Valo <kvalo@kernel.org>
    Cc: linux-wireless@vger.kernel.org
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://patch.msgid.link/20241001200745.8276-1-ville.syrjala@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: iwlwifi: mvm: disconnect station vifs if recovery failed [+ + +]
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date:   Sun Jan 28 08:53:56 2024 +0200

    wifi: iwlwifi: mvm: disconnect station vifs if recovery failed
    
    [ Upstream commit e50a88e5cb8792cc416866496288c5f4d1eb4b1f ]
    
    This will allow to reconnect immediately instead of leaving the
    connection in a limbo state.
    
    Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
    Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://msgid.link/20240128084842.e90531cd3a36.Iebdc9483983c0d8497f9dcf9d79ec37332a5fdcc@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Stable-dep-of: 07a6e3b78a65 ("wifi: iwlwifi: mvm: Fix response handling in iwl_mvm_send_recovery_cmd()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: iwlwifi: mvm: fix 6 GHz scan construction [+ + +]
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Oct 23 09:17:44 2024 +0200

    wifi: iwlwifi: mvm: fix 6 GHz scan construction
    
    commit 7245012f0f496162dd95d888ed2ceb5a35170f1a upstream.
    
    If more than 255 colocated APs exist for the set of all
    APs found during 2.4/5 GHz scanning, then the 6 GHz scan
    construction will loop forever since the loop variable
    has type u8, which can never reach the number found when
    that's bigger than 255, and is stored in a u32 variable.
    Also move it into the loops to have a smaller scope.
    
    Using a u32 there is fine, we limit the number of APs in
    the scan list and each has a limit on the number of RNR
    entries due to the frame size. With a limit of 1000 scan
    results, a frame size upper bound of 4096 (really it's
    more like ~2300) and a TBTT entry size of at least 11,
    we get an upper bound for the number of ~372k, well in
    the bounds of a u32.
    
    Cc: stable@vger.kernel.org
    Fixes: eae94cf82d74 ("iwlwifi: mvm: add support for 6GHz")
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219375
    Link: https://patch.msgid.link/20241023091744.f4baed5c08a1.I8b417148bbc8c5d11c101e1b8f5bf372e17bf2a7@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: iwlwifi: mvm: Fix response handling in iwl_mvm_send_recovery_cmd() [+ + +]
Author: Daniel Gabay <daniel.gabay@intel.com>
Date:   Thu Oct 10 14:05:05 2024 +0300

    wifi: iwlwifi: mvm: Fix response handling in iwl_mvm_send_recovery_cmd()
    
    [ Upstream commit 07a6e3b78a65f4b2796a8d0d4adb1a15a81edead ]
    
    1. The size of the response packet is not validated.
    2. The response buffer is not freed.
    
    Resolve these issues by switching to iwl_mvm_send_cmd_status(),
    which handles both size validation and frees the buffer.
    
    Fixes: f130bb75d881 ("iwlwifi: add FW recovery flow")
    Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://patch.msgid.link/20241010140328.76c73185951e.Id3b6ca82ced2081f5ee4f33c997491d0ebda83f7@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mac80211: do not pass a stopped vif to the driver in .get_txpower [+ + +]
Author: Felix Fietkau <nbd@nbd.name>
Date:   Wed Oct 2 11:56:30 2024 +0200

    wifi: mac80211: do not pass a stopped vif to the driver in .get_txpower
    
    commit 393b6bc174b0dd21bb2a36c13b36e62fc3474a23 upstream.
    
    Avoid potentially crashing in the driver because of uninitialized private data
    
    Fixes: 5b3dc42b1b0d ("mac80211: add support for driver tx power reporting")
    Cc: stable@vger.kernel.org
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Link: https://patch.msgid.link/20241002095630.22431-1-nbd@nbd.name
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: mac80211: skip non-uploaded keys in ieee80211_iter_keys [+ + +]
Author: Felix Fietkau <nbd@nbd.name>
Date:   Sun Oct 6 17:36:30 2024 +0200

    wifi: mac80211: skip non-uploaded keys in ieee80211_iter_keys
    
    [ Upstream commit 52009b419355195912a628d0a9847922e90c348c ]
    
    Sync iterator conditions with ieee80211_iter_keys_rcu.
    
    Fixes: 830af02f24fb ("mac80211: allow driver to iterate keys")
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Link: https://patch.msgid.link/20241006153630.87885-1-nbd@nbd.name
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/bugs: Use code segment selector for VERW operand [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Sep 26 09:10:31 2024 -0700

    x86/bugs: Use code segment selector for VERW operand
    
    commit e4d2102018542e3ae5e297bc6e229303abff8a0f upstream.
    
    Robert Gill reported below #GP in 32-bit mode when dosemu software was
    executing vm86() system call:
    
      general protection fault: 0000 [#1] PREEMPT SMP
      CPU: 4 PID: 4610 Comm: dosemu.bin Not tainted 6.6.21-gentoo-x86 #1
      Hardware name: Dell Inc. PowerEdge 1950/0H723K, BIOS 2.7.0 10/30/2010
      EIP: restore_all_switch_stack+0xbe/0xcf
      EAX: 00000000 EBX: 00000000 ECX: 00000000 EDX: 00000000
      ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: ff8affdc
      DS: 0000 ES: 0000 FS: 0000 GS: 0033 SS: 0068 EFLAGS: 00010046
      CR0: 80050033 CR2: 00c2101c CR3: 04b6d000 CR4: 000406d0
      Call Trace:
       show_regs+0x70/0x78
       die_addr+0x29/0x70
       exc_general_protection+0x13c/0x348
       exc_bounds+0x98/0x98
       handle_exception+0x14d/0x14d
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf
    
    This only happens in 32-bit mode when VERW based mitigations like MDS/RFDS
    are enabled. This is because segment registers with an arbitrary user value
    can result in #GP when executing VERW. Intel SDM vol. 2C documents the
    following behavior for VERW instruction:
    
      #GP(0) - If a memory operand effective address is outside the CS, DS, ES,
               FS, or GS segment limit.
    
    CLEAR_CPU_BUFFERS macro executes VERW instruction before returning to user
    space. Use %cs selector to reference VERW operand. This ensures VERW will
    not #GP for an arbitrary user %ds.
    
    [ mingo: Fixed the SOB chain. ]
    
    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Reported-by: Robert Gill <rtgill82@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com
    Cc: stable@vger.kernel.org # 5.10+
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218707
    Closes: https://lore.kernel.org/all/8c77ccfd-d561-45a1-8ed5-6b75212c7a58@leemhuis.info/
    Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
    Suggested-by: Brian Gerst <brgerst@gmail.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xhci: Fix Link TRB DMA in command ring stopped completion event [+ + +]
Author: Faisal Hassan <quic_faisalh@quicinc.com>
Date:   Tue Oct 22 21:26:31 2024 +0530

    xhci: Fix Link TRB DMA in command ring stopped completion event
    
    commit 075919f6df5dd82ad0b1894898b315fbb3c29b84 upstream.
    
    During the aborting of a command, the software receives a command
    completion event for the command ring stopped, with the TRB pointing
    to the next TRB after the aborted command.
    
    If the command we abort is located just before the Link TRB in the
    command ring, then during the 'command ring stopped' completion event,
    the xHC gives the Link TRB in the event's cmd DMA, which causes a
    mismatch in handling command completion event.
    
    To address this situation, move the 'command ring stopped' completion
    event check slightly earlier, since the specific command it stopped
    on isn't of significant concern.
    
    Fixes: 7f84eef0dafb ("USB: xhci: No-op command queueing and irq handler.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Faisal Hassan <quic_faisalh@quicinc.com>
    Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20241022155631.1185-1-quic_faisalh@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xhci: Use pm_runtime_get to prevent RPM on unsupported systems [+ + +]
Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Date:   Thu Oct 24 19:07:18 2024 +0530

    xhci: Use pm_runtime_get to prevent RPM on unsupported systems
    
    commit 31004740e42846a6f0bb255e6348281df3eb8032 upstream.
    
    Use pm_runtime_put in the remove function and pm_runtime_get to disable
    RPM on platforms that don't support runtime D3, as re-enabling it through
    sysfs auto power control may cause the controller to malfunction. This
    can lead to issues such as hotplug devices not being detected due to
    failed interrupt generation.
    
    Fixes: a5d6264b638e ("xhci: Enable RPM on controllers that support low-power states")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Link: https://lore.kernel.org/r/20241024133718.723846-1-Basavaraj.Natikar@amd.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>