commit 988117cc1bb17338c586a4e21ade88b5397eac33 Author: Greg Kroah-Hartman Date: Tue Nov 17 11:14:21 2026 +0100 Linux 7.3.5 Link: https://lore.kernel.org/r/20261113153753.358973689@linuxfoundation.org Tested-by: Ronald Warsow Tested-by: Brett A C Sheffield Tested-by: Salvatore Bonaccorso Tested-by: Florian Fainelli Tested-by: Shuah Khan Tested-by: Takeshi Ogasawara Tested-by: Joungmin Lee Tested-by: Miguel Ojeda Tested-by: Peter Schneider Tested-by: Sean Lyon Tested-by: Barry K. Nathan Tested-by: Ron Economos Signed-off-by: Greg Kroah-Hartman commit c80609763abd3f8ee7c1fe69dd43b07abff474f0 Author: Linus Torvalds Date: Sun Oct 11 11:24:04 2026 -0700 assoc_array: keep gc's cleanup out of the live tree on allocation failure [ Upstream commit 8afff2e4b90978b8203f9e3898995dcf86821b49 ] assoc_array_gc() builds a copy of the tree. Where the copy reaches a shortcut, it allocates the copy of the shortcut with kmalloc_flex(), fills it with memcpy(), links it into the new tree, and only then allocates the copy of the node after it. The memcpy() leaves the new shortcut's next_node pointing at the old tree's node, so if that second allocation fails, the cleanup, assoc_array_destroy_subtree() on the new tree, follows the new shortcut into the old tree, and the BUG_ON() on the old node's back pointer fires. Allocate the node first, and the shortcut once the node exists, freeing the node again if the shortcut cannot be allocated. A copied shortcut is then only linked into the new tree when the copy of its node is there to follow it. Nothing else changes: with no allocation failing, the trees gc builds are the same as before. Found by a userspace test that makes each allocation of each operation fail in turn. Fixes: 3cb989501c26 ("Add a generic associative array implementation.") Assisted-by: LLM Signed-off-by: Linus Torvalds Tested-by: David Howells Reviewed-by: David Howells Signed-off-by: Sasha Levin commit a7990a72267f264f5284f6bcb90d397b29ac00ed Author: Linus Torvalds Date: Sun Oct 11 10:25:24 2026 -0700 assoc_array: don't chain a new shortcut onto an existing one [ Upstream commit 48691075b0adc590a6831390723e3603dfca76fc ] When a full node's leaves and the new key all share the node's segment, assoc_array_insert_into_terminal_node() replaces the node with a shortcut to a pair of new nodes. If the node is itself the target of a shortcut, the new shortcut is installed as that shortcut's next node, and a shortcut leading to a shortcut is something nothing expects: assoc_array_walk() indexes the second one as a node, and assoc_array_apply_edit() hits the BUG_ON() in the loop that adjusts nr_leaves_on_branch, on that same insertion. Deletion gets a node there. When the subtree below a shortcut shrinks enough, assoc_array_delete() collapses it into one node below the shortcut, and the leaves it collects can all share that node's segment. The next key that shares it too takes this path. Eighteen insertions and a deletion are enough: sixteen keys that agree on bits 0-11, one that leaves them at bit 8 and is deleted again, and one more that agrees with the sixteen. Have the new shortcut replace the one in front of the node as well. assoc_array_insert_shortcut() gives it that shortcut's back pointer and parent slot, so the caller installs it where that one was, and excises the old shortcut along with the node, which takes a second entry in excised_meta[]. The new shortcut's index key comes from the new key up to the new skip level, so it covers what the old one did. Found by a userspace test doing random insertions and deletions on keys that share long prefixes; a targeted case builds a shortcut, deletes down to the collapse and inserts one more key. Fixes: 3cb989501c26 ("Add a generic associative array implementation.") Reported-by: Ollrogge Assisted-by: LLM Signed-off-by: Linus Torvalds Tested-by: David Howells Reviewed-by: David Howells Signed-off-by: Sasha Levin commit 82f1f1a75c08cdc48af493e3cd2ffada66f84f94 Author: Linus Torvalds Date: Sun Oct 11 10:25:12 2026 -0700 assoc_array: choose between splitting a node and a shortcut without gotos [ Upstream commit c47aee71e14dd28d39fce95af83166d7a28a5f2b ] With its jobs in functions, assoc_array_insert_into_terminal_node() comes down to one decision: replace the node with a shortcut when every leaf in it and the new key share one segment, or split it otherwise. Write that as an if and an else, in place of the labels split_node, do_split_node and all_leaves_cluster_together. Each branch now works out where its replacement goes from that replacement's own back pointer and parent slot, with assoc_array_parent_link(), rather than both using the node's. The two are the same today. None of the new functions is recursive, and gcc inlines all of them into assoc_array_insert(), whose stack frame is 240 bytes after this series against 224 before it, on an x86-64 defconfig. No functional change. Assisted-by: LLM Signed-off-by: Linus Torvalds Tested-by: David Howells Reviewed-by: David Howells Stable-dep-of: 48691075b0ad ("assoc_array: don't chain a new shortcut onto an existing one") Signed-off-by: Sasha Levin commit 7bcb475beb0d6513e643e9f69b280d4bb2091c17 Author: Linus Torvalds Date: Sun Oct 11 10:25:12 2026 -0700 assoc_array: move shortcut creation into a function of its own [ Upstream commit fdc6124c55dd0c5aa8e3ec30e6425b4d423ada24 ] Move the code after the all_leaves_cluster_together label into assoc_array_insert_shortcut(), which returns the new shortcut, or NULL when it cannot allocate one. The caller installs it and jumps to do_split_node as before. No functional change. Assisted-by: LLM Signed-off-by: Linus Torvalds Tested-by: David Howells Reviewed-by: David Howells Stable-dep-of: 48691075b0ad ("assoc_array: don't chain a new shortcut onto an existing one") Signed-off-by: Sasha Levin commit cbec3ce63e9ad669e90d53edfacbad652351470e Author: Linus Torvalds Date: Sun Oct 11 10:25:12 2026 -0700 assoc_array: move node splitting into a function of its own [ Upstream commit 3c99a07bc82b051771ce0eb69274aceb9abf1eb7 ] Move the code after the do_split_node label into assoc_array_split_node(), which both the split path and the shortcut path still reach through that label. It sets new_n1's back pointer itself, which both paths did before jumping there, and it no longer sets new_n1's parent slot to -1 first: it always sets the real one. No functional change. Assisted-by: LLM Signed-off-by: Linus Torvalds Tested-by: David Howells Reviewed-by: David Howells Stable-dep-of: 48691075b0ad ("assoc_array: don't chain a new shortcut onto an existing one") Signed-off-by: Sasha Levin commit a254cc2293f8ff328d7258de8f558c1c412afc0a Author: Linus Torvalds Date: Sun Oct 11 10:25:12 2026 -0700 assoc_array: fill the segment cache in one place [ Upstream commit 1159eaf9acb3de1417fb86b382b5e41b46eb17a4 ] The loop that records the segment of each leaf in a full node is written out twice in assoc_array_insert_into_terminal_node(): for the node at its own level, and again at the far end of a shortcut that replaces it. Make it assoc_array_fill_segment_cache(). The second copy did not look for metadata pointers, because that path is only taken for a node holding nothing but leaves, so the function finds none there. The new key's segment is still set by each caller, from the walk the first time and from the key the second. No functional change. Assisted-by: LLM Signed-off-by: Linus Torvalds Tested-by: David Howells Reviewed-by: David Howells Stable-dep-of: 48691075b0ad ("assoc_array: don't chain a new shortcut onto an existing one") Signed-off-by: Sasha Levin commit 79059aacf9c509c5bc7836078704f5dfc2afc006 Author: Linus Torvalds Date: Sun Oct 11 10:25:12 2026 -0700 assoc_array: move in-place insertion into a function of its own [ Upstream commit a624a7ce7d85b514d949b6c7a049f43ac96f3257 ] assoc_array_insert_into_terminal_node() is over 300 lines and does four jobs, joined by gotos: putting the new leaf in place of a matching one or in a free slot, working out the segment of each leaf, splitting the node, and replacing the node with a shortcut. The last two share the function's tail, which installs the replacement where the node was. Move the jobs into functions of their own, one per commit, starting with the two cases that need no new node: assoc_array_insert_in_node(). No functional change. Assisted-by: LLM Signed-off-by: Linus Torvalds Tested-by: David Howells Reviewed-by: David Howells Stable-dep-of: 48691075b0ad ("assoc_array: don't chain a new shortcut onto an existing one") Signed-off-by: Sasha Levin commit eb7793e6bb05627e1259d85b7910988c5540b074 Author: Linus Torvalds Date: Sun Oct 11 09:56:16 2026 -0700 assoc_array: don't lose objects when a root shortcut is split at level 4 [ Upstream commit 20b436c1ae8d37032f888c725915729830dc52f2 ] assoc_array_insert_mid_shortcut() takes level, the level of the node holding the shortcut as assoc_array_walk() reports it, and adds ASSOC_ARRAY_LEVEL_STEP to get the level of a node in that shortcut's place. If the new key first differs from the shortcut no further in than that, no shortcut is made in front of the split, and new_n0 takes the old shortcut's place directly. A shortcut at the root is held by no node. assoc_array_walk() reports level 0 for it, and whatever takes its place is the root, which is read at level 0. So when the new key first differs from a root shortcut in bits 4-7, diff is 4, no shortcut is made in front, and new_n0, whose slots are indexed by bits 4-7, becomes the root and is indexed by bits 0-3. Objects already in the array can no longer be found, and the new one lands in a slot its key does not select. Eighteen keys are enough: seventeen that agree on bits 0-7 make the root a shortcut, and one that agrees with them on bits 0-3 only splits it. Three of the eighteen objects can then not be found, and inserting one of those keys again adds a second object instead of replacing it. Only add the step for a shortcut that hangs from a node. A root shortcut split at level 4 then gets a shortcut in front of the split that ends at level 4, as assoc_array_insert_into_terminal_node() already makes when the leaves of a full root node first differ there. Found by a userspace test that builds a shortcut ending at every level and splits it at every level inside it, from the root and from a node: every split of a root shortcut at level 4 failed, and nothing else did. Fixes: 3cb989501c26 ("Add a generic associative array implementation.") Assisted-by: LLM Signed-off-by: Linus Torvalds Tested-by: David Howells Reviewed-by: David Howells Signed-off-by: Sasha Levin commit 8eadc369b9dbd31ac8d4d8815f1cb671f355d29c Author: Linus Torvalds Date: Sun Oct 11 09:03:19 2026 -0700 assoc_array: don't lose objects when a shortcut is split on a word boundary [ Upstream commit 2a62c32760a8fbf464a7388853d19bc62c5cc423 ] When assoc_array_insert_mid_shortcut() splits a shortcut at level diff, the new shortcut in front of the split, new_s0, gets the first round_up(diff, ASSOC_ARRAY_KEY_CHUNK_SIZE) bits of the old shortcut's index key, and the bits from diff onwards are then cleared from its last word: blank = ULONG_MAX << (diff & ASSOC_ARRAY_KEY_CHUNK_MASK); new_s0->index_key[keylen - 1] &= ~blank; When diff is a multiple of ASSOC_ARRAY_KEY_CHUNK_SIZE, the shift is 0, blank is all ones, and the whole last word is cleared, although all of it lies below diff. A walk then compares the key it is looking for against that zeroed word, takes the shortcut to point elsewhere, and every object below it can no longer be found. assoc_array_insert_into_terminal_node() trims a new shortcut's key the same way, and only when the level is not a multiple of the chunk size. Do the same here. Found by a userspace build of the array with a test that inserts, in order, string keys whose first word is their length and the rest their bytes. The 102nd key split a shortcut at bit 256, and 76 of the keys already in the array could no longer be found; AddressSanitizer also reported assoc_array_walk() reading a word past the end of a shortcut's index key. With this change the test passes, and AddressSanitizer and UndefinedBehaviorSanitizer report nothing. Fixes: 3cb989501c26 ("Add a generic associative array implementation.") Assisted-by: LLM Signed-off-by: Linus Torvalds Tested-by: David Howells Reviewed-by: David Howells Signed-off-by: Sasha Levin commit b2249e3dd605096a930b9eb0b8ef6b3d614434ed Author: Gianluca Balboni Date: Wed Nov 11 10:56:15 2026 -0500 ASoC: amd: yc: Add DMI quirk for HP OmniBook 3 Laptop 16-by0xxx [ Upstream commit 1e73257dff33ff851af60d5bb00d73893a8b6dc8 ] The HP OmniBook 3 Laptop 16-by0xxx (board ID 8EE3) has an internal DMIC connected to the AMD ACP6x audio coprocessor. The BIOS does not set the AcpDmicConnected _DSD property or the _WOV method, and the board is missing from yc_acp_quirk_table[], so acp6x_probe() returns -ENODEV and no DMIC capture device is registered. Add a DMI quirk entry for this model to enable ACP DMIC support. Cc: stable@vger.kernel.org Signed-off-by: Gianluca Balboni Reviewed-by: Vijendar Mukunda Link: https://patch.msgid.link/20261031102136.24600-1-gianluca.balboni06@gmail.com Signed-off-by: Mark Brown [ sashal: Adjusted DMI table insertion context to place the unchanged entry after 8BD6 because the upstream 8DC2 entry is absent. ] Signed-off-by: Sasha Levin commit 3ef275efc356c4be3493e3e5957370101ebfd5ea Author: Chao Yu Date: Wed Nov 11 10:04:09 2026 -0500 f2fs: fix to use bio_in_atomic() in f2fs_write_end_io() [ Upstream commit e4582e5f3b439228d4e900edcf8225aa89be32b4 ] f2fs_write_end_io() uses in_atomic() to decide whether a write bio which exceeds max_atc_write_bio_size or max_atc_write_bio_entry_cnt should be completed in sbi->wq rather than in the current context. However, in_atomic() is not meant to be used outside core kernel code (checkpatch.pl warns about it), as it only looks at preempt_count(): it misses irqs-disabled and RCU read-side critical sections, and on kernels without CONFIG_PREEMPT_COUNT it cannot see spinlock-held sections at all. In those contexts, a large write bio will still be completed inline, which defeats the purpose of the above knobs. The block layer provides bio_in_atomic() for exactly this purpose, it checks rcu_preempt_depth() and preemptible(), and conservatively returns true if CONFIG_PREEMPT_COUNT is disabled, let's use it instead. The difference is as below: Context | in_atomic() | bio_in_atomic() -------------------------------------+----------------+---------------- Hard IRQ / softirq | true | true IRQs disabled, preempt count 0 | false (missed) | true RCU read lock (CONFIG_PREEMPTION) | false (missed) | true Kernel w/o CONFIG_PREEMPT_COUNT | IRQ ctx only | always true Note that on kernels without CONFIG_PREEMPT_COUNT, write bios exceeding the thresholds will always be offloaded to sbi->wq, since there is no way to tell whether the current context is atomic. The thresholds default to UINT_MAX, so the default behavior is not changed. Cc: stable@kernel.org Fixes: 3de6b8094115 ("f2fs: Run f2fs_write_end_io() asynchronously") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim [ sashal: Retained the bio-size check without the entry-count condition because the required fields are absent. ] Signed-off-by: Sasha Levin commit 700b16f5150ca86cc3f0e533738d1c38f19d5d2e Author: Arnd Bergmann Date: Tue Nov 10 23:20:17 2026 -0500 mm/vmscan: avoid false-positive -Wuninitialized warning, again [ Upstream commit ca6e32f3f4240d0335775a11afc21e0451dd8d8f ] I previously worked around a false-postive gcc-16 warning in the get_tier_idx() function, by adding a fake initializer. This happens with the -fsanitize=bounds sanitizer when the compiler creates a specialized variant of isolate_folios(): In function 'get_tier_idx', inlined from 'isolate_folios.constprop' at mm/vmscan.c:4982:9: mm/vmscan.c:4934:9: error: 'sp.refaulted' is used uninitialized [-Werror=uninitialized] 4934 | read_ctrl_pos(lruvec, type, LRU_TIER_MIN, LRU_TIER_MIN, 2, &sp); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/vmscan.c: In function 'isolate_folios.constprop': mm/vmscan.c:4946:25: note: 'sp.refaulted' was declared here 4946 | struct ctrl_pos sp, pv = {}; | ^~ Adding another "= {}" would solve the problem as well, but to prevent this from happening again after the next code refactoring, try instead to prevent this by forbidding interprocedural optimizations on this function. Link: https://lore.kernel.org/all/20260213123902.3466040-1-arnd@kernel.org/ Link: https://lore.kernel.org/20260916083456.4136132-1-arnd@kernel.org Fixes: 3de705a43a46 ("mm/vmscan: avoid false-positive -Wuninitialized warning") Signed-off-by: Arnd Bergmann Signed-off-by: Andrew Morton Cc: Axel Rasmussen Cc: Baolin Wang Cc: Baoquan He Cc: Barry Song Cc: David Hildenbrand Cc: Johannes Weiner Cc: Kairui Song Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Shakeel Butt Cc: Wei Xu Cc: Yuanchu Xie Cc: Signed-off-by: Sasha Levin commit 590c8856baadbc45c2e797b05f81152419f40cad Author: Kairui Song Date: Tue Nov 10 23:20:16 2026 -0500 mm/mglru: use explicit tier range in read_ctrl_pos() [ Upstream commit c1d0e799321c817a22eab2abf2485250cffad7b4 ] read_ctrl_pos() encodes the tier range in a single "tier" parameter via "tier % MAX_NR_TIERS" as the start and "min(tier, MAX_NR_TIERS-1)" as the end. This is hard to follow, maintain, or extend. Tier values 0..3 select a single tier, while tier == MAX_NR_TIERS selects the full range. Replace it with explicit (tier_min, tier_max) parameters using a closed [tier_min, tier_max] interval, and add LRU_TIER_MIN and LRU_TIER_MAX for the tier bounds. The call sites now become self-documenting: - get_tier_idx: (LRU_TIER_MIN, LRU_TIER_MIN) for the first tier, (tier, tier) for each subsequent tier - get_type_to_scan: (LRU_TIER_MIN, LRU_TIER_MAX) for the full range No functional change. Link: https://lore.kernel.org/20260906-mglru-flags-cleanup-v6-5-9aacbd77d4ca@tencent.com Signed-off-by: Kairui Song Signed-off-by: Andrew Morton Reviewed-by: Baolin Wang Reviewed-by: Baoquan He Reviewed-by: Barry Song Reviewed-by: Ridong Chen Cc: Axel Rasmussen Cc: Chris Li Cc: David Hildenbrand (Arm) Cc: Johannes Weiner Cc: Kairui Song Cc: Liam R. Howlett Cc: Lian Wang Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Muchun Song Cc: Qi Zheng Cc: Roman Gushchin Cc: Shakeel Butt Cc: Vlastimil Babka Cc: Wei Xu Cc: Yuanchu Xie Cc: Yu Zhao Cc: Zi Yan Stable-dep-of: ca6e32f3f424 ("mm/vmscan: avoid false-positive -Wuninitialized warning, again") Signed-off-by: Sasha Levin commit f4aa6866b070a48f334a7a030c7b516b69e46ff0 Author: Daeho Jeong Date: Tue Nov 10 18:28:39 2026 -0500 f2fs: expose resizable_tail feature via sysfs [ Upstream commit 714f97f477fe2834ac9e9e66979ae52824b9f914 ] Userspace has no way to know whether the kernel supports the resizable_tail_secno mount option before mounting. Passing it to a kernel without the support fails the mount with -EINVAL, and checking /sys/fs/f2fs//pinned_area_max_secno requires an f2fs instance to be mounted already. Export /sys/fs/f2fs/features/resizable_tail so that userspace can check the support before formatting or mounting a filesystem that relies on resizable_tail_secno, e.g. a filesystem whose tail is going to be shrunk online later. Cc: stable@vger.kernel.org Fixes: c966d29e01bb ("f2fs: support resizable tail section and unify pinned allocation") Signed-off-by: Daeho Jeong Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim [ sashal: Placed resizable_tail entries after fserror because metadata_cache is absent. ] Signed-off-by: Sasha Levin commit 4b9f94a4e92fde95941465c4a777f23c21cc3192 Author: Rafael J. Wysocki Date: Tue Nov 10 12:43:23 2026 -0500 intel_idle: Adjust state names and descriptions for _LPI states [ Upstream commit 4035247966859152a6523bc041f81cb9905695a5 ] The value of the _LPI "State Name" field is used as the description of the given idle state (that is, the value of its "desc" attribute in sysfs) which is not consistent with idle state descriptions used when the idle state information comes from an ACPI _CST object. To rectify that, use the _LPI "State Name" field value as the value of the "name" sysfs attribute of a given idle state and use the MWAIT hint value from the _LPI register address value to derive the value of its "desc" sysfs attribute in analogy with the _CST case. Fixes: abc5c103c66d ("intel_idle: Add ACPI _LPI support") Tested-by: Len Brown Cc: 7.3+ # 7.3+ Signed-off-by: Rafael J. Wysocki [ rjw: Adjusted scnprintf() format string, tweaked changelog ] Link: https://patch.msgid.link/6061409.DvuYhMxLoT@rafael.j.wysocki Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin commit 8f9a6d35be7035d38c27456f5b3081b61208cdeb Author: Andy Shevchenko Date: Tue Nov 10 12:43:22 2026 -0500 intel_idle: Use 2-argument strscpy() [ Upstream commit 2094ae12eed8e83dd91a631ac0a582fee5934c36 ] Use 2-argument strscpy(), which is not only shorter but also provides an additional check that destination buffer is an array. Signed-off-by: Andy Shevchenko Link: https://patch.msgid.link/20260813082624.2650581-1-andriy.shevchenko@linux.intel.com Signed-off-by: Rafael J. Wysocki Stable-dep-of: 403524796685 ("intel_idle: Adjust state names and descriptions for _LPI states") Signed-off-by: Sasha Levin commit e49e54ef0c2e41ab303dc9238dd0731efef67720 Author: Ali Ahmet Memiş Date: Wed Nov 11 13:07:17 2026 -0500 thermal: intel: int340x: Evaluate _TMP exclusively [ Upstream commit c4aae727beb23a736c15b8d53e219da29d791065 ] On ThinkPad P1 Gen2 and P53, INT3403 _TMP switches the EC page selector without taking the mutex the battery methods use, so it must not run interleaved with them. Evaluate _TMP with acpi_evaluate_integer_exclusive(), also where int3403 and processor_thermal probe for it. Fixes: d33e89d12295 ("thermal: core: Suspend thermal zones later and resume them earlier") Reported-by: Charis Stratakis Closes: https://lore.kernel.org/all/37N_jFulf7n-Z55NfKfE71C_wVPxYvZ0xD_iRUg2fXu7TypDiF5PStQ6siSfVBih6fThg5WoPes8U5ZQpfVm_teMFcUGXFxz2DdMbfSWuws=@proton.me/ Cc: All applicable # 80892972ff23 ACPI: utils: Add exclusive AML evaluation helpers Signed-off-by: Ali Ahmet Memiş Reviewed-by: Hans de Goede Reviewed-by: Rong Zhang Link: https://patch.msgid.link/20261018122220.678822-4-aliamemis@disroot.org Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin commit dd2f8565e68cac312451926ce2e3883923caf081 Author: Andrea Parri Date: Wed Nov 11 13:00:04 2026 -0500 iommufd/iova_bitmap: Ensure that iova_bitmap_set() handles the full IOVA [ Upstream commit e21952d72b4740f08a272d694cca223b6b0099ca ] Generally userspace is going to step the dirty bitmap through the IOVA space. However if the bitmap ends in the middle of a large PTE this is problematic. The first step will clear the dirty bit and report dirty to the end of its bitmap while the second step will see the clear'd dirty and report clean for the start of the bitmap. If it happens this ends up losing dirties. Further this function is missing bounds checking so if this does happen ther is a good chance it will write memory beyond what the userspace was expecting. Return an error code if this illegal condition happens. Fixes: 58ccf0190d19 ("vfio: Add an IOVA bitmap support") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Andrea Parri Link: https://patch.msgid.link/20260925161142.189813-2-parri.andrea@gmail.com Signed-off-by: Jason Gunthorpe [ sashal: Added missing prerequisite error storage and propagation from the bitmap through the iterator to the ioctl. ] Signed-off-by: Sasha Levin commit 0a91cc374314ad2edae8e86650e4bd6c43c1d27b Author: David Carlier Date: Wed Nov 11 12:21:13 2026 -0500 media: ipu6: Fix firmware config leak on stream start [ Upstream commit d3d9bc694fe087c672c3ad5871984dc45cd9f425 ] ipu6_isys_fwcom_cfg_init() runs on every first stream start and allocates the firmware config and queue configs with devm, so each STREAMON/STREAMOFF cycle leaks them. They are only needed until ipu6_fw_com_prepare() has copied them, so free them right after. Also check the return value, an allocation failure would otherwise make ipu6_fw_com_prepare() dereference a NULL queue config. Fixes: f625e8d7ffc1 ("media: intel/ipu6: input system ABI between firmware and driver") Cc: stable@vger.kernel.org Signed-off-by: David Carlier Signed-off-by: Sakari Ailus Signed-off-by: Sasha Levin commit bbad3fb95f0b62a0847481ce64c57fc4e652b36f Author: Antti Laakso Date: Wed Nov 11 12:21:12 2026 -0500 media: ipu6: Rename pointer to firmware context [ Upstream commit ac1a76fdf7e1815445c76d90ef688eff85cbb012 ] The name fwcom is used to refer firmware communication context and firmware communication configuration. Try to avoid confusion and rename context variable. Signed-off-by: Antti Laakso Signed-off-by: Sakari Ailus Stable-dep-of: d3d9bc694fe0 ("media: ipu6: Fix firmware config leak on stream start") Signed-off-by: Sasha Levin commit 6d9c89d6dd18c0cfec33bdb468bf4b86c0ca7cea Author: Daeho Jeong Date: Wed Nov 11 12:06:51 2026 -0500 f2fs: release a removed xattr node in roll-forward recovery [ Upstream commit f5924de8867c09206ba631b9faed63862ec00a10 ] When xattrs shrink enough to fit in the inline xattr area, write_all_xattrs() truncates the xattr node and clears i_xattr_nid. If the file is then fsynced without a checkpoint, only the inode block is written, with i_xattr_nid of 0. Roll-forward recovery starts from the checkpointed inode, whose i_xattr_nid still points to the old xattr node. f2fs_recover_inline_xattr() copies only the inline xattr area, and f2fs_update_inode() writes the old i_xattr_nid back. So the inode keeps the stale xattr node: - The node block is never released, and fsck reports "nonzero bytes in xattr space after end of list". - If the inline xattr list ends exactly at the end of the inline area, its terminator is read from the stale node, and the removed xattrs come back after recovery. When the fsynced inode has no xattr node but the checkpointed one has, release the old xattr node as truncate_node() does: check its block address, invalidate the block and drop its node cache, which may still be dirty. Fixes: 28cdce0459cc ("f2fs: recover inline xattr data in roll-forward process") Cc: stable@vger.kernel.org Signed-off-by: Daeho Jeong Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim [ sashal: Replaced newer node-cache helpers with f2fs_folio_put() and truncate_inode_pages_range(). ] Signed-off-by: Sasha Levin commit a0562996b8d3f2a52e7663d7942b768019476da0 Author: Miquel Raynal Date: Wed Nov 11 12:06:29 2026 -0500 clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks [ Upstream commit 1dc3871ce7ec819030c22297f8960c61cc42a990 ] The WDT and WWDT muxes list PCLK3/4096 and PCLK4/4096 among their possible parents, but the driver never registers the corresponding clocks, so these parents could never be used. Add pclk3_div4096 and pclk4_div4096 as fixed factor children of pclk3 and pclk4 and expose them through the clock provider. Reported-by: Jacky Huang Closes: https://lore.kernel.org/linux-clk/b8a8a65b-e302-4747-bc90-4920fc48795a@gmail.com/ Suggested-by: Jacky Huang Fixes: 691521a367cf ("clk: nuvoton: Add clock driver for ma35d1 clock controller") Cc: stable@vger.kernel.org Reviewed-by: Jerome Brunet Signed-off-by: Miquel Raynal Link: https://patch.msgid.link/20260930-perso-ma35d1-upstream-clk-v6-5-48937ee6c9bb@bootlin.com [jbrunet@baylibre.com: removed stale link trailer] Signed-off-by: Jerome Brunet Signed-off-by: Brian Masney Signed-off-by: Sasha Levin commit be5fe988891fc2b15e7be450cc6c08befc023baa Author: Miquel Raynal Date: Wed Nov 11 12:06:28 2026 -0500 dt-bindings: clock: ma35d1: Add missing WDT/WWDT parent clocks [ Upstream commit 8c7453cb0b01bee47ec2f902a9ac1872d3b77f3d ] The WDT and WWDT muxes have PCLK3/4096 and PCLK4/4096 among their possible parents, but these fixed factor clocks are currently not defined, even though they are needed to properly describe the clock tree. Add them to the bindings. Acked-by: Conor Dooley Signed-off-by: Miquel Raynal Link: https://patch.msgid.link/20260930-perso-ma35d1-upstream-clk-v6-4-48937ee6c9bb@bootlin.com Signed-off-by: Jerome Brunet Signed-off-by: Brian Masney Stable-dep-of: 1dc3871ce7ec ("clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks") Signed-off-by: Sasha Levin commit 940b98ee51de83e8bf6395d90a468d16f920447e Author: Miquel Raynal Date: Wed Nov 11 12:06:27 2026 -0500 dt-bindings: clock: ma35d1: Drop CLK_MAX_IDX define [ Upstream commit 653738db38c7c7f0fb959a7870f9461cf4987825 ] Drop CLK_MAX_IDX define of MA35D1 include. This is not a binding and should not be placed here. Value is defined in the user driver. Acked-by: Conor Dooley Signed-off-by: Miquel Raynal Link: https://patch.msgid.link/20260930-perso-ma35d1-upstream-clk-v6-3-48937ee6c9bb@bootlin.com Signed-off-by: Jerome Brunet Signed-off-by: Brian Masney Stable-dep-of: 1dc3871ce7ec ("clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks") Signed-off-by: Sasha Levin commit 9536bc3cfbf2ae4bb36ff17bd8992d4363f36c47 Author: Miquel Raynal Date: Wed Nov 11 12:06:26 2026 -0500 clk: nuvoton: ma35d1: Keep the clock count in the driver [ Upstream commit 26ec588063d9b6c70773b8729372e2bf6d3ea95a ] The number of clocks is not a binding since this is a value that can change. As such, in order to support the missing watchdog clocks and allow the deprecation and removal of CLK_MAX_IDX from the bindings, we need to switch to a local definition first. Signed-off-by: Miquel Raynal Link: https://patch.msgid.link/20260930-perso-ma35d1-upstream-clk-v6-1-48937ee6c9bb@bootlin.com Signed-off-by: Jerome Brunet Signed-off-by: Brian Masney Stable-dep-of: 1dc3871ce7ec ("clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks") Signed-off-by: Sasha Levin commit 7755725e8ac8e7bf556fbe2f159d0c801242ce4d Author: Sumit Kumar Date: Wed Nov 11 12:15:29 2026 -0500 PCI: dwc: Set DMA_BYPASS bit in outbound IATU CTRL2 register [ Upstream commit efadda401c5c8e2390ba66508eba154dbd0db5a9 ] An outbound iATU region matches any local (AXI/application-side) address that falls within its Base/Limit window and rewrites it to the PCIe-side address programmed in that region's Target Address Registers before the transaction goes out on the link. This matching does not distinguish CPU-initiated transactions from ones issued by the internal DMA engine (eDMA/HDMA). Example: outbound region 0 is programmed with Base/Limit covering local addresses 0x8000_0000-0x8000_0FFF and Target 0x1_0000_0000, for CPU-initiated accesses. The DMA engine is later given a descriptor whose destination is the host address 0x8000_0080, which happens to fall inside region 0's Base/Limit range. The iATU matches the DMA transaction against region 0 too and rewrites it to 0x1_0000_0080 instead of passing 0x8000_0080 through unchanged. The transaction then lands on the wrong host address, causing data corruption or an IOMMU fault when the rewritten address has no valid mapping. Set the DMA_BYPASS bit (bit 27) in PCIE_ATU_REGION_CTRL2 when programming outbound iATU regions so only CPU/AXI-initiated transactions are matched against the region; DMA engine transactions bypass the translation and go out on the PCIe link with their original address. Signed-off-by: Sumit Kumar Signed-off-by: Manivannan Sadhasivam Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260908-dma_bypass-v2-1-c3c81d408c0c@oss.qualcomm.com [ sashal: Adapted ATU_* register macros to the existing PCIE_ATU_* naming convention. ] Signed-off-by: Sasha Levin commit 30d516085cfef66a5017229b91b831af7994a317 Author: Ali Ahmet Memiş Date: Wed Nov 11 11:49:36 2026 -0500 ACPI: battery: Evaluate battery methods exclusively [ Upstream commit 645f370c932db2cd3893f7fee61aa8b9debc8ac0 ] On ThinkPad P1 Gen2 and P53, INT3403 _TMP switches the EC page selector without taking the AML mutex the battery methods use, so _BIX and _BST running at the same time can read the wrong page. Since commit d33e89d12295 ("thermal: core: Suspend thermal zones later and resume them earlier") this happens on most resumes. Evaluate the battery methods with acpi_evaluate_object_exclusive(). Fixes: d33e89d12295 ("thermal: core: Suspend thermal zones later and resume them earlier") Reported-by: Charis Stratakis Closes: https://lore.kernel.org/all/37N_jFulf7n-Z55NfKfE71C_wVPxYvZ0xD_iRUg2fXu7TypDiF5PStQ6siSfVBih6fThg5WoPes8U5ZQpfVm_teMFcUGXFxz2DdMbfSWuws=@proton.me/ Cc: All applicable # 80892972ff23 ACPI: utils: Add exclusive AML evaluation helpers Signed-off-by: Ali Ahmet Memiş Reviewed-by: Hans de Goede Reviewed-by: Rong Zhang Link: https://patch.msgid.link/20261018122220.678822-3-aliamemis@disroot.org Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin commit ccb671efb0ecc99d838f2d34b4bf47bc5c45077d Author: Ali Ahmet Memiş Date: Wed Nov 11 11:49:35 2026 -0500 ACPI: utils: Add exclusive AML evaluation helpers [ Upstream commit 80892972ff23bf0b9049230ef0931b34163aaed3 ] ACPICA drops the interpreter lock while AML waits, for example around EC accesses, so two methods can run interleaved. Some firmware relies on methods not interleaving, for instance by switching an EC page selector without taking the AML mutex that the other users of that page hold. Add acpi_evaluate_object_exclusive(), acpi_evaluate_integer_exclusive() and acpi_execute_simple_method_exclusive() which serialize the evaluation under a global mutex, for callers that are known to be affected. Suggested-by: Rafael J. Wysocki Link: https://lore.kernel.org/all/CAJZ5v0gS4agVUkCO6M=VW4Wi2y1-s+k23bpzmX9aAZ0Rsv4z9Q@mail.gmail.com/ Signed-off-by: Ali Ahmet Memiş Reviewed-by: Rong Zhang Link: https://patch.msgid.link/20261018122220.678822-2-aliamemis@disroot.org Signed-off-by: Rafael J. Wysocki Stable-dep-of: 645f370c932d ("ACPI: battery: Evaluate battery methods exclusively") Signed-off-by: Sasha Levin commit c2de116785396df236e311e7643913212fe9fe50 Author: Chao Yu Date: Wed Nov 11 09:44:11 2026 -0500 f2fs: fix to invalidate curseg if change_curseg() fails [ Upstream commit e74476ad8162c1facc74b74ce2d1372492df872e ] Our consistency stress test (fsstress + fio + atomic write workers + "f2fs_io shutdown 1") triggers below kernel BUG: F2FS-fs (vdd): Stopped filesystem due to reason: 0 ------------[ cut here ]------------ kernel BUG at fs/f2fs/segment.c:3989! Oops: invalid opcode: 0000 [#1] SMP KASAN PTI Workqueue: writeback wb_workfn (flush-253:48) RIP: 0010:f2fs_allocate_data_block+0x257a/0x38e0 Call Trace: do_write_block+0x155/0xc10 f2fs_outplace_write_data+0x192/0x340 f2fs_do_write_data_page+0xc57/0x1880 f2fs_write_single_data_page+0xda9/0x15a0 f2fs_write_cache_pages+0x973/0x1f20 __f2fs_write_data_pages+0x6c4/0x1890 do_writepages+0x21e/0x560 __writeback_single_inode+0x119/0x11b0 writeback_sb_inodes+0x67d/0x17a0 wb_writeback+0x207/0x820 wb_workfn+0x128/0xc30 process_one_work+0x925/0x1600 worker_thread+0x60a/0xff0 kthread+0x35f/0x460 ret_from_fork+0x474/0x7e0 ret_from_fork_asm+0x1a/0x30 The BUG is f2fs_bug_on(sbi, curseg->next_blkoff >= BLKS_PER_SEG(sbi)) in f2fs_allocate_data_block(), next_blkoff was 512. The root cause is a race in between atomic write commit and shutdown as below: Thread A (commit atomic write) Thread B (shutdown) Thread C (writeback) - f2fs_ioc_commit_atomic_write - f2fs_commit_atomic_write - __f2fs_commit_atomic_write - __replace_atomic_write_block - f2fs_replace_block - __f2fs_replace_block - f2fs_ioc_shutdown - f2fs_do_shutdown : F2FS_GOING_DOWN_METASYNC - f2fs_sync_fs - f2fs_write_single_data_page : pass f2fs_cp_error() check - f2fs_stop_checkpoint : set CP_ERROR_FLAG - change_curseg - reset_curseg : curseg->segno = new_segno : curseg->alloc_type = SSR : curseg->next_blkoff = __next_free_blkoff() which is BLKS_PER_SEG if there is no free slot in new_segno - f2fs_get_sum_cache : return -EIO due to f2fs_cp_error() : return error w/o restoring curseg : goto out_unlock, skip restoring old segno, blkoff and alloc_type - f2fs_do_write_data_page - f2fs_outplace_write_data - do_write_block - f2fs_allocate_data_block : curseg->segno is valid : f2fs_bug_on(next_blkoff >= BLKS_PER_SEG) Since commit 86f33603f8c5 ("f2fs: handle errors of f2fs_get_meta_page_nofail"), change_curseg() can fail after the curseg has already been switched to the new segment, then the curseg is left in an inconsistent state: it points to a segment which may have no free slot, its summary block is zeroed, and the caller can not restore it. Subsequent block allocation on the curseg will trigger the BUG. Moreover, the writeback thread dies with curseg_lock, curseg_mutex and sentry_lock held, so the commit, shutdown and other I/O threads hang in D state. Since change_curseg() only fails once CP_ERROR_FLAG is set, no checkpoint will be committed afterward, let's invalidate the curseg via reset_curseg_fields() on failure, as new_curseg() does for -ENOSPC, then f2fs_allocate_data_block() will fail with -ENOSPC on the curseg instead of triggering BUG, and do_write_block() can handle the error since CP_ERROR_FLAG has been set. Cc: stable@kernel.org Fixes: 86f33603f8c5 ("f2fs: handle errors of f2fs_get_meta_page_nofail") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim [ sashal: Adjusted context to retain the existing folio summary API instead of the upstream cached-block API. ] Signed-off-by: Sasha Levin commit ebebd3e4e6d95bc602c9489988c6b9885dc8ecc5 Author: Vladimir Oltean Date: Mon Aug 10 15:43:13 2026 +0300 PCI: cadence: Preserve all error codes in cdns_plat_pcie_probe() [ Upstream commit fe108800a865b268eec103e4940c248c85a86e9f ] The blamed commit functionally changed the error path of cdns_pcie_host_probe(), now cdns_plat_pcie_probe(). When the old code path executed "goto err_get_sync", the PCIe controller probe function propagated the pm_runtime_get_sync() error code. The new code doesn't, and returns 0. Similarly for the "goto err_init" previously triggered by cdns_pcie_host_init() errors, and now triggered by cdns_pcie_host_setup() and cdns_pcie_ep_setup() errors. These are not propagated and will result in probing success, which is incorrect. Fixes: bd22885aa188 ("PCI: cadence: Refactor driver to use as a core library") Signed-off-by: Vladimir Oltean Signed-off-by: Manivannan Sadhasivam Signed-off-by: Bjorn Helgaas Link: https://patch.msgid.link/20260810124315.433448-2-vladimir.oltean@nxp.com Signed-off-by: Sasha Levin commit dc2b7bc1bf881f28546d3b6019f45a386f91c202 Author: Linmao Li Date: Wed Nov 11 09:04:33 2026 -0500 PCI: cadence: Store the core controller in platform drvdata [ Upstream commit cfe96ce583c51bf6e034d4038c652a1e8227867c ] cdns_plat_pcie_probe() stores a struct cdns_plat_pcie pointer with platform_set_drvdata(). cdns_plat_pcie_shutdown() and the callbacks in cdns_pcie_pm_ops retrieve the same pointer with dev_get_drvdata() but use it as a struct cdns_pcie pointer. This makes them read phy_count and phy beyond the wrapper. struct cdns_plat_pcie only contains a pointer to struct cdns_pcie. Drop the redundant wrapper and store the struct cdns_pcie pointer directly. Fixes: bd22885aa188 ("PCI: cadence: Refactor driver to use as a core library") Signed-off-by: Linmao Li Signed-off-by: Manivannan Sadhasivam Signed-off-by: Bjorn Helgaas Reviewed-by: Aksh Garg Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260915082826.4135665-1-lilinmao@kylinos.cn Signed-off-by: Sasha Levin commit 06a36914473427790ae07bf748606a16fc03e63f Author: vladimir.oltean@nxp.com Date: Wed Nov 11 09:04:32 2026 -0500 PCI: cadence: Remove device links to PHY [ Upstream commit b59e98ae3841f84d0fb21dbf80e69e6c241a29d9 ] This is a partial revert of the device link pieces from commit dfb80534692d ("PCI: cadence: Add generic PHY support to host and EP drivers"). The trouble with this is that a PHY consumer driver dereferences fields from struct phy, which will become no longer possible. Since commit 987351e1ea77 ("phy: core: Add consumer device link support") from 2019, the PHY core also adds a device link to order PHY provider and consumer suspend/resume operations. The reverted functionality is from 2018 and is redundant with the PHY core now. Signed-off-by: Vladimir Oltean Signed-off-by: Bjorn Helgaas Reviewed-by: Aksh Garg Link: https://patch.msgid.link/20260912161440.1032188-2-vladimir.oltean@nxp.com Stable-dep-of: cfe96ce583c5 ("PCI: cadence: Store the core controller in platform drvdata") Signed-off-by: Sasha Levin commit b4fa91e396c6f2f3df9a5b63ecc6cbc8b05cc0c2 Author: Hengyu Liang Date: Tue Nov 10 23:47:51 2026 -0500 erofs: fix metadata reads at the end of file-backed images [ Upstream commit 52dceb88082b4c7983d1c8c7de1c181f018055ac ] Commit e587a984d332 ("erofs: use dedicated meta inodes for file-backed mounts") made erofs_read_meta_folio() read the metadata of a file-backed mount one whole folio at a time. However, an image only has to be a multiple of its block size. With a block size below the page size, it can end in the middle of a page. The read of that last page is then short, and erofs_fileio_ki_complete() fails it with -EIO. As of now, inodes in the last page of such an image cannot be read, and an image smaller than a page cannot be mounted. The issue can be reproduced with util-linux 2.41, whose mount uses the image file directly: mkdir src for i in $(seq 50); do echo $i > src/$i; done mkfs.erofs -b512 test.erofs src mount -t erofs test.erofs /mnt ls -l /mnt Before that commit, ls -l lists all 50 files. After it, ls -l reports "Input/output error" for 24 of them. This patch reads the folio only up to the end of the backing file and zeroes the rest, as the page cache of the backing file did before. A folio that lies wholly past the end is zeroed without a read. Fixes: e587a984d332 ("erofs: use dedicated meta inodes for file-backed mounts") Cc: stable@vger.kernel.org Signed-off-by: Hengyu Liang Reviewed-by: Gao Xiang Signed-off-by: Gao Xiang (Docker) [ sashal: adjusted context to retain the older metadata I/O allocation and completion mechanism ] Signed-off-by: Sasha Levin commit 60fc7bf4b3112d70cd15dd86ac4a47cdde7d5f0f Author: Peter Ujfalusi Date: Tue Nov 10 23:23:21 2026 -0500 ASoC: hdac_hda: Restore the codec device type on unbind [ Upstream commit 08a44bde821d4fe22c0b6e63da04b3c59ac243a8 ] hdac_hda_codec_probe() changes the type of the codec device to HDA_DEV_ASOC to prevent snd_hda_codec_unregister() from unregistering the device when the card is freed. The type is never restored, and hda_bus_match() requires the device and driver types to be equal. After unbinding the codec driver via sysfs the HDA_DEV_LEGACY codec drivers no longer match the device and bind fails with -ENODEV. Restore HDA_DEV_LEGACY with a device managed action registered before the component, so it runs after the component and the card are gone. Fixes: b60ee2e281b6 ("ASoC: hdac_hda: overwrite hdev type to HDA_DEV_ASOC") Cc: stable@vger.kernel.org Signed-off-by: Peter Ujfalusi Link: https://patch.msgid.link/20261027083840.28813-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin commit 448456b067c7d6607228918940d5d388a9bf2f78 Author: Peter Ujfalusi Date: Tue Nov 10 23:23:20 2026 -0500 ASoC: hdac_hda: Allocate the private data at codec driver bind [ Upstream commit 7d357eae973a1e1933f81f55aa1b3b4e3064570f ] The SOF HDA code allocates struct hdac_hda_priv and stores it as drvdata of the codec device before the codec driver is bound. The driver core clears drvdata on unbind, so after unbinding the codec driver via sysfs a subsequent bind dereferences a NULL pointer in hdac_hda_dev_probe(). All information in the private data can be derived from the codec device itself, so allocate and set it up in hdac_hda_dev_probe() as a device managed resource, which is released on unbind. Remove the allocation from SOF, keeping the check for iDisp codecs without display audio component. Fixes: 3fd63658caed ("ASoC: Intel: Drop hdac_ext usage for codec device creation") Signed-off-by: Peter Ujfalusi Link: https://patch.msgid.link/20261027083840.28813-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown Stable-dep-of: 08a44bde821d ("ASoC: hdac_hda: Restore the codec device type on unbind") Signed-off-by: Sasha Levin commit 0af6a8aede3121bc9662111665294731daddb13a Author: Guixin Liu Date: Tue Nov 10 20:47:35 2026 -0500 nvme-tcp: Validate the queue state under the queue lock in the address attribute [ Upstream commit 2eeeaa9c1ff0c429096acc2947c296db6a56f96d ] Reading the "address" sysfs attribute calls kernel_getsockname() on the admin queue socket, which can race with the queue teardown during connection error recovery: a reader can observe NVME_TCP_Q_LIVE set, then block on the queue lock while nvme_tcp_free_queue() releases the socket and clears queue->sock without holding the lock. Once the reader acquires the lock it dereferences the NULL socket pointer. Commit 76d54bf20cdc ("nvme-tcp: don't access released socket during error recovery") had the queue liveness check inside the lock. Commit 782373ba2766 ("nvme: tcp: avoid race between queue_lock lock and destroy") moved it back out because the lock itself is destroyed in nvme_tcp_free_queue(), so a reader arriving late trips mutex_destroy(). Check the queue liveness inside the queue lock, and clear queue->sock under the same lock. The teardown clears NVME_TCP_Q_LIVE under the lock well before the socket is released, so a reader either sees the bit cleared or a socket that cannot be released while it holds the lock. To also close the lock lifetime race, the queue locks are now owned by the controller: they are initialized with the queue array and only destroyed when the controller is freed, which cannot happen while a sysfs attribute read is still in progress. The queue count is computed by the NVME_TCP_OPT_NR_QUEUES() macro from the original connect options for both initialization and destruction, as reconnects may shrink ctrl->queue_count. Fixes: 782373ba2766 ("nvme: tcp: avoid race between queue_lock lock and destroy") Cc: stable@vger.kernel.org Signed-off-by: Guixin Liu Reviewed-by: Nilay Shroff Signed-off-by: Keith Busch [ sashal: Added a standalone queue_lock initialization loop because the upstream page-fragment cache initialization loop is absent. ] Signed-off-by: Sasha Levin commit 9d3f586c53d32ce8352e72cdfc2e9ab08b80a615 Author: Chao Yu Date: Tue Nov 10 20:07:38 2026 -0500 f2fs: fix to avoid potential reference count leak in do_garbage_collect() [ Upstream commit 894ca8b856668a82426dbd0a0042b61541a1a9ec ] In do_garbage_collect(), we have reserved reference counts on summary cache of all segments, once gc_thread encounter freezing, we need to release all reference counts. Cc: stable@kernel.org Cc: Daeho Jeong Fixes: 02d91398a602 ("f2fs: fix to freeze GC and discard threads quickly") Signed-off-by: Chao Yu Reviewed-by: Daeho Jeong Signed-off-by: Jaegeuk Kim [ sashal: Used folio_put_refs(sum_folio, 2) instead of two f2fs_put_cache() calls. ] Signed-off-by: Sasha Levin commit 8f431c3829f38bacbf69447cbffda6968b260f5d Author: Marc Zyngier Date: Tue Nov 10 18:13:09 2026 -0500 KVM: arm64: vgic: Stop the target vcpu when disabling LPIs [ Upstream commit a1b4bd2c2c262b8094c86afb99364d16ac08cb66 ] Disabling LPIs is pretty nasty, as it directly messes with the AP list of the affected CPU, which could be running... This has the potential to lead to really bad behaviours, and we should not be doing that. Take example on the way the Active state is handled and simply pause the the vcpu so that we are sure it is in a quiescent state, and the state be safely manipulated. Nobody has any expectation of performance for this anyway. Fixes: 96085b949672d ("KVM: arm/arm64: vgic-v3: Retire pending interrupts on disabling LPIs") Co-developed-by: Oliver Upton Signed-off-by: Oliver Upton Cc: stable@vger.kernel.org Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba Link: https://patch.msgid.link/20261015100539.1011760-7-maz@kernel.org Signed-off-by: Marc Zyngier [ sashal: Replaced per-vCPU pause/resume helpers with kvm_arm_halt_guest() and kvm_arm_resume_guest(), which pause all vCPUs. ] Signed-off-by: Sasha Levin commit 53dbaeb46c1a4193d9a352ec734cd65908f7f83e Author: Arnaldo Carvalho de Melo Date: Tue Nov 10 18:00:39 2026 -0500 perf evsel: Close the fds opened so far when disabling missing features [ Upstream commit 16d1234793d42a5a594db99522845996ab8e0d29 ] evsel__open_cpu() opens the events one by one and, when an open fails with EINVAL and evsel__detect_missing_features() has a feature to leave out, goes back to fallback_missing_features to open them all again from start_cpu_map_idx, without closing what the abandoned attempt opened: the fd of every CPU or thread that was opened before the failing one is overwritten in the FD() array, leaking it. Close them first, the same way out_close does when returning an error, leaving the entries at -1 for the retry. Fixes: af954f76eea5 ("perf tools: Check fallback error and order") Reported-by: Sashiko Closes: https://lore.kernel.org/r/sashiko-outbox-173532@kernel.org Reviewed-by: Ian Rogers Tested-by: Ian Rogers Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin commit 4a6cd06c3876b66434c599fb565929c626a45782 Author: Hui Su Date: Tue Nov 10 18:00:38 2026 -0500 perf evsel: Restrict incremental open error unwind [ Upstream commit d023b2110d0d7232ba952a486c497ba8817f6f66 ] evsel__open_cpu(), evsel__tool_pmu_open() and evsel__hwmon_pmu_open() support opening a subrange of a CPU map, bounded by [start_cpu_map_idx, end_cpu_map_idx). Their error paths, however, unwind using "while (--idx >= 0)" all the way back to CPU index 0 regardless of start_cpu_map_idx. If lower CPU indices were opened by an earlier invocation, a later incremental open failure therefore closes those existing file descriptors and overwrites their slots with -1. Before this fix, running the new incremental open test demonstrates this corruption: $ perf test -v "Tool PMU" 12: Tool PMU: 12.1: Tool PMU : Ok 12.2: Tool PMU leader : Ok 12.3: Incremental open error unwind boundary: FAILED: CPU 0 FD overwritten: FD(evsel, 0, 0)=-1, expected 4 FAILED! Stop the unwind at start_cpu_map_idx so that only file descriptors opened by the current invocation are rolled back. After this fix: $ perf test -v "Tool PMU" 12: Tool PMU: 12.1: Tool PMU : Ok 12.2: Tool PMU leader : Ok 12.3: Incremental open error unwind boundary : Ok Fixes: 4804e0111662d7d8 ("perf stat: Use affinity for opening events") Fixes: 240505b2d0adcdc8 ("perf tool_pmu: Factor tool events into their own PMU") Fixes: 53cc0b351ec99278 ("perf hwmon_pmu: Add a tool PMU exposing events from hwmon in sysfs") Reviewed-by: Ian Rogers Signed-off-by: Hui Su Acked-by: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 16d1234793d4 ("perf evsel: Close the fds opened so far when disabling missing features") Signed-off-by: Sasha Levin commit 7f88cd38394a16c326073c8813e7f1f1445bf3ba Author: Kaixuan Li Date: Tue Nov 10 15:51:06 2026 -0500 f2fs: bound the SIT/NAT bitmaps by the checkpoint pack [ Upstream commit 080833a32fd5dc10b3acf2fa9af9b3213e6cb617 ] sit_ver_bitmap_bytesize and nat_ver_bitmap_bytesize are used as memcpy lengths into and out of sbi->ckpt, which is sized from cp_payload alone, and nothing compares either length against that allocation. sanity_check_ckpt() has checked these two fields since c77ec61ca0a4, which added them after a crafted image overran build_sit_info(). That check ties each length to a segment count; it never compares either against the allocation, which is the half this adds. Mounting over-reads in build_sit_info() and build_node_manager(), and the first checkpoint writes the same lengths back through the same pointers, so the over-read's contents reach the on-disk checkpoint. An unmount is enough; the filesystem does not have to be used. Bound both ends the way __bitmap_ptr() lays them out. The three branches differ, so a single sum of the two lengths would still admit a small overflow when cp_payload is non-zero. Fixes: 39a53e0ce0df ("f2fs: add superblock and major in-memory structure") Cc: stable@kernel.org Signed-off-by: Kaixuan Li Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim [ sashal: Replaced F2FS_BLKSIZE(sbi) calls with the F2FS_BLKSIZE constant. ] Signed-off-by: Sasha Levin commit 86dfdf4f2aeaf68905e9b08752d72624a05dd471 Author: Daeho Jeong Date: Tue Nov 10 10:08:52 2026 -0500 f2fs: return -EIO for a lost inode block after cp_error [ Upstream commit 53b12b63304b34a3850a901c4de3cc6ad08e0aee ] After cp_error, dirty node caches are dropped without being written. If such an inode was never written, its NAT entry is still NEW_ADDR, and reading its inode block returns -ENOENT. f2fs_get_dnode_of_data() passes that -ENOENT up, and callers take it as a hole. Since the inode block is missing, the next offset can only advance one block, so fiemap walks block by block up to maxbytes, about 2^30 blocks, while holding the inode lock. It took hours in a power-off recovery test after shutdown and blocked unlink and umount on the file. Return -EIO instead of -ENOENT when the inode block itself is missing after cp_error or shutdown. A missing direct or indirect node is still reported as -ENOENT. Cc: stable@kernel.org Fixes: 28607bf3aa6f ("f2fs: drop dirty node pages when cp is in error status") Signed-off-by: Daeho Jeong Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim [ sashal: Adapted node-cache access to the existing folio interface. ] Signed-off-by: Sasha Levin commit c28481c073d4ca30c3c2ab6f1a65051cbe936220 Author: Chao Yu Date: Tue Nov 10 10:01:40 2026 -0500 f2fs: zone: fix to avoid bio split on sequential zone [ Upstream commit b9b036bd1e2cfbc189d5811d62d8711e216c40b3 ] In the block layer, bio_split_to_limits() splits a bio if it exceeds any underlying queue limits: 1. queue_max_sectors: Splits bios larger than the transfer limit. This limit is set by the device driver/DMA controller (max_hw_sectors) and device-mapper targets. When flushing dirty pages (governed by VFS writeback_chunk_size() and f2fs nr_pages_to_skip()), f2fs merges contiguous pages into bios up to 512KB (1024 sectors) or more without checking queue_max_sectors, which will be split if the device or DM target enforces a smaller limit. 2. queue_max_segments: Splits bios exceeding scatter-gather segment limits. f2fs allocates bios with up to 256 pages, exceeding the 128-segment limit of DM targets (dm-default-key/dm-crypt) if pages are discontiguous. 3. chunk_sectors: Splits bios crossing chunk/zone boundaries. In f2fs, section_size strictly matches zone_size, and block allocation never spans across section boundaries, so bios never cross chunk_sectors. Crucially, when bio_split_to_limits() splits a bio, bio_submit_split() submits the tail half via submit_bio_noacct() before returning the head half to the caller. On a sequential zoned device, this causes the tail bio to arrive at the zone write plug before the head: dm-3: zone 7: prepare_bio wp mismatch: bio sector 30720 offset 2048 != wp_offset 248, len 248 The write plug rejects the out-of-order tail with BLK_STS_IOERR, causing f2fs_stop_checkpoint() and remounting the filesystem read-only: 2026-09-30T22:09:23.725678+08:00 localhost kernel: CPU: 9 UID: 0 PID: 243 Comm: kworker/9:1H Not tainted 6.12.81-gb3ef518fb26d #5 2026-09-30T22:09:23.725750+08:00 localhost kernel: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-debian-1.17.0-1 04/01/2014 2026-09-30T22:09:23.725753+08:00 localhost kernel: Workqueue: dm-3_zwplugs blk_zone_wplug_bio_work 2026-09-30T22:09:23.725756+08:00 localhost kernel: Call Trace: 2026-09-30T22:09:23.725758+08:00 localhost kernel: 2026-09-30T22:09:23.725758+08:00 localhost kernel: dump_stack_lvl+0x4d/0x70 2026-09-30T22:09:23.725759+08:00 localhost kernel: f2fs_stop_checkpoint+0x1df/0x5d0 2026-09-30T22:09:23.725759+08:00 localhost kernel: ? blk_zone_wplug_bio_work+0x4eb/0x740 2026-09-30T22:09:23.725760+08:00 localhost kernel: f2fs_cache_write_end_io+0x545/0x6e0 2026-09-30T22:09:23.725761+08:00 localhost kernel: blk_zone_wplug_bio_work+0x4eb/0x740 2026-09-30T22:09:23.725762+08:00 localhost kernel: process_one_work+0x5c6/0xde0 2026-09-30T22:09:23.725764+08:00 localhost kernel: ? assign_work+0x124/0x4e0 2026-09-30T22:09:23.725765+08:00 localhost kernel: worker_thread+0x403/0xb70 2026-09-30T22:09:23.725765+08:00 localhost kernel: ? __kthread_parkme+0x82/0x140 2026-09-30T22:09:23.725766+08:00 localhost kernel: ? __pfx_worker_thread+0x10/0x10 2026-09-30T22:09:23.725766+08:00 localhost kernel: kthread+0x235/0x2e0 2026-09-30T22:09:23.725767+08:00 localhost kernel: ? recalc_sigpending+0x128/0x1d0 2026-09-30T22:09:23.725767+08:00 localhost kernel: ? __pfx_kthread+0x10/0x10 2026-09-30T22:09:23.725769+08:00 localhost kernel: ret_from_fork+0x2f/0x70 2026-09-30T22:09:23.725769+08:00 localhost kernel: ? __pfx_kthread+0x10/0x10 2026-09-30T22:09:23.725770+08:00 localhost kernel: ret_from_fork_asm+0x1a/0x30 2026-09-30T22:09:23.725771+08:00 localhost kernel: 2026-09-30T22:09:23.725771+08:00 localhost kernel: F2FS-fs (dm-0): Stopped filesystem due to reason: 3 To prevent write bios destined for sequential zones from being split: 1. In __bio_alloc(), bound npages to bdev_max_segments(bdev) for writes to sequential zone areas. 2. In page_is_mergeable(), check queue_max_segments() and queue_max_sectors() for sequential zone areas, so f2fs will not merge beyond the queue limits. Fixes: 52763a4b7a21 ("f2fs: detect host-managed SMR by feature flag") Fixes: 664ba972df9b ("f2fs: use BIO_MAX_PAGES for bio allocation") Cc: stable@vger.kernel.org Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim [ sashal: Changed F2FS_BLKSIZE(sbi) to F2FS_BLKSIZE to match the existing constant definition. ] Signed-off-by: Sasha Levin commit 2f46c8c60590fdab4cda8d5498d0fea02410b35a Author: Vincent Donnefort Date: Tue Nov 10 09:07:24 2026 -0500 KVM: arm64: Use kvm_s2_fault_vma_info in pkvm_mem_abort() [ Upstream commit 0cdcc1039200b3c4fbc2ae3f9b5c1be1bc9155e8 ] To paraphrase Marc in commit 08f97454b7fa ("KVM: arm64: Fix protected mode handling of pages larger than 4kB"), pkvm_pgtable_stage2_map() assumes the address passed as a parameter is aligned to the size of the intended mapping, while HPFAR_EL2 gives the IPA minus the bottom 12 bits, regardless of the system page size configuration. To fix this alignment, bring support for kvm_s2_fault_vma_info in pkvm_mem_abort() and use its members where possible. They do contain the page-alignment we need to fix the fault on system with pages larger than 4K. Also, add a check at the start of pkvm_pgtable_stage2_map(), it does not support !PAGE_ALIGNED arguments. Fixes: ea03466e806f ("KVM: arm64: Handle aborts from protected VMs") Cc: stable@vger.kernel.org Signed-off-by: Vincent Donnefort Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba Link: https://patch.msgid.link/20260928095454.3255918-5-vdonnefort@google.com Signed-off-by: Marc Zyngier Signed-off-by: Sasha Levin commit a05dcd38b4d158f7325ae1831f9b516e71351bd8 Author: Bartosz Golaszewski Date: Tue Nov 10 08:11:27 2026 -0500 dmaengine: qcom: bam_dma: free interrupt before the clock in error path [ Upstream commit 82eed160cfa7a296ae4eb5acb8dd8f493323eea7 ] The BAM interrupt is requested with a devres helper and so on error it's freed after probe() returns. We disable the clock before freeing or masking it so it may still fire and we may end up reading BAM registers with clock disabled. Stop using devres for interrupts as we free it in remove() manually anyway. Add an appropriate label and free the interrupt before disabling the clock in error path and in remove(). Cc: stable@vger.kernel.org Fixes: e7c0fe2a5c84 ("dmaengine: add Qualcomm BAM dma driver") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260427-qcom-qce-cmd-descr-v16-0-945fd1cafbbc%40oss.qualcomm.com?part=2 Reviewed-by: Manivannan Sadhasivam Signed-off-by: Bartosz Golaszewski Link: https://patch.msgid.link/20261008-bam-dma-free-irq-v28-1-5e5b10de441e@oss.qualcomm.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin commit 20ff3e6c04abd5bd9fedacd347b8b9335f44ee6c Author: Vishnu Santhosh Date: Tue Nov 10 08:11:26 2026 -0500 dmaengine: qcom: bam_dma: Defer IRQ trigger type to device tree [ Upstream commit 3cee6f79553202d7d3954555560ac38d719344b8 ] The driver hardcodes IRQF_TRIGGER_HIGH when registering the BAM interrupt, which overrides the trigger type specified in the device tree. On Qualcomm Shikra SoC, the A2 BAM signals an edge interrupt to the apps processor; registering it as level-high causes the interrupt to not fire, resulting in missed DMA completions. Use IRQF_TRIGGER_NONE instead, which causes the kernel to use the trigger type already configured by platform_get_irq() when it parsed the device tree interrupts property. This makes the driver platform-agnostic. Fixes: e7c0fe2a5c84 ("dmaengine: add Qualcomm BAM dma driver") Co-developed-by: Deepak Kumar Singh Signed-off-by: Deepak Kumar Singh Signed-off-by: Vishnu Santhosh Reviewed-by: Frank Li Link: https://patch.msgid.link/20260717-qcom-bam-dma-irq-trigger-v1-1-6405eac86f00@oss.qualcomm.com Signed-off-by: Vinod Koul Stable-dep-of: 82eed160cfa7 ("dmaengine: qcom: bam_dma: free interrupt before the clock in error path") Signed-off-by: Sasha Levin commit 0c36ef49c53854937b393157243db08940cf60e3 Author: Salvatore Dipietro Date: Thu Oct 1 08:21:51 2026 +0000 mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations [ Upstream commit 0e05a469c29400eb6e35448ce7318581688a1806 ] Commit 5d8edfb900d5 ("iomap: Copy larger chunks from userspace") introduced high-order folio allocations in the iomap buffered write path. When memory is fragmented, each failed costly-order allocation enters __alloc_pages_slowpath() which runs direct reclaim, direct compaction and drain_all_pages(), causing a 0.38x throughput drop on PostgreSQL pgbench (simple-update) with 1024 clients on a 96-vCPU arm64 system. The root issue is that direct reclaim and direct compaction are too expensive for hot allocation paths that have fallbacks to smaller allocations. __filemap_get_folio_mpol() already marks higher-order allocations with __GFP_NORETRY | __GFP_NOWARN, signalling that the caller can handle failure. However, the page allocator still enters the full blocking slowpath for costly orders with __GFP_NORETRY, which is unnecessarily aggressive when the caller will simply retry at a lower order. For costly-order allocations with __GFP_NORETRY, clear __GFP_DIRECT_RECLAIM at the very start of the slowpath, before can_direct_reclaim, can_compact and the nofail checks are evaluated. This makes the entire slowpath treat the request as non-blocking: no direct reclaim, no direct compaction and no drain_all_pages() IPI across every CPU. Reclaim and compaction move to the background instead: kswapd is still woken for reclaim, and it wakes kcompactd for defragmentation. The system keeps its long-term health while the latency-critical direct allocation path no longer stalls. Allocations that also request __GFP_THISNODE are exempted. That flag pairing identifies the local-node-first THP attempt issued by alloc_pages_mpol() (mempolicy.c), which relies on direct compaction to form transparent huge pages. Clearing __GFP_DIRECT_RECLAIM makes these allocations reach the !can_direct_reclaim bailout, which since commit 4c0ed883e051 ("mm/page_alloc: fix defrag_mode for non-reclaimable allocations") drops ALLOC_NOFRAGMENT and retries instead of failing when defrag_mode is on. With vm.defrag_mode=1 a __GFP_NORETRY allocation could therefore succeed by fragmenting another migratetype's pageblock. That is the wrong trade for a caller that has already communicated it can handle failure and has a cheap lower-order fallback, so exclude __GFP_NORETRY from the relaxation. The exclusion is not restricted to costly orders: any __GFP_NORETRY caller has said it can cope with failure, so failing is preferable to fragmenting for all of them. Test environment: Hardware: AWS EC2 m8g.24xlarge (96 vCPU, arm64) 12x 1TB IO2 32000 IOPS RAID0 XFS OS: AL2023 Kernel: v7.3-rc1 Database: PostgreSQL 18.4 Workload: pgbench simple-update, 1024 clients, 96 threads, 1200s Results (average of 3 runs, TPS): Config Avg TPS % vs baseline v7.3-rc1 baseline (vm.defrag_mode=0) 58,602 - v7.3-rc1 + this patch (vm.defrag_mode=0) 157,246 +168.3% v7.3-rc1 baseline (vm.defrag_mode=1) 109,012 - v7.3-rc1 + this patch (vm.defrag_mode=1) 157,778 +44.7% Link: https://lore.kernel.org/20261001082152.2879289-1-dipiets@amazon.it Link: https://lore.kernel.org/all/20260403193535.9970-1-dipiets@amazon.it/T/#t [v1] Link: https://lore.kernel.org/linux-mm/20260420161404.642-1-dipiets@amazon.it/T/#u [v2] Link: https://lore.kernel.org/all/20260710143437.12379-1-dipiets@amazon.it/T/#u [v3] Link: https://lore.kernel.org/all/20260904115629.3993331-1-dipiets@amazon.it/T/#u [v4] Link: https://lore.kernel.org/all/20260911142102.2294202-1-dipiets@amazon.it/T/#u [v5] Fixes: 5d8edfb900d5 ("iomap: Copy larger chunks from userspace") Signed-off-by: Salvatore Dipietro Signed-off-by: Andrew Morton Acked-by: Vlastimil Babka (SUSE) Acked-by: Zi Yan Reviewed-by: Johannes Weiner Reviewed-by: Christoph Hellwig Cc: David Hildenbrand Cc: Michal Hocko Cc: Matthew Wilcox Cc: Dave Chinner Cc: Ritesh Harjani Cc: Dmitry Ilvokhin Cc: Hazem Mohamed Abuelfotoh Cc: Ali Saidi Cc: Geoff Blake Cc: Christian Brauner Cc: Cc: Darrick J. Wong Cc: Brendan Jackman Cc: Cc: Suren Baghdasaryan Cc: "Garg, Shivank" introduced high-order folio allocations in the iomap buffered write path. When memory is fragmented, each failed costly-order allocation enters __alloc_pages_slowpath() which runs direct reclaim, direct compaction and drain_all_pages(), causing a 0.38x throughput drop on PostgreSQL pgbench (simple-update) with 1024 clients on a 96-vCPU arm64 system. The root issue is that direct reclaim and direct compaction are too expensive for hot allocation paths that have fallbacks to smaller allocations. __filemap_get_folio_mpol() already marks higher-order allocations with __GFP_NORETRY | __GFP_NOWARN, signalling that the caller can handle failure. However, the page allocator still enters the full blocking slowpath for costly orders with __GFP_NORETRY, which is unnecessarily aggressive when the caller will simply retry at a lower order. For costly-order allocations with __GFP_NORETRY, clear __GFP_DIRECT_RECLAIM at the very start of the slowpath, before can_direct_reclaim, can_compact and the nofail checks are evaluated. This makes the entire slowpath treat the request as non-blocking: no direct reclaim, no direct compaction and no drain_all_pages() IPI across every CPU. Reclaim and compaction move to the background instead: kswapd is still woken for reclaim, and it wakes kcompactd for defragmentation. The system keeps its long-term health while the latency-critical direct allocation path no longer stalls. Allocations that also request __GFP_THISNODE are exempted. That flag pairing identifies the local-node-first THP attempt issued by alloc_pages_mpol() (mempolicy.c), which relies on direct compaction to form transparent huge pages. Clearing __GFP_DIRECT_RECLAIM makes these allocations reach the !can_direct_reclaim bailout, which since commit 4c0ed883e051 ("mm/page_alloc: fix defrag_mode for non-reclaimable allocations") drops ALLOC_NOFRAGMENT and retries instead of failing when defrag_mode is on. With vm.defrag_mode=1 a __GFP_NORETRY allocation could therefore succeed by fragmenting another migratetype's pageblock. That is the wrong trade for a caller that has already communicated it can handle failure and has a cheap lower-order fallback, so exclude __GFP_NORETRY from the relaxation. Signed-off-by: Sasha Levin commit b15cd96f41bd01bf614a6685f620c95404067dfe Author: Mehmet Fide Date: Thu Sep 10 10:17:16 2026 +0200 wifi: rtw88: widen the ATIM window while an AP interface is up [ Upstream commit cf8b516f67652f550e040951b88a2040b375afcf ] The frames held for dozing stations go out right after the DTIM beacon and only for the duration of the ATIM window. The chips come up with a 2 TU window (the two that program it set 0x2 at init), which drains about three frames per DTIM; the vendor driver sets 0xa or 0xc in AP mode instead. With the 2 TU window the measured page pool exhaustion takes ~100 s of ordinary multicast chatter; at 0x4 the same storm already drains, so 0xa leaves comfortable headroom. Program 0xa when an AP interface starts and put the default back when it stops, since most chips never initialize the register themselves. The bound and the filter of the previous patches still apply: the window adds drain capacity, the budget protects the pool when that is not enough, the filter keeps chatter off the beacon-paced path. Suggested-by: Ping-Ke Shih Signed-off-by: Mehmet Fide Acked-by: Ping-Ke Shih Signed-off-by: Ping-Ke Shih Link: https://patch.msgid.link/20260910081716.769081-4-mehmet.fide@gmail.com Signed-off-by: Sasha Levin commit 3e86539ba426f4354218820e2896ff730549657a Author: Mehmet Fide Date: Thu Sep 10 10:17:15 2026 +0200 wifi: rtw88: usb: only let the frames a dozing station needs use the after-DTIM queue [ Upstream commit 185971f1b4eb4ea9059d76cf1a18f992eef998c1 ] With the budget in place the high queue can no longer take the chip down, but ordinary chatter still competes with the frames a sleeping station actually needs. mac80211 marks every broadcast and multicast frame with IEEE80211_TX_CTL_SEND_AFTER_DTIM while a station dozes, mDNS and SSDP included, so under normal traffic the budget is spent on frames nobody waits for. Do what the vendor driver does with its default "allow special" high queue filter: admit only ARP, EAPOL and DHCP to the after-DTIM path, the frames a station coming out of power save has to see; everything else goes out on its access category queue at line rate. The frames are classified the way rtw89_core_tx_btc_spec_pkt_notify() does it, from skb->protocol and the network and transport header offsets that mac80211 keeps from the netdev path; EAPOL is the control port flag. Frames the AP relays between its own stations arrive as ETH_P_802_3 and are not inspected, they leave on the access category queue. With the filter in place the page pool stays at 1803 through the same 180 second storm, a DHCP flood still takes the after-DTIM path (and is then held by the budget), and join/ping cycling without power save is unchanged (10/10). Signed-off-by: Mehmet Fide Acked-by: Ping-Ke Shih Signed-off-by: Ping-Ke Shih Link: https://patch.msgid.link/20260910081716.769081-3-mehmet.fide@gmail.com Signed-off-by: Sasha Levin commit 99085c31b8521eb588b66b726ca6d08338e3a14e Author: Mehmet Fide Date: Thu Sep 10 10:17:14 2026 +0200 wifi: rtw88: usb: bound what the driver feeds the after-DTIM queue [ Upstream commit 04cc8c59a3d79ef7ec2341f1c7aef1d40a0ce7df ] Frames routed to the high queue are transmitted right after DTIM beacons only, inside the ATIM window, while they wait in the shared TX page pool. The driver puts no limit on how many it hands over, so as long as one station dozes, any sustained broadcast or multicast traffic outruns the drain and empties the pool: measured on an RTL8822BU AP with a single client in power save and ~40 frames/s of mDNS chatter, the free page count at 0x240 goes from 1803 to 16 in about 100 seconds and stays there for as long as the traffic lasts. From that point every other transmit queues behind the backlog, authentication responses arrive too late for anyone to join, and the reserved page download fails ("error beacon valid"). The AP keeps beaconing and only a reboot recovers. Feed the high queue through a small budget that refills below the measured drain rate (about 3 frames per DTIM, ~15/s at dtim_period 2 on the default 2 TU ATIM window); whatever exceeds the budget leaves on its access category queue right away. The high queue backlog is now bounded by the burst size under any load, so the page pool cannot run dry, at the price that a dozing station may miss part of a broadcast storm. Signed-off-by: Mehmet Fide Acked-by: Ping-Ke Shih Signed-off-by: Ping-Ke Shih Link: https://patch.msgid.link/20260910081716.769081-2-mehmet.fide@gmail.com Signed-off-by: Sasha Levin commit 781af5ab5a848b3c0767c0f057bd6692e3b7c17e Author: Mehmet Fide Date: Fri Aug 14 07:34:26 2026 +0200 wifi: rtw88: usb: route bmc frames via the high queue only for DTIM delivery [ Upstream commit c710c7c2e0380d7c0eeb33b686262edcaef7cb07 ] In AP mode every broadcast and multicast data frame is routed to TX_DESC_QSEL_HIGH, the after-DTIM queue, whether or not anybody is asleep. The firmware drains that queue at beacon pace, a dozen or so frames per second measured on RTL8822BU, while one associated client's mDNS/SSDP chatter alone exceeds that. The excess accumulates inside the chip until the shared TX page pool is exhausted (measured: 14 of 1803 pages left). From that point every host-sourced frame queues behind the backlog: authentication responses reach the air seconds after the client has given up, so no station can associate anymore, and the beacon reserved-page download fails the BCN_VALID poll ("error beacon valid") because it needs pages from the same pool. The AP keeps beaconing, so the failure looks like a silent RX stall and only a reboot recovers. mac80211 already decides when after-DTIM delivery is needed: it sets IEEE80211_TX_CTL_SEND_AFTER_DTIM on bmc frames only while at least one station is actually dozing. Honor that instead of routing unconditionally: flagged frames keep going through the high queue with the MORE_DATA and HGQMD handling introduced by commit 076f786a0ae1 ("wifi: rtw88: Fix AP mode incorrect DTIM behavior"), everything else leaves at line rate through the AC queues. This partially reverts the usb.c hunk of that commit, whose unconditional routing is what lets the backlog build up. On a bench AP (USB2, 20 MHz, WPA2, hostapd, a Windows client driven through disconnect/reconnect cycles): reconnects fail 0/5 on RTL8822BU and 0/3 on RTL8821CU before this change, and pass 10/10 and 5/5 with it, with the page pool staying healthy and no beacon errors logged. Signed-off-by: Mehmet Fide Acked-by: Ping-Ke Shih Signed-off-by: Ping-Ke Shih Link: https://patch.msgid.link/20260814053426.2473247-1-mehmet.fide@gmail.com Signed-off-by: Sasha Levin commit 3772e9bda4cf03f1c4d7e3c4ccffa2636dca9633 Author: Martin Belanger Date: Wed Nov 11 15:19:55 2026 -0500 nvme-tcp: skip TLS control records while waiting for the ICResp commit 12c20e2903563acfb949342967adb900310a24d4 upstream. A peer may send a NewSessionTicket as soon as the handshake completes, ahead of the ICResp. nvme_tcp_init_connection() fails the connection on any record that is not application data, so such a target cannot be reached at all. An OpenSSL-based target does this by default. RFC 9846 section 4.7.1 requires a client that does not support session resumption to ignore a NewSessionTicket. Discard such a record and read again, up to a fixed number of records. Report an alert, and fail the connection for any other record type. The record type is now checked before the length. A control record shorter than the ICResp was reported as -ECONNRESET, which hid the real cause. Fixes: 2837966ab2a8 ("nvme-tcp: control message handling for recvmsg()") Assisted-by: LLM Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Signed-off-by: Martin Belanger Signed-off-by: Keith Busch [ Martin: resolved a context conflict next to nvme_tcp_cpu_queues ] Signed-off-by: Martin Belanger Signed-off-by: Sasha Levin commit 7a5eae5fee348b6d04d44577be5df079dc692111 Author: Chris Mason Date: Wed Nov 11 11:12:14 2026 -0500 mm/shmem: honour F_SEAL_EXEC when an ACL is set [ Upstream commit 0237c47ca17005ea41b510c6116f0257dbf84eab ] The owner of a memfd sealed with F_SEAL_EXEC can still change its execute bits by setting a POSIX access ACL. With CONFIG_TMPFS_POSIX_ACL, this lets an unprivileged owner make a non-executable memfd executable, bypassing vm.memfd_noexec=2. simple_set_acl() updates i_mode directly, bypassing the seal check in shmem_setattr(). Add shmem_set_acl() to check the resulting mode. Share the F_SEAL_EXEC check with shmem_setattr() using memfd_check_seals_mode() in include/linux/memfd.h. Fix generated by an LLM and sent by Chris Mason in private. Fixes: 6fd7353829ca ("mm/memfd: add F_SEAL_EXEC") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Acked-by: Pedro Falcato Acked-by: Kiryl Shutsemau (Meta) Acked-by: Zi Yan Reviewed-by: Baolin Wang Reviewed-by: Pratyush Yadav (Google) Tested-by: Gregory Price (Meta) [ david: use common helper; simplify description ] Link: https://patch.msgid.link/20261029-fixes_shmem-v4-4-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) [ sashal: Removed const from shmem_set_acl()'s struct mnt_idmap pointer parameter to match existing ACL interfaces. ] Signed-off-by: Sasha Levin commit 20704188d669ed74a624fd67dfa4711bcb1087b6 Author: David Hildenbrand (Arm) Date: Tue Nov 10 23:23:35 2026 -0500 mm/userfaultfd: only allocate anon_vma in CoW mappings [ Upstream commit 514c9247db305922591d806ec65d3c3fe420538d ] find_vma_and_prepare_anon() can end up allocating an anon_vma in VMAs that are not CoW mappings, which is wrong. If we have a MAP_SHARED R/O file mapped, we lack VM_SHARED (but do have VM_MAYSHARE) and lack VM_MAYWRITE. While uffd later rejects such mappings (uffd registration requires VM_MAYWRITE, see comment in validate_dst_vma) find_vma_and_prepare_anon() still wrongly allocates an anon vma before it validates the vma. This in turn later confuses copy_page_range()->vma_needs_copy() such that we end up calling copy_hugetlb_page_range() with ranges that actually do not contain *any* per-pagetable information that would require copying, which is the basis for PMD-table sharing in the first place. copy_hugetlb_page_range() should not have to worry about shared PMD tables at all: it doesn't make any sense to copy page tables that are shared, as they can be fully recreated later. Ending up in the function with shareable page tables is the real issue. If a destination PMD table is shared in copy_hugetlb_page_range(), it might get concurrently unshared as we are not holding relevant locks, resulting in us using a page table that is no longer mapped and possibly freed after calling: dst_pte = huge_pte_alloc(dst, dst_vma, addr, sz); To fix it, do not allocate an anon_vma in non-CoW mappings and add a safety guard to copy_hugetlb_page_range(), making sure that we never end up messing with shared PMD tables in there. Before commit 867a43a34ff8a ("userfaultfd: use per-vma locks in userfaultfd operations") we would always validate the VMA before allocating an anon_vma, and consequently never wrongly allocate an anon_vma. As uffd_lock_vma() is part of the same lookup machinery and also contains a misleading VM_SHARED check, change that one as well directly for consistency. A follow-up cleanup will stop taking the hugetlb_vma_lock_read(src_vma) lock in copy_hugetlb_page_range() entirely. Further, the usage of VM_SHARED in userfaultfd code should be cleaned up later to focus on CoW vs. non-CoW mappings. Link: https://lore.kernel.org/20261014-copy_hugetlb_page_range-v1-1-5b68e03fe7fe@kernel.org Fixes: 867a43a34ff8 ("userfaultfd: use per-vma locks in userfaultfd operations") Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Andrew Morton Reported-by: Kyle Zeng Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Kyle Zeng Tested-by: Kyle Zeng Acked-by: Muchun Song Acked-by: Mike Rapoport (Microsoft) Tested-by: Lance Yang Cc: Oscar Salvador Cc: Peter Xu Cc: Miaohe Lin Cc: Lokesh Gidra Cc: Liam R. Howlett Cc: [ sashal: Replaced vma_has_anon_rmap(vma) with a direct vma->anon_vma check in uffd_lock_vma(). ] Signed-off-by: Sasha Levin commit 4de4a28e514ea2cf9a91d198b66cda7f02ad5edb Author: James Fairweather Date: Tue Nov 10 22:13:04 2026 -0500 platform/chrome: cros_usbpd_notify: Only use drvdata when parent is GOOG0004 [ Upstream commit ca75b38b1a3c2eabe81d231dae4ea180cf6287cd ] cros_usbpd_notify_probe_acpi() takes the EC device pointer from dev_get_drvdata(dev->parent) and assumes it is a struct cros_ec_device. That only holds when GOOG0003 is a child of GOOG0004. On older devices without that hierarchy, such as Google Nami, GOOG0003 and GOOG0004 are siblings under the ACPI EC (PNP0C09): PNP0C09:00 (acpi-ec) |-- GOOG0003:00 (cros-usbpd-notify-acpi) `-- GOOG0004:00 (cros_ec_lpcs) Before commit db65a06d10b3 ("ACPI: EC: Convert the driver to a platform one") the parent platform device had no driver data, so the driver warned and continued without an EC pointer, as intended for these devices. Since that commit the ACPI EC driver stores its struct acpi_ec there, so the driver treats a struct acpi_ec as a struct cros_ec_device and calls cros_ec_cmd() on it for every USB-C PD host event. Plugging or unplugging a charger then intermittently oopses, followed by soft lockups and a hung system: BUG: unable to handle page fault for address: ffffffff9cf03220 #PF: supervisor write access in kernel mode Hardware name: Google Nami/Nami, BIOS 09/19/2019 Workqueue: kacpi_notify acpi_os_execute_deferred RIP: 0010:native_queued_spin_lock_slowpath+0x29d/0x330 Call Trace: _raw_spin_lock_irqsave+0x59/0x80 __mutex_lock.constprop.0+0x129/0x930 cros_ec_cmd_xfer+0x2a/0xf0 [cros_ec_proto] cros_ec_cmd_xfer_status+0x1a/0x90 [cros_ec_proto] cros_ec_cmd+0xb7/0x140 [cros_ec_proto] cros_usbpd_get_event_and_notify+0x42/0xc0 [cros_usbpd_notify] acpi_ev_notify_dispatch+0x4e/0x70 acpi_os_execute_deferred+0x1a/0x30 Only read the parent's driver data when the parent's ACPI node is GOOG0004, and otherwise continue without an EC pointer. While at it, drop the reference taken by fwnode_get_parent(). Fixes: db65a06d10b3 ("ACPI: EC: Convert the driver to a platform one") Fixes: e4ee0bb077cd ("platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready") Cc: stable@vger.kernel.org Assisted-by: claude-opus-5-5 checkpatch Signed-off-by: James Fairweather Reported-by: Sergey Tiraspolsky Closes: https://lore.kernel.org/all/20261003204623.18124-1-stiraspo@gmail.com Tested-by: Sergey Tiraspolsky Link: https://lore.kernel.org/r/20261003222855.23707-1-james.a.fairweather@gmail.com Signed-off-by: Tzung-Bi Shih Signed-off-by: Sasha Levin commit 8599c20d7f1808c34216b92351e7ac62557ba182 Author: Hemanth Selam Date: Tue Nov 10 22:13:03 2026 -0500 platform/chrome: Fix typos in comments [ Upstream commit 2d23d5e9cb468baf6e4fa78d0dd7e8555759385d ] Fix typos in comments, reported by scripts/checkpatch.pl using the misspelling list in scripts/spelling.txt. Only touches comments, no code changes. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Hemanth Selam Link: https://lore.kernel.org/r/20260904110900.20435-2-hemanth.selam@gmail.com Signed-off-by: Tzung-Bi Shih Stable-dep-of: ca75b38b1a3c ("platform/chrome: cros_usbpd_notify: Only use drvdata when parent is GOOG0004") Signed-off-by: Sasha Levin commit f63c866dba9ca7c79cc41443bdcefb04ac86e232 Author: Yuejie Shi Date: Tue Nov 10 20:26:58 2026 -0500 fs/ntfs3: validate the EA value length in ntfs_read_ea() [ Upstream commit 351817226fbf0031c4c63d1f5d7f15c3172312eb ] ntfs_read_ea() checks the $EA list for consistency, but it only recomputes the packed size of an entry when the entry's own size field is zero: for (off = 0; off < size; off += ea_size) { const struct EA_FULL *ef = Add2Ptr(ea_p, off); u32 bytes = size - off; ... if (ef->size) { ea_size = le32_to_cpu(ef->size); if (ea_size > bytes) goto out1; continue; /* <- elength never checked */ } ... ea_size = ALIGN(struct_size(ef, name, 1 + ef->name_len + le16_to_cpu(ef->elength)), 4); if (ea_size > bytes) goto out1; } ef->size is non-zero for every entry except the last one, and it is what ntfs3 itself writes (ntfs_set_ea() stores exactly that aligned packed size), so in practice elength is not validated at all. find_ea() then uses unpacked_ea_size(), which also prefers ea->size when it is set, so it agrees and hands the entry back. ntfs_get_ea() copies elength bytes with no further bound of its own: len = le16_to_cpu(ea->elength); ... if (len > size) { /* size is the *caller's* buffer */ err = -ERANGE; ... } memcpy(buffer, ea->name + ea->name_len + 1, len); so a caller that supplies a large enough buffer receives up to 64 KiB of whatever follows the small $EA allocation -- straight to userspace via getxattr(2). Compute the packed size unconditionally and require it to fit in the entry. Hoist the "bytes < offsetof(struct EA_FULL, name)" test above the ef->size branch as well: name_len and elength were being read there without it, which is itself a small over-read of the kmalloc'd buffer when fewer than 8 bytes are left. The old "bytes < sizeof(ef->size)" test is subsumed by it. # mkntfs image; create /mnt/ntfs/poc with user.ntfs6 set, then rewrite # that EA_FULL's elength from 0xf to 0xff00 on the raw device mount -t ntfs3 -o ro /dev/vda /mnt/ntfs getxattr("/mnt/ntfs/poc", "user.ntfs6", buf, 128 * 1024); BUG: KASAN: slab-out-of-bounds in ntfs_get_ea+0x294/0x3e0 Read of size 65280 at addr ffff0000cca53acf by task xattr_probe/142 __asan_memcpy+0x3c/0xa0 ntfs_get_ea+0x294/0x3e0 ntfs_getxattr+0x284/0x318 __vfs_getxattr+0x104/0x160 vfs_getxattr+0x1b4/0x1e0 do_getxattr+0xcc/0x230 path_getxattrat+0x184/0x270 __arm64_sys_getxattr+0x64/0x80 Allocated by task 142: __kmalloc_noprof+0x294/0x668 ntfs_read_ea+0x1e4/0x420 ntfs_get_ea+0x2c8/0x3e0 The buggy address belongs to the object at ffff0000cca53a80 which belongs to the cache kmalloc-96 of size 96 The object being over-read is the one ntfs_read_ea() just allocated, and it is 96 bytes. Entries written by ntfs3 and by Windows set size to the aligned packed size, so the new test does not reject anything a working filesystem produces. Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Cc: stable@vger.kernel.org Signed-off-by: Yuejie Shi [almaz.alexandrovich@paragon-software.com: applied as-is, logic is the same but the code is cleaner] Signed-off-by: Konstantin Komarov [ sashal: adjusted context on top of c22f91d82cb9, which already validates ef->size ] Signed-off-by: Sasha Levin commit 2070e2a2095c892900d90a6dd609433ce0ad05e4 Author: Jun Yang Date: Tue Nov 10 10:52:25 2026 -0500 sctp: re-point retained control chunks on association migration [ Upstream commit 52ffeaa358d1f3d91aa87a26ad90d77769cff74b ] sctp_sock_migrate() transfers DATA chunk ownership but leaves retained control chunks pointing at the old socket. A later retransmission can therefore access the socket after it has been freed. Extend the migration walk to cover retained control chunks and use sctp_control_set_owner_w() to assign their new owner. Reuse the DATA ownership check so each chunk is processed once per pass, even when it is reachable through multiple lists or retained pointers. Preserve a control chunk's existing authentication key across migration so its final release can still generate SCTP_AUTH_FREE_KEY when needed. Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock") Cc: stable@kernel.org Reported-by: TencentOS Corvus AI Signed-off-by: Jun Yang Acked-by: Xin Long Link: https://patch.msgid.link/20261009074244.3718-3-juny24602@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin commit 9875dda4a2dbbbe259cd5f88f19d87b8721a98d0 Author: David Lee Date: Tue Nov 10 10:52:24 2026 -0500 sctp: hold shkey across socket migration [ Upstream commit ad1320865b1826ffa2e81e37c49535751e81335c ] sctp_sock_migrate() transfers queued DATA skbs from the old socket to the new one. skb_orphan() invokes sctp_wfree() during that transfer and drops the skb-owned shared-key reference. If userspace has removed that key from the association, this can be the final reference. The following sctp_set_owner_w() then dereferences the freed chunk->shkey while trying to take the new owner reference. Take a temporary shared-key reference before orphaning the skb and release it after the new owner has taken its reference. This preserves the selected authentication key throughout the ownership transfer. Bug found and triaged by OpenAI Security Research and validated by Trail of Bits. Fixes: 1b1e0bc99474 ("sctp: add refcnt support for sh_key") Signed-off-by: Kyle Zeng Signed-off-by: David Lee Acked-by: Xin Long Link: https://patch.msgid.link/20261009074244.3718-2-juny24602@gmail.com Signed-off-by: Jakub Kicinski Stable-dep-of: 52ffeaa358d1 ("sctp: re-point retained control chunks on association migration") Signed-off-by: Sasha Levin commit a7f0b47d4e5d9d923027d2326fe6662a40dd5bbc Author: Jared Wuerzburger Date: Tue Nov 10 07:02:46 2026 -0500 ALSA: hda/realtek: Fix internal mic on Minisforum V3 and V3 SE [ Upstream commit 72107104d4f522405c9dfdfbaeb230e371c295ee ] On the Minisforum V3 and V3 SE (ALC245, PCI SSID 1f4c:e001) the internal digital microphone array never produces any audio. The DMIC pin 0x12 is parsed correctly ("Internal Mic=0x12"), but the headset mic jack pin 0x19 (BIOS pin config 0x04a19050, jack detect enabled) has no presence detect wired on these boards: reading GET_PIN_SENSE on 0x19 always returns "present" (as it does on the unused, unconnected pin 0x18), while the headphone jack 0x21 reports correctly. The generic parser therefore sets up auto-mic switching and, believing an external mic is always plugged in, permanently routes the ADC to the empty jack (mixer 0x23 input 0x19 unmuted, input 0x12 muted). The "Mic Jack" kcontrol reports "on" with nothing plugged in. Mark pin 0x19 as having no presence detect. The parser then stops auto-switching and exposes a normal "Capture Source" (Internal Mic / Mic) control, which desktop audio stacks drive from their Internal Microphone / Microphone ports. The existing bass speaker DAC routing is kept by chaining to ALC245_FIXUP_BASS_HP_DAC. Tested on both models with the same pin config applied through a snd-hda-intel patch firmware ([pincfg] 0x19 0x04a19150): - V3 SE (Ryzen 7 7735U, BIOS 1.03), kernel 7.2.6 - V3 (Ryzen 7 8840U, BIOS 1.06), kernel 7.2.7 Both boards report the same codec SSID and the same 0x19 default. On both, the internal mic records at a normal level, headphone jack detection on 0x21 still switches output, and the bass routing is retained (DAC1/DAC2 Playback Volume controls present). A headset mic on the combo jack was not tested (none available); with this change it has to be selected manually. V3 users already report that the jack mic gets no input [1], which is the other symptom of the same broken presence detect. The patched alc269.c was build-tested with W=1 on tiwai/sound.git for-linus (7.3-rc3) without new warnings. The diagnosis, the fixup and this changelog were written with the help of an AI coding assistant; I reviewed them and tested the change on the hardware listed above. Fixes: e34743018249 ("ALSA: hda/realtek: Add quirk for Minisforum V3 SE") Link: https://github.com/mudkipme/awesome-minisforum-v3/issues/14 [1] Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Jared Wuerzburger Link: https://patch.msgid.link/20260928152925.69032-1-jwuerz@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 99ccb7bc18e87771ab983d78bd99b1d88f85ac30 Author: Saim Masood Date: Tue Nov 10 07:02:45 2026 -0500 ALSA: hda/realtek: Fix speakers on ASUS ExpertBook PM3606CHA [ Upstream commit 556cca74b6ec6f0bc6a3dc27473487de3cc8c8fe ] The internal speakers of the ASUS ExpertBook PM3606CHA (Realtek ALC256, PCI SSID 1043:3501) stay silent with the default codec setup, and the headphone jack is not detected either. The codec needs COEF values that differ from its power-on defaults: COEF 0x10, 0x16, 0x35, 0x37 and 0x57 on NID 0x20 have to be set to the values used by the Windows driver. Toggling the codec GPIOs, and the existing ALC256 fixups alone, make no difference. Apply the COEFs from a new fixup at the INIT action, so that they are restored after resume as well. Chain to ALC256_FIXUP_ASUS_MIC_NO_PRESENCE to keep the headset mic and the jack detection working, which the fallback pin quirk provided before for this machine. The COEF values were found by the reporter of the Ubuntu bug below, who compared the codec state against the one under the Windows driver. Tested on an ASUS ExpertBook PM3606CHA (BIOS PM3606CHA.304) with the change applied to v7.2.5: with this fixup alone, the speakers, the headphones with jack detection, and the headset mic all work, also after suspend and resume. Link: https://bugs.launchpad.net/bugs/2167288 Signed-off-by: Saim Masood Link: https://patch.msgid.link/065927dd-cabf-449a-992d-64887eedda01@gmail.com Signed-off-by: Takashi Iwai Stable-dep-of: 72107104d4f5 ("ALSA: hda/realtek: Fix internal mic on Minisforum V3 and V3 SE") Signed-off-by: Sasha Levin commit 494733fe475885297decda02ac041b1f8f8f5752 Author: Chao Yu Date: Tue Nov 10 08:07:06 2026 -0500 f2fs: fix to check continuousness in f2fs_sync_meta_pages() correctly [ Upstream commit 1383cff4ccf3c8833c6255edffa29eb67c6419bb ] In f2fs_sync_meta_pages(), whenever i becomes zero inside while loop, below check may be skipped, it failed to check the continuousness: if (nr_to_write != LONG_MAX && i != 0 && folio->index != prev + folio_nr_pages(fbatch.folios[i-1])) { Cc: stable@kernel.org Fixes: 580e7a492608 ("f2fs: convert f2fs_sync_meta_pages() to use filemap_get_folios_tag()") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim [ sashal: adapted f2fs_sync_meta_caches() changes to folio-based f2fs_sync_meta_pages(), using folio_nr_pages() to advance the expected index ] Signed-off-by: Sasha Levin commit f56399666631be3d755a16fa9658e088d81c99b7 Author: Chao Yu Date: Tue Nov 10 07:46:24 2026 -0500 f2fs: fix to avoid folio->mapping dereference in is_{meta, node}_folio() [ Upstream commit b5a71253c5c7e1139eab2f3e1e13e0bf2cbcaac7 ] Otherwise, it may cause NULL pointer dereference in race condition: Thread A Thread B - f2fs_setattr - f2fs_truncate - f2fs_truncate_blocks - f2fs_do_truncate_blocks - f2fs_truncate_inode_blocks - truncate_dnode - truncate_node - invalidate_mapping_pages - folio->mapping = NULL - folio_lock - is_node_folio - F2FS_F_SB(folio): dereference on folio->mapping Cc: stable@kernel.org Fixes: 019a8912425e ("f2fs: introduce is_{meta,node}_folio") Reported-by: Zhiguo Niu Closes: https://lore.kernel.org/linux-f2fs-devel/c5d29b31-e764-4782-9639-be84b1b2bfc2@kernel.org Signed-off-by: Chao Yu Reviewed-by: Zhiguo Niu Signed-off-by: Jaegeuk Kim [ sashal: retained IS_DNODE(folio) and is_cold_node(folio) calls without the upstream sbi arguments ] Signed-off-by: Sasha Levin commit 65ad096ce43fa21ea4c34f44cffcda9bcf7eefc6 Author: Runyu Xiao Date: Tue Nov 10 07:27:04 2026 -0500 ALSA: usb-audio: Protect Roland control activation [ Upstream commit 19b42c1fff7f220a6346c614d79ce1bda6d95b40 ] The USB MIDI driver changes the Roland MIDI Input Mode control's access flags directly from the rawmidi open and close paths. These changes are not protected by the ALSA control core and the corresponding notifications can race with control access. Use snd_ctl_activate_id() so that the control core updates the access flags and sends the notification under its lock. Release the USB MIDI mutex before calling it because the control write path holds controls_rwsem while roland_load_put() takes the USB MIDI mutex. Keep the state transition and alternate-setting change under the USB MIDI mutex; rawmidi's open mutex serializes the enclosing open and close paths. Fixes: 96f61d9ade82 ("sound: usb-audio: allow switching altsetting on Roland USB MIDI devices") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Runyu Xiao Link: https://patch.msgid.link/20260929141726.2166899-1-runyu.xiao@seu.edu.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit dbcd2e9485b77d69519c76e11ca62513e7f52150 Author: Nicholas Hobson Date: Tue Nov 10 07:27:03 2026 -0500 ALSA: usb-audio: keep MIDI input running for Roland TD-11 [ Upstream commit 2e4c9ab2574eeaa7b893c7d35b4a9f60fd681ddd ] The TD-11 hands MIDI handling off to the host once connected via USB. If no MIDI input port is opened on the host, the device itself becomes unusable as a standalone instrument until its input is serviced, independent of anything happening on the computer. Add a per-device keep_input_running flag, set for the TD-11 in snd_usbmidi_detect_roland(), and check it alongside the existing opened[1] check in snd_usbmidi_input_start()/snd_usbmidi_input_stop() so that input is started at device creation and never stopped for these devices, regardless of whether a client has the input port open. Signed-off-by: Nicholas Hobson Link: https://patch.msgid.link/MN2PR15MB3472557AF39DC3A4CA9E753FF8BD2@MN2PR15MB3472.namprd15.prod.outlook.com Signed-off-by: Takashi Iwai Stable-dep-of: 19b42c1fff7f ("ALSA: usb-audio: Protect Roland control activation") Signed-off-by: Sasha Levin commit 1b84bbd6a586ea75a2def535d3a6788647922b0d Author: Balakrishnan Sambath Date: Tue Nov 10 06:50:10 2026 -0500 media: microchip-isc: fix SBGGR10 Bayer pattern [ Upstream commit bb96c78c5f87072913f8825faebe64bf711a503c ] SBGGR10 was mapped to ISC_BAY_CFG_RGRG instead of ISC_BAY_CFG_BGBG, causing red/blue channel swap. Fixes: 1e8f401474d6 ("media: atmel: atmel-isc: reworked driver and formats") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin commit 03f5da43528bc3abbad356efd71ba4b09b161acc Author: Balakrishnan Sambath Date: Tue Nov 10 06:50:09 2026 -0500 media: microchip-isc: fix ISC_PFG_CFG0_BPS macro name typo [ Upstream commit 96defd0723fc893db6ccf5f4968323db4af0b0aa ] The BPS field macros for ISC_PFE_CFG0 were spelled ISC_PFG_CFG0_BPS_* (NINE, TEN, ELEVEN, TWELVE). The register is PFE, not PFG. Rename them to ISC_PFE_CFG0_BPS_* to match the register and the EIGHT and MASK macros. No functional change. Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev Signed-off-by: Hans Verkuil Stable-dep-of: bb96c78c5f87 ("media: microchip-isc: fix SBGGR10 Bayer pattern") Signed-off-by: Sasha Levin commit 9f84bde6aaade57b2ef7b71c1783b30773cd43d6 Author: Fuad Tabba Date: Tue Nov 10 06:46:37 2026 -0500 KVM: arm64: Use kvm_s2_fault_vma_info in gmem_abort() [ Upstream commit 80b0b86dc5e4344e62a2fd3ee43d0ef816fe9122 ] gmem_abort() maps at s2fd->fault_ipa, which HPFAR_EL2 holds at 4K granularity whatever the page size. The generic page-table code aligns it, but pkvm_pgtable_stage2_map() looks up existing mappings over [addr, addr + size), so on a pKVM host with pages larger than 4K a guest_memfd-backed guest that faults past the first 4K of a page can find its neighbour's mapping, get -EAGAIN and take the same fault forever. The memory fault exit reports s2fd->fault_ipa too, which for a nested guest's fault is the nested IPA rather than the canonical one kvm_gmem_get_pfn() failed on. Take the addresses from kvm_s2_fault_vma_info instead, as user_mem_abort() does, and report the canonical gfn in the memory fault exit. kvm_s2_fault_get_vma_info() itself isn't called: a guest_memfd memslot's userspace_addr doesn't need to be backed by a VMA. Fixes: a7b57e0995927 ("KVM: arm64: Handle guest_memfd-backed guest page faults") Reported-by: Sashiko Closes: https://lore.kernel.org/r/20260913175105.A57AC1F000FF@smtp.kernel.org Cc: stable@vger.kernel.org Signed-off-by: Fuad Tabba Signed-off-by: Vincent Donnefort Link: https://patch.msgid.link/20260928095454.3255918-4-vdonnefort@google.com Signed-off-by: Marc Zyngier Signed-off-by: Sasha Levin commit 98e1bf166d135afbd7f2179b5362a703cd40009d Author: Vincent Donnefort Date: Tue Nov 10 06:46:36 2026 -0500 KVM: arm64: Pass kvm_s2_fault_desc to fault_supports_stage2_huge_mapping() [ Upstream commit 10c5cc50f056a6425305557063ad70c3eb0e686b ] Pass the fault descriptor to fault_supports_stage2_huge_mapping() instead of passing memslot and hva separately so it can access other s2fd members such as vcpu. This implies to pass that same s2fd argument to transparent_hugepage_adjust(). No functional change intended. Signed-off-by: Vincent Donnefort Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba Reviewed-by: Wei-Lin Chang Link: https://patch.msgid.link/20260928095454.3255918-3-vdonnefort@google.com Signed-off-by: Marc Zyngier Stable-dep-of: 80b0b86dc5e4 ("KVM: arm64: Use kvm_s2_fault_vma_info in gmem_abort()") Signed-off-by: Sasha Levin commit 81b6cd3b33091f08825d40fece0a2d3674100f29 Author: Balakrishnan Sambath Date: Mon Nov 9 23:24:30 2026 -0500 media: microchip-isc: fix WB offset and gain register field masking [ Upstream commit 6e9eaa3b93870e4edac1bd2539fe113c24663eaf ] ISC_WB_O_* and ISC_WB_G_* each pack two 13-bit fields. A negative offset sign-extends and corrupts the adjacent field. Add masks for the two fields and write them with FIELD_PREP(), which masks each value into its field, so sign extension can no longer bleed across. Fixes: 73c1a577b839 ("media: atmel: atmel-isc: reworked white balance feature") Cc: stable@vger.kernel.org Reviewed-by: Eugen Hristev Signed-off-by: Balakrishnan Sambath Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin commit f716211caed61d5b2388ed0b0113b93c2d2f5399 Author: Balakrishnan Sambath Date: Mon Nov 9 23:24:29 2026 -0500 media: microchip-isc: store the unshifted PFE_CFG0 BPS value [ Upstream commit 14cbe597504a04c5c49342d0566438e2b438a948 ] pfe_cfg0_bps held a pre-shifted BPS value (ISC_PFE_CFG0_BPS_EIGHT was 0x4 << 28) ORed straight into the register. The other format selectors like cfa_baycfg store the bare field value and position it at the write, so this one was inconsistent. Store the bare BPS value and apply it with FIELD_PREP() at the PFE_CFG0 write, and fix the pfe_cfg0_bps comment to match. No functional change. Suggested-by: Eugen Hristev Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev Signed-off-by: Hans Verkuil Stable-dep-of: 6e9eaa3b9387 ("media: microchip-isc: fix WB offset and gain register field masking") Signed-off-by: Sasha Levin commit faccb497b97b03cbce979062f99efb91bddb541c Author: Cheng Ming Lin Date: Mon Nov 9 22:11:24 2026 -0500 mtd: spi-nor: macronix: Restore fallback parameters for MX25L12805D [ Upstream commit 01739ccea21b69818dc071096a249e6f84a6b13d ] In a previous effort to drop flash_info fields and rely on SFDP, the static size and no_sfdp_flags were removed from the MX25L12805D entry (JEDEC ID 0xc22018). At that time, the legacy MX25L12805D was already EOL and unavailable for physical testing. Verification was inadvertently performed using the newer MX25L12833F, which shares the same JEDEC ID but supports SFDP. As a result, the probe succeeded during testing, leading to the mistaken removal of the fallback parameters. Since the actual MX25L12805D lacks SFDP support entirely, it strictly requires these static parameters. Restore .size = SZ_16M and .no_sfdp_flags = SECT_4K to this entry to fix the probe failure for the legacy part. Fixes: 947c86e481a0 ("mtd: spi-nor: macronix: Drop the redundant flash info fields") Cc: stable@vger.kernel.org Signed-off-by: Cheng Ming Lin Reviewed-by: Michael Walle Tested-by: Russell Senior Signed-off-by: Michael Walle [ sashal: Adjusted patch context to account for the absent mx25l12805d_4pp3b_fixups hook. ] Signed-off-by: Sasha Levin commit c2dd90002865dcda939a041b76651172115ec85b Author: Richard Fitzgerald Date: Wed Nov 11 11:36:16 2026 +0300 ASoC: cs35l56: Wait for firmware timer expiry before system suspend commit 6cc7db9fdd06c992ee38793b2d556524fc0cf574 upstream. On CS35L5x firmware older than 3.13.7 (B0 silicon) and 4.7.16 (B2 silicon) a SoundWire bus reset is not allowed within 250ms of the last firmware timer start. This is already avoided during runtime suspend by the various idle timeouts. System suspend can happen at any time so needs special protection. The driver cannot cancel the firmware timer, so it must wait long enough for the timer to expire. The delay is placed in the suspend stage because typically this has less impact on end users than delays in resuming. The amp is in PS3 power state when suspending and no new timers will be started in this state. An extra 10ms is added to the delay to avoid a race on the exact instant the firmware timer expires. There is no need to have the delay for every driver instance. The timers on each amp will expire in parallel, so the delay is only needed once. A global flag is used so that the first instance to reach its suspend() callback will delay and then clear the flag. The cs35l56_fw_idle_wait_lock mutex is to ensure this is still safe if async_suspend was ever enabled for SoundWire devices. Fixes: e496112529006 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56") Reported-by: Ferenc Lengyel Closes: https://github.com/thesofproject/linux/issues/5898 Signed-off-by: Richard Fitzgerald Link: https://patch.msgid.link/20261020135706.3573260-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sercan GOKMEN Signed-off-by: Sasha Levin commit 96ecddc5141c967c5a59fa85ccbdfdb3cec61209 Author: Jason Gunthorpe Date: Tue Nov 10 07:54:17 2026 -0500 iommu/arm-smmu-v3: Handle ARM erratum for CONT under invalidation with SVA [ Upstream commit 84c6089a365ff5547f9ea30cb407dc5fe3124fd3 ] The erratum (MMU-700: #3777127, S3: #3673557) deals with under invalidation of a CONT PTE grouping in the SMMU. The recommended work around is to use a range invalidation that spans the entire CONT. The only user of CONT in the kernel right now is through SVA sharing a CPU page table that contains a CONT created by the mm. Previously it was thought that this errata was dealt with because the driver always uses range invalidation. However, there is a subtle detail in the errata that the invalidation range must fully enclose the entire CONT for it to work. It seems that two sequential range invalidations, with a split point falling inside a CONT grouping, will not prevent the errata. The SMMU's range invalidation generation algorithm does not produce a single invalidation for a single SVA invalidation request, nor does the mm carefully align the SVA invalidation ranges to accommodate the splitting of the invalidation into several ranges. Thus, when processing a SVA invalidation, the range invalidation splitting routine can generate a range invalidation that is split in the middle of the CONT and risk under invalidation from this errata. This condition could be triggered by a malicious userspace manipulating the TLB gathers via mmap/mprotect/munmap. Update the errata list to the include the S3 variation, detect the IOMMUs that have it, and then have SVA invalidations use a simplified version of the over invalidation algorithm from the tlbi rework series. This ensures that a single range invalidation is issued for a single MMU notifier callback and now the range invalidation is guarenteed to cover any posible CONT. Future work to add CONT to iommu_domain page tables should either use this one-invalidate/one-range invalidation algorithm or disable CONT support in the iommu_domain. Cc: stable@vger.kernel.org Cc: Vijayanand Jitta Fixes: 3f1ce8e85ee0 ("iommu/arm-smmu-v3: Share process page tables") Reviewed-by: Mostafa Saleh Reviewed-by: Pranjal Shrivastava Tested-by: Nicolin Chen Tested-by: Pranjal Shrivastava Signed-off-by: Jason Gunthorpe Signed-off-by: Will Deacon [ sashal: Adjusted header context to account for the missing ARM_SMMU_OPT_OVR_INSTCFG_DATA definition. ] Signed-off-by: Sasha Levin commit 10c6a917284f584162974767d4e2a0cf411db684 Author: Zhao Gongyi Date: Tue Nov 10 14:56:01 2026 +0800 ata: libata-scsi: reject data-in commands with a data-out buffer [ Upstream commit a4845f077415ef32fe672c841e2fc58ae9e28273 ] SG_IO can submit a data-in SCSI command with DMA_TO_DEVICE. The scatterlist can then contain pages pinned without write access. ata_scsi_rbuf_fill() writes simulated replies to that scatterlist; in the reported case, the copy tried to write the shared zero page and faulted in the kernel. The same mismatch can affect SG_IO commands translated by libata. ZBC IN and GET PHYSICAL ELEMENT STATUS completion handlers can modify the receive buffer even if the drive aborts the command. For ATAPI, the successful INQUIRY completion also rewrites the buffer in atapi_fixup_inquiry(). Reject these mismatched commands before the buffer is written or the command is issued. Report ABORTED COMMAND / DATA IN BUFFER ERROR because the CDB itself can be valid; the supplied transfer direction is wrong. Backport notes: Use the older five-argument ata_scsi_set_sense() interface and spell DATA IN BUFFER ERROR as ASC/ASCQ 0x4b/0x0a. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Link: https://lore.kernel.org/r/20261104130638.37882-1-zhaogongyi@bytedance.com Cc: stable@vger.kernel.org Signed-off-by: Zhao Gongyi Reviewed-by: Damien Le Moal Signed-off-by: Niklas Cassel Signed-off-by: Sasha Levin commit 326bea8dbc9dc741a39c33b4a8cb6ce07dc4cdbe Author: Sven Eckelmann Date: Tue Nov 10 19:43:31 2026 +0100 batman-adv: tt: only update flags for TT events commit ad1fd828aa3944efc393b84b0d7c02483f1b5638 upstream. In the first implementation of the translation table events, it was only possible to announce: * ADD: new locally detected client * DEL: disappeared local client If an ADD event was queued and then a DEL event was queued in the same timeslot, it is valid to destroy both events because nothing actually changed for remode nodes But with commit 3c4f7ab60cc2 ("batman-adv: improve the TT component to support runtime flag changes") and subsequent changes, it could also happen that there are extra ADD events: * ADD: _NEW_ locally detected client * ADD: already existing client with new flags * DEL: disappeared local client The first and the last type of event could in theory still be removed together from the (to be announced) events queue. But if the "update flags" ADD is dropped together with the DEL, it would still leave global translation table of a remote node in the incorrect state - believing that the client didn't disappear. If a detected client was previously announced, a DEL event must only overwrite the "update flags" ADD but the DEL itself must still continue to exist in the (to be anounced) events queue. For now, adjustment of the announced flags is used for everything instead of dropping already queued up events completely. Similarly, a DEL followed by an ADD caused both entries to be deleted. But the new ADD could announce flags changes which were not yet present for the client before it was marked for DELetion. The new ADD must therefore only overwrite the DEL - but still be kept. Cc: stable@vger.kernel.org Fixes: 3c4f7ab60cc2 ("batman-adv: improve the TT component to support runtime flag changes") [ Context ] Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 9f85c59705c33c4577c2520f3b53294ded64278e Author: Sven Eckelmann Date: Tue Nov 10 19:42:40 2026 +0100 batman-adv: tt: send ROAM_ADV on each roamed back client commit aff4d5d10f2dcb4a9b604e27414dafa1d51b6406 upstream. When a ROAMING_ADV is received for an announced local client, batadv_roam_tvlv_unicast_handler_v1() creates a global entry with the BATADV_TT_CLIENT_ROAM flag set. If the client sends a frame again before the next TTVN commit, batadv_tt_local_add_roam() is expected to announce this return via a ROAM_ADV frame. But this doesn't happen because the global entry (created by the first ROAMING_ADV) carries BATADV_TT_CLIENT_ROAM until the new originator announces the client. Let batadv_tt_local_add_roam() always handle a roamed back client - independent of the ROAM flag of the global entry: * trigger sending of the ROAM_ADV frame(s) * remove the (with the roaming) associated global entry Cc: stable@vger.kernel.org Fixes: 068ee6e204e1 ("batman-adv: roaming handling mechanism redesign") [ adjust code still in batadv_tt_local_add ] Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 32d45d029d9ffdeb99e86ed21406a70485fe08cc Author: Sven Eckelmann Date: Tue Nov 10 19:41:41 2026 +0100 batman-adv: tt: clear ROAM flag when re-adding a pending local client commit cc2186d7854785b30d423f5d43757b086b300e55 upstream. When a ROAMING_ADV is received for an announced local client, batadv_tt_local_mark_removed() sets BATADV_TT_CLIENT_ROAM, queues a DEL|ROAM change and marks the entry as BATADV_TT_CLIENT_PENDING. If the client sends a frame again before the next TTVN commit, batadv_tt_local_add_existing() only clears the PENDING flag and returns early. The ADD cancels the queued DEL, but the entry keeps the ROAM flag: * batadv_is_my_client() reports the client as not served by this node * batadv_tt_local_client_is_roaming() reroutes unicast frames for it to the node which sent the ROAMING_ADV The ROAM flag is only removed with the next frame of the client. Since BATADV_TT_CLIENT_ROAM is set together with BATADV_TT_CLIENT_PENDING, it has to be cleared also at the same time with BATADV_TT_CLIENT_PENDING when the client roamed back. Cc: stable@vger.kernel.org Fixes: 068ee6e204e1 ("batman-adv: roaming handling mechanism redesign") [ adjust code still in batadv_tt_local_add ] Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 4c7181bf065c42b2836af198214d2aae6d710bc8 Author: Sven Eckelmann Date: Tue Nov 10 19:40:16 2026 +0100 batman-adv: tt: only transmit local ROAM flag together with DEL commit 10f24f058417024a2c19cb8d88a6a0678a58a21b upstream. BATADV_TT_CLIENT_ROAM is part of BATADV_TT_REMOTE_MASK but on the wire it only has a defined meaning together with BATADV_TT_CLIENT_DEL: the originator no longer serves the client because it roamed to another node. Such a DEL is only relevant for events (non-full table requests). An ADD carrying ROAM is processed (by accident) by the receiver like a ROAMING_ADV: a newly created global entry is marked as roaming and is excluded from the global CRC. But the sender includes it in its local CRC. But such a behavior doesn't make sense for non-ROAM_ADV because a new TTVN is meant as announced commit of the local TT table of a node and should therefore not be used to create a temporary (roam) global entry in a node. At the moment, such an ADD with the BATADV_TT_CLIENT_ROAM flag set can happen due to two mechanisms: batadv_tt_local_valid() copies all flags of the local entry into a full table response. It is not synchronized with batadv_tt_local_mark_removed(). An entry which was marked as ROAM|PENDING by a ROAMING_ADV is still part of the current TTVN and is sent with the ROAM flag set. The receivers then create a roaming global entry for it and detect a CRC mismatch, which causes them to request the full table again. The same can happen for an ADD change which is queued for an entry which (still) has the ROAM flag set. For example when only the dynamic WIFI or ISOLA flags were updated. It is not triggered by batadv_send_other_tt_response() because batadv_tt_global_valid() is already taking care of filtering out BATADV_TT_CLIENT_ROAM entries. For the two problematic announcement mechanism, only send the ROAM flag of local entries together with a DEL. This only fixes the ROAM marking of the global entry and the resulting CRC mismatch. When the requester of the full table is the node which sent the ROAMING_ADV, the still announced entry will (independent of the ROAM flag) cause batadv_tt_global_purge_local() to remove the requester's own (new) local entry for the client. This is not addressed here. Cc: stable@vger.kernel.org Fixes: 27b37ebfa2d2 ("batman-adv: correctly pass the client flag on tt_response") Fixes: 068ee6e204e1 ("batman-adv: roaming handling mechanism redesign") [ use direct tt_common_entry->flags access ] Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 474a69bd1d8bd106b4396e0c0bc2bcd7bdf5f99f Author: Ido Schimmel Date: Tue Nov 10 18:33:34 2026 +0200 vxlan: Stop rejecting dynamic FDB entries with a nexthop ID [ Upstream commit 7308ef8b4a6779a39f68d053c19b53a5c584a663 ] Commit 98fc57d16744 ("vxlan: reject dynamic fdb entries that reference a nexthop id") started rejecting FDB entries that point to FDB nexthops unless they are configured as "permanent" or "static". The intent was to prevent such entries from being aged out by vxlan_cleanup(), which runs without RTNL and can therefore race with other VXLAN devices that modify the same per-nexthop FDB list. However, FRR installs remote MACs that are behind a multihomed Ethernet Segment (EVPN-MH) as dynamic FDB entries that point to an FDB nexthop group. Since the above commit, these entries are rejected and traffic towards the corresponding MACs is flooded to all the remote VTEPs. These entries are also marked as externally learned ("extern_learn") and are therefore skipped by vxlan_cleanup(), but exempting externally learned entries from the checks is not enough: vxlan_cleanup() reads the state and flags of an entry without the hash lock, so an entry that is concurrently changed from dynamic and externally learned to static can still be aged out. Instead, remove the checks added by the above commit and make vxlan_cleanup() skip FDB entries that point to FDB nexthops. Such entries can only be configured from user space, cannot be learned and cannot roam, so there is no reason to age them out. The nexthop pointer of an FDB entry is set before the entry is linked and is only cleared after it was unlinked and an RCU grace period has passed, so it can be checked without the hash lock. Adjust the test cases added by the above commit and add a test case that checks that dynamic FDB entries that point to FDB nexthops are not aged out. Without the fix: # ./fib_nexthops.sh -t "ipv4_fdb_grp_fcnal ipv6_fdb_grp_fcnal" IPv4 fdb groups functional -------------------------- [...] TEST: Fdb mac add with nexthop group and dynamic state [FAIL] TEST: Fdb mac add with nexthop group and extern_learn [FAIL] TEST: Fdb mac without nexthop group aged out [ OK ] TEST: Fdb mac with nexthop group not aged out [FAIL] [...] IPv6 fdb groups functional -------------------------- [...] TEST: Fdb mac add with nexthop group and dynamic state [FAIL] TEST: Fdb mac add with nexthop group and extern_learn [FAIL] TEST: Fdb mac without nexthop group aged out [ OK ] TEST: Fdb mac with nexthop group not aged out [FAIL] [...] Tests passed: 44 Tests failed: 6 Tests skipped: 0 With the fix: # ./fib_nexthops.sh -t "ipv4_fdb_grp_fcnal ipv6_fdb_grp_fcnal" IPv4 fdb groups functional -------------------------- [...] TEST: Fdb mac add with nexthop group and dynamic state [ OK ] TEST: Fdb mac add with nexthop group and extern_learn [ OK ] TEST: Fdb mac without nexthop group aged out [ OK ] TEST: Fdb mac with nexthop group not aged out [ OK ] [...] IPv6 fdb groups functional -------------------------- [...] TEST: Fdb mac add with nexthop group and dynamic state [ OK ] TEST: Fdb mac add with nexthop group and extern_learn [ OK ] TEST: Fdb mac without nexthop group aged out [ OK ] TEST: Fdb mac with nexthop group not aged out [ OK ] [...] Tests passed: 50 Tests failed: 0 Tests skipped: 0 Fixes: 1274e1cc4226 ("vxlan: ecmp support for mac fdb entries") Fixes: 98fc57d16744 ("vxlan: reject dynamic fdb entries that reference a nexthop id") Cc: stable@vger.kernel.org Reported-by: Sascha Frey Closes: https://lore.kernel.org/netdev/20261028142928.GA8406@techfak.de/ Tested-by: Sascha Frey Signed-off-by: Ido Schimmel Reviewed-by: Nikolay Aleksandrov Link: https://patch.msgid.link/20261030133750.28668-1-idosch@nvidia.com Signed-off-by: Paolo Abeni [ idosch: fixed a small conflict in vxlan_fdb_add() and vxlan_cleanup() ] Signed-off-by: Ido Schimmel Signed-off-by: Sasha Levin commit 9d06011f8c5b4c9989397a501483fec0f4a149cb Author: Guanglei Zhu Date: Tue Nov 10 09:56:38 2026 +0800 ceph: clamp the inline data length in ceph_fill_inline_data() [ Upstream commit 9c1d14d3b66b3e1dd96ee664c0dd2548f2b77a52 ] The MDS decides how much inline data to attach to a reply, and the client parses inline_len without any upper bound: ceph_decode_need() only verifies that the message actually carries that many bytes. ceph_fill_inline_data() then copies the data into a single page with no length check, so a malicious or buggy MDS returning more inline data than the page can hold writes past its end. Clamp the length to PAGE_SIZE so both callers, handle_cap_grant() and fill_inode(), are covered. Cc: stable@vger.kernel.org Fixes: 31c542a199d7 ("ceph: add inline data to pagecache") Signed-off-by: Guanglei Zhu Reviewed-by: Alex Markuze Signed-off-by: Ilya Dryomov [ Adapted for 7.3.y: folio_size()/memcpy_to_folio() → PAGE_SIZE and the page API; the trees with pr_warn_ratelimited_client() keep the warning (7.3, 6.18, 6.12, 6.6) and the trees without it (6.1, 5.15, 5.10) drop it. ] Signed-off-by: Guanglei Zhu Signed-off-by: Sasha Levin commit bdbbf5ad5d032e8cb4b5356d0f3970829f0309c0 Author: Suravee Suthikulpanit Date: Tue Nov 10 14:00:20 2026 +0100 iommu/amd: Force device table to maximum size commit 6e2213dae78b41976c60133eb10cf99e81916638 upstream. IOMMU can perform out-of-bounds read of the device table entry (DTE) that is adjacent to the last DTE and falls outside the device table. For example, if the device table can hold 0 to N-1 entries, then the IOMMU can be made to fetch the Nth entry, which falls outside the device table. The device table is owned by the hypervisor (HV) and is assigned in 4KB pages that are contiguous in system physical address (SPA). If the out-of-bound DTE falls on a guest-owned page, then the guest can exploit this bug to setup malicious table walks to corrupt HV pages and/or bring down the system. Note that this bug does not manifest when the device table size is set to its maximum size of 2MB. Therefore, force the device table size to the maximum 2MB on affected processors. These are CPU family 0x17 (Zen1/Zen2) through family 0x1a (Zen5/BRH). This is a mitigation for CVE-2024-21963. kdump reuses the previous kernel's device table only when the size encoded in the IOMMU device-table register matches pci_seg->dev_table_size. A mixed rollout disagrees: the unpatched kernel uses the IVRS-derived size and the patched kernel uses 2MB, so __reuse_device_table() rejects the table. On SNP-capable IOMMUs that rejection panics the kdump kernel. Kernels that both have this patch agree on 2MB and reuse succeeds. Update the production kernel and the crash kernel together. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Joerg Roedel Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman commit 02938c10d9e5c7631c8dbd6c48517805c1edf0a6 Author: Chris Mason Date: Fri Nov 6 18:47:17 2026 -0500 x86/mm: Fix global ASID handed out to two processes [ Upstream commit 5cdc3746fa163fb4e8d05fa3cabf46bc6aa7df75 ] On AMD CPUs with INVLPGB, two live processes can get the same MAX_ASID_AVAILABLE global ASID value. The two then hit each other's TLB entries, so each can read or corrupt the other's memory. The global ASID space is managed lazily. When a global ASID is freed, its bit is set in the global_asid_freed bitmap. Once the free ASID search reaches the end of the global_asid_used bitmap, a global flush is done to really reclaim the lazily freed global ASIDs. However, the current code can assign the same global ASID to two different processes, if one process is assigned MAX_ASID_AVAILABLE - 1, another process MAX_ASID_AVAILABLE, and both stick around (keeping their global ASID numbers in use) until the search wraps around again. At that point a third process could also get assigned MAX_ASID_AVAILABLE. the highest ASID stays in use, so it is not handed out again last_global_asid stays below it, so no reset the clear bits run out find_next_zero_bit() returns MAX_ASID_AVAILABLE global_asid_available > 0, so the failure is not caught MAX_ASID_AVAILABLE is handed out as an ASID A search only looks at the bits below MAX_ASID_AVAILABLE, so it cannot see that this value is in use. The next failed search hands it out again, even if the first process still holds it. The fix used here is to reset the global ASID space after a failed search, and to search again. If that search fails too, no global ASID is handed out. The test for !global_asid_available is removed, because use_global_asid() only calls allocate_global_asid() if global_asid_available > 0. The remaining test is for a condition that should be impossible. [ riel: simplify code, massage changelog and comment ] Fixes: d504d1247e36 ("x86/mm: Add global ASID allocation helper functions") Signed-off-by: Chris Mason Signed-off-by: Rik van Riel Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Thomas Gleixner Reviewed-by: Dave Hansen Cc: Signed-off-by: Sasha Levin commit 2721eafb7e1ff2c4c9dc4737aca61767ba5afedf Author: Marco Ziliani Date: Sat Nov 7 14:13:30 2026 +0100 ata: libata-pmp: disable the SEMB port on Marvell 88SM9705 [ Upstream commit 6b67cdb463b006e57f15e3fe4ea03b00f0ac9ee5 ] The Marvell 88SM9705 is a 1-to-5 SATA port multiplier with one additional SEMB (SATA Enclosure Management Bridge) port [1]. Ports 0-4 are device ports and port 5 is the SEMB. The number of fan-out ports in GSCR[2] is 6 when the SEMB is enabled and 5 when it is not, so on boards without the SEMB there is no link 5 and this quirk does nothing. That includes the common 8-port PCIe cards that pair an 88SE9215 with an 88SM9705, which report 5 ports. The SEMB port never answers SRST. libata probes it like a device port, and every EH round on the PMP ends in a retry loop that lasts about a minute before EH gives up, then starts over: ata19.15: Port Multiplier 1.2, 0x1b4b:0x9705 r160, 6 ports, feat 0x1/0x1f ata19.05: hard resetting link ata19.05: failed to resume link (SControl 0) ata19.05: softreset failed (1st FIS failed) ata19.05: hard resetting link ... ata20.05: reset failed, giving up Disk discovery waits for this, including disks on other controllers. libata.force only partly works around it. The "disable" horkage only takes effect after IDENTIFY, which the SEMB link never reaches. "norst" on port 5 stops the retry loop, but the disks still come up about a minute later than with this change (see below). Treat port 5 the same way as port 4 of the Marvell 88SM4140 and mark the link ATA_LFLAG_DISABLED. Tested on a Synology DX1222 expansion unit (four 88SM9705 r160 behind a Marvell 88SE9235, passed through to a KVM guest, 6 disks), 7.4-rc1 with and without this change, one boot each: softreset reset failed, last disk failed giving up attached 7.4-rc1, no libata.force 60 12 197 s 7.4-rc1, libata.force=N.05:norst 0 0 70 s 7.4-rc1 + this patch, no force 0 0 11 s The problem was first found on a Synology DX1215 with the same chain, where this change brought the disks up after about 20 s instead of about 200 s, including a disk on a separate AHCI controller. Each PMP still logs one "failed to resume link (SControl 0)" for port 5 at probe time. Link: https://www.marvell.com/content/dam/marvell/en/public-collateral/storage/marvell-storage-88sm9705-functional-specifications-2015-06.pdf [1] Cc: stable@vger.kernel.org Tested-by: Kyrylo Biryuk Signed-off-by: Marco Ziliani Link: https://lore.kernel.org/r/20261107-pmp-88sm9705-v2-1-18eed983d3db@gmail.com Signed-off-by: Niklas Cassel Signed-off-by: Sasha Levin commit d56db59d42d03d138ab643f765c84a48876f7a6a Author: Kiryl Shutsemau (Meta) Date: Thu Nov 5 12:08:34 2026 +0000 arm64: sdei: Preserve the interrupted context's exception registers [ Upstream commit 58c1eb84e97701c583605ba2fd553b69afba2245 ] An SDEI event is dispatched by firmware regardless of PSTATE.DAIF, so it can interrupt the kernel where the exception registers are live: - exception entry, before kernel_entry has saved ELR_EL1/SPSR_EL1 and before the C handler has read ESR_EL1/FAR_EL1; - exception return, after kernel_exit has loaded ELR_EL1/SPSR_EL1 and before the ERET. An IRQ or pseudo-NMI cannot arrive there with PSTATE.I set. Firmware saves only x0-x17, PC and PSTATE around an SDEI event, so a synchronous exception taken by the handler overwrites the interrupted context's ELR, SPSR, ESR and FAR. do_sdei_event() only notices that ELR changed, and warns. The interrupted context then carries on with the handler's state. A task interrupted on its way into the kernel can be sent SIGILL for the handler's kernel data abort. A task interrupted on its way back to user space ERETs to EL1, at the handler's fixup address, with user registers loaded. With SDEI delivering NMI backtraces, this happens in normal operation. The handler runs show_regs(), which reads through possibly-NULL pointers with the _nofault() accessors. print_worker_info() faults this way for a kworker that is not running a work item, and a single sysrq-l warned once per such kworker. Save ELR, SPSR, ESR and FAR in __sdei_handler() before irqentry_nmi_enter(), which can take an exception too, and restore them after irqentry_nmi_exit(). Once they are restored, a nested exception is harmless if its handler is safe in NMI context. That holds for EL1 data aborts on translation, permission and access-flag faults, which never take the mmap lock in NMI context, and for BRK. Warn once, with the syndrome, about any other exception class. Fixes: f5df26961853 ("arm64: kernel: Add arch-specific SDEI entry code and CPU masking") Cc: stable@vger.kernel.org Signed-off-by: Kiryl Shutsemau (Meta) Tested-by: Breno Leitao Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin commit b63d0a1425b96b4a484932a3466f2a84d3bdc2dd Author: Kiryl Shutsemau (Meta) Date: Thu Nov 5 12:08:33 2026 +0000 arm64: sdei: Run the event handler on the kernel vectors [ Upstream commit 9bf6ee7952c7ee151c30e0fffcfc61b58127c899 ] With KPTI, VBAR_EL1 holds the trampoline vectors from the return to EL0 until the next exception from EL0 maps the kernel and installs the kernel vectors. The trampoline vectors only handle exceptions from EL0; their current-EL half is zero-filled. An SDEI event is dispatched regardless of PSTATE.DAIF, so it lands there whenever the CPU is in user space. The SDEI entry trampoline maps the kernel but leaves VBAR_EL1 alone. An exception taken by the handler then executes the zeros, takes an undefined instruction exception to the same vector, and loops there forever. The event never completes and the CPU is lost; RCU stall reports are the first sign of it. RAS notifications land in user space whenever a task consumes the error, and NMI backtraces land wherever the CPU happens to be. The GHES handler takes no exception on its own, but any exception in the handler path does it: a WARN, a kprobe hit, or a fault fixed up by a _nofault() accessor. Install the kernel vectors in __sdei_handler() when VBAR_EL1 holds the trampoline vectors, and restore it before returning to firmware. The switch covers irqentry_nmi_enter() and irqentry_nmi_exit() too, as Usama Arif pointed out: their tracepoints and context tracking WARNs can take an exception as well. The IRQ-like resume into user space must still go through the trampoline to map the kernel. do_sdei_event() takes the interrupted VBAR_EL1 and keeps basing the resume address on it. Fixes: 79e9aa59dc29 ("arm64: sdei: Add trampoline code for remapping the kernel") Cc: stable@vger.kernel.org Signed-off-by: Kiryl Shutsemau (Meta) Reviewed-by: Catalin Marinas Tested-by: Breno Leitao [catalin.marinas@arm.com: use raw_cpu_read() for this_cpu_vector] Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin commit d832c9f3a3f757c36ca32dfb911a82cee8f209de Author: Thorsten Blum Date: Fri Sep 18 16:27:13 2026 +0200 x86/boot: Fix off-by-one error in sme_clear_pgd() [ Upstream commit cb319926808b1cca522d2087a13205e840beb45b ] The mapping helpers __sme_map_range_pmd() and __sme_map_range_pte(), and therefore sme_encrypt_kernel(), use exclusive end addresses and stop before vaddr reaches vaddr_end. However, sme_clear_pgd() treats vaddr_end as inclusive when calculating the last PGD entry to clear. If vaddr_end is PGD-aligned, the first PGD entry outside the range is cleared too. Use vaddr_end - 1 to calculate the last PGD entry within the range. Fixes: 6ebcb060713f ("x86/mm: Add support to encrypt the kernel in-place") Signed-off-by: Thorsten Blum Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Tom Lendacky Cc: Link: https://patch.msgid.link/20260918142714.242711-2-blum@kernel.org Signed-off-by: Sasha Levin commit f118ee71df3a2d3c54d57cfbe3643a9a29b83128 Author: Jinjie Ruan Date: Thu Nov 5 20:57:24 2026 +0800 arm64: kexec_file: Fix elf_headers memory leak in retry loop [ Upstream commit ac302aea3d824ccc99f29b8e499c365cb9a684a9 ] A retry allocates new elf headers and overwrites image->elf_headers, leaking the previous buffer. Free it before assigning. Cc: Will Deacon Cc: Thomas Huth Cc: Breno Leitao Cc: Andrew Morton Cc: Yeoreum Yun Cc: Baoquan He Cc: stable@vger.kernel.org Fixes: 108aa503657e ("arm64: kexec_file: try more regions if loading segments fails") Acked-by: Catalin Marinas Signed-off-by: Jinjie Ruan [catalin.marinas@arm.com: drop the redundant NULL check before vfree()] Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin commit 399c8fb1fafc9114877125bc5c8e3225d4f8222f Author: Kevin Mitchell Date: Thu Nov 5 16:32:18 2026 +0000 iommu/amd: remove obsolete domain pointer warning on release [ Upstream commit fa77b023eb80cdb297ff32f6b13786e483a81ca8 ] A warning is triggered in amd_iommu_release_device() on removal of a device with an IOMMU_RESV_DIRECT region. The warning is based on the false assumption that correct attachment to the release_domain will always result in a NULL dev_data->domain pointer. For devices with IOMMU_RESV_DIRECT (and consequently dev->iommu->require_direct), the release domain is the permanent identity_domain which sets itself to dev_data->domain on attach. This behaviour was added in commit e94160488e65 ("iommu: Generic support for RMRs during device release"). Commit c21b34762e2f ("iommu/amd: Set release_domain to blocked_domain") caused it to take effect for AMD IOMMU. Remove the warning as it is no longer strictly an error to have a non-NULL domain pointer. As this leaves amd_iommu_release_device() empty, remove it. The warning was observed for a device with direct mapped region: /sys/bus/pci/devices/0000:04:00.0/iommu_group/reserved_regions: 0x00000000fee00000 0x00000000feefffff msi 0x000000fd00000000 0x000000ffffffffff reserved 0x0000fffd00000000 0x0000ffffffffffff direct Upon hotunplug: [ 28.715475] pcieport 0000:00:03.1: pciehp: Slot(0-3): Link Down [ 28.715482] pcieport 0000:00:03.1: pciehp: Slot(0-3): Card not present [ 28.715601] ------------[ cut here ]------------ [ 28.715603] WARNING: drivers/iommu/amd/iommu.c:2521 at amd_iommu_release_device+0x5d/0x70, CPU#4: irq/29-pciehp/99 [ 28.715657] RIP: 0010:amd_iommu_release_device+0x5d/0x70 [ 28.715687] Call Trace: [ 28.715689] [ 28.715694] iommu_deinit_device+0x84/0x110 [ 28.715699] __iommu_group_remove_device+0xa8/0xd0 [ 28.715703] iommu_bus_notifier+0x48/0x70 [ 28.715707] notifier_call_chain+0x48/0xe0 [ 28.715712] blocking_notifier_call_chain+0x45/0x60 [ 28.715716] bus_notify+0x3b/0x60 [ 28.715720] device_del+0x259/0x3b0 [ 28.715730] pci_remove_bus_device+0x85/0x100 [ 28.715735] pciehp_unconfigure_device+0x9d/0x180 [ 28.715743] __pciehp_disable_slot+0x47/0xe0 [ 28.715747] pciehp_handle_presence_or_link_change+0x80/0x5e0 [ 28.715753] pciehp_ist+0x162/0x290 Fixes: c21b34762e2f ("iommu/amd: Set release_domain to blocked_domain") Cc: stable@vger.kernel.org Signed-off-by: Kevin Mitchell Reviewed-by: Jason Gunthorpe Signed-off-by: Vasant Hegde Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin commit 92c5a0127253e9f8fc4a0b3ae11aa232863f722a Author: Akshay Jindal Date: Thu Nov 5 16:32:17 2026 +0000 iommu/amd: Skip non-IVMD entries when parsing IVRS memory definitions [ Upstream commit e62df37e0eff4d670e78bbd415be2c1675883c15 ] init_memory_definitions() walks every top-level subtable including the IVHD blocks (type 0x10/0x11/0x40) in the IVRS ACPI table. It interprets each one as a 'struct ivmd_header', solely on m->flags, without first checking that the subtable's type actually is one of the IVMD types (ACPI_IVMD_TYPE, ACPI_IVMD_TYPE_ALL, ACPI_IVMD_TYPE_RANGE). if (m->flags & (IVMD_FLAG_UNITY_MAP | IVMD_FLAG_EXCL_RANGE)) init_unity_map_range(m, table); IVMD_FLAG_UNITY_MAP (0x01) occupies the same bit position as the IVHD flags field's HtTunEn bit. Unlike real hardware, QEMU's AMD IOMMU emulation sets HtTunEn unconditionally (flags=0xD1 for type 0x10, 0x11 for type 0x11), so every QEMU-emitted IVHD block is misidentified as a unity-map/exclusion-range IVMD entry, which subsequently results in the creation of a bogus pci segment. Eg: AMD-Vi: PCI segment : 0x4000, last bdf : 0x0000 Fix by checking the subtable's type before treating it as IVMD. Fixes: be2a022c0dd0 ("x86, AMD IOMMU: add functions to parse IOMMU memory mapping requirements for devices") Cc: stable@vger.kernel.org Signed-off-by: Akshay Jindal Signed-off-by: Vasant Hegde Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin commit 6283377a078cbc6fd3b583bd32e1e1e7cd8125e1 Author: Breno Leitao Date: Tue Oct 27 03:43:51 2026 -0700 x86/nmi: Ignore negative NMI handler durations [ Upstream commit ade63af6cfb7b3ca19ced28730fd6461e8d1d410 ] I am seeing NMI handlers in the Meta fleet reported as running for about 584 years. Over 30 days, 11 AMD and Intel machines logged 637 such lines, for example: AMD EPYC 9D25 (family 0x1a, model 0x11, stepping 0x0): [ 1650.616627] INFO: NMI handler (nmi_cpu_backtrace_handler.llvm.9643156322683129580) took too long to run: 18446744073709.551 msecs Intel Xeon Platinum 8321HC (family 0x6, model 0x55, stepping 0xb): [360448.230129] INFO: NMI handler (perf_event_nmi_handler) took too long to run: 18446744071018.936 msecs Intel Xeon D-2191A (family 0x6, model 0x55, stepping 0x4): [81787.188959] INFO: NMI handler (ghes_notify_nmi) took too long to run: 18446744073709.545 msecs nmi_handle() times each handler with two sched_clock() reads. When the second read is lower than the first, the u64 subtraction wraps, and nmi_check_duration() treats the result as a duration. In the three examples, the clock went back by less than 1 us, by 2.7 s and by about 6 us. The wrapped value is also stored in action->max_duration. Every later real duration is smaller, so the handler is never reported again until the next boot. Whatever makes the clock read lower, a negative difference is not a duration, so return before it is stored or reported. A clock that steps forward is not covered, since that cannot be told from a real stall. A backwards clock is still worth knowing about, so print the size of the step once per boot. This uses pr_warn_once() rather than WARN, as a stack trace says nothing about the clock and panic_on_warn machines should not go down for it. Fixes: 2ab00456ea8a ("x86: Warn when NMI handlers take large amounts of time") Signed-off-by: Breno Leitao Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261027-nmi_negative-v1-1-b436a005eb8a@debian.org Signed-off-by: Sasha Levin commit b91da5a7f8bc9ff522c5554c1a1934c2cb7991fe Author: Daehyeon Ko <4ncienth@gmail.com> Date: Fri Oct 23 08:52:33 2026 +0900 sched/fair: Clear throttle state when leaving the fair class [ Upstream commit c282051fc2cae2ea54770ebe435dbea090272c25 ] Task-based CFS bandwidth throttling removes a task's fair sched_entity while the scheduler core still considers the task queued. p->throttled carries the fair-specific state across dequeue/enqueue operations. DEQUEUE_CLASS removes the task from cfs_rq->throttled_limbo_list but retains the bit. If the last finite CFS quota is disabled while the task runs in another class, it is absent from the unthrottle walk and the bit survives. Returning to fair while cfs_bandwidth_used() is false then performs a real fair enqueue with p->throttled still set. After bandwidth is re-enabled, a class-change dequeue treats the stale bit as limbo state and skips __dequeue_task(). p->se.on_rq therefore remains set, and put_prev_task_fair() places the entity in the EEVDF tree while the task moves to RT. On exit, the fair picker can select the TASK_DEAD task. __schedule() then returns to do_task_dead(), which hits BUG(). Keep p->throttled across migrations and group moves, but clear it on DEQUEUE_CLASS because fair-specific state must not outlive fair-class membership. A later return to fair uses the normal enqueue path. That path still respects a throttled cfs_rq. A KASAN, LOCKDEP and DEBUG_LIST v7.3 kernel reproduced the do_task_dead() BUG in 3/3 root and 3/3 delegated uid-1000 runs with CapPrm=CapEff=0 and RLIMIT_RTPRIO=1. The fix passed both matrices plus a 3/3 class-switch control with bandwidth continuously enabled, without a scheduler warning, KASAN report, lockdep splat or crash. An AI coding assistant analyzed the state mismatch and drafted the initial reproducer, fix candidate and this changelog. The source paths, trigger, controls and results were rechecked against the cited revisions. Fixes: e1fad12dcb66 ("sched/fair: Switch to task based throttle model") Signed-off-by: Daehyeon Ko <4ncienth@gmail.com> Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Reviewed-by: Aaron Lu Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261022235234.150957-1-4ncienth@gmail.com Signed-off-by: Sasha Levin commit 88181922ef56c974d27f361f04e5bdb01183cb64 Author: Danish Khateeb Date: Thu Oct 15 10:20:13 2026 -0500 perf/core: Don't send SIGTRAP after exec removed the event [ Upstream commit 6f083fbccd5f06889bc08e1182bd02c0383b9121 ] A sigtrap event must also set remove_on_exec, so that its SIGTRAP never reaches a program after exec. But the signal is sent from task work, which only runs on the way back to user space. If the event overflows shortly before execve(), the task work can still be pending when the task enters execve(), and then runs when execve() returns. By then perf_event_exec() has removed the event and the new program has default signal handlers, so the SIGTRAP kills it. The exec_stress test in the remove_on_exec selftest catches this and fails about half the time in a VM. A process that opens a sigtrap event on itself and then calls execve() is killed by SIGTRAP in 15% to 50% of runs, both on an AMD machine running v7.2 and in a VM, with or without close-on-exec on the event fd. Commit ffb684f2aa14 ("perf: Fix race between perf_event_exit_task() and perf_pending_task()") made perf_sigtrap() return once perf_event_exit_task() has set ctx->task to TASK_TOMBSTONE. Exec only calls perf_event_exit_task() when the new program is not dumpable, such as a setuid one. An ordinary exec keeps the context and only removes the remove_on_exec events, so the SIGTRAP is still sent. perf_event_exit_event() sets PERF_EVENT_STATE_EXIT when exec removes the event. If the event fd is close-on-exec and was the last reference to the file, exec also queues the file release as task work. Task work runs newest first, so perf_release() runs before the SIGTRAP work and moves the event on to PERF_EVENT_STATE_DEAD. So don't send the signal when the event state is PERF_EVENT_STATE_EXIT or lower, which means the event has been removed. That also covers PERF_EVENT_STATE_REVOKED, where the PMU is gone. Fixes: 97ba62b27867 ("perf: Add support for SIGTRAP on perf events") Assisted-by: LLM Signed-off-by: Danish Khateeb Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261015152013.106040-1-danishkhateeb03@gmail.com Signed-off-by: Sasha Levin commit fb802e496919a5ee0828a3f6186c5f7e8a32bb12 Author: Shao Mingyin Date: Wed Nov 4 03:07:27 2026 +0800 nvmet: bound the traddr and trsvcid configfs writes [ Upstream commit cf399d4abbeddc317f8160a79fefb4016c469862 ] nvmet_addr_traddr_store() and nvmet_addr_trsvcid_store() reject a write only when count is larger than NVMF_TRADDR_SIZE (256) respectively NVMF_TRSVCID_SIZE (32). A write of exactly that many characters is accepted, and the following sscanf(page, "%s\n", port->disc_addr.traddr) has no field width. configfs terminates the buffer at page[count], so the scan writes 256 characters plus the trailing NUL, i.e. 257 bytes, into traddr[256]. The extra byte lands in the following tsas field of the discovery log entry, silently clearing the first TSAS byte (the RDMA queue type, or the TLS section type for TCP). trsvcid has the same off-by-one with a 32-byte write; there the extra byte lands in the reserved bytes that follow trsvcid. Limit the scans to one byte less than the destination arrays. The count checks can stay as they are so that a normal newline-terminated write is still accepted. Fixes: 9ba2a5cb8896 ("nvmet: filter newlines from user input") Cc: stable@vger.kernel.org Signed-off-by: Shao Mingyin Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit eec7caddb4d152c72a7b6975c6e3f5589cddbdd4 Author: Qiliang Yuan Date: Wed Nov 4 01:30:40 2026 -0500 nvme: wait for SRCU readers before splicing the namespace list [ Upstream commit 8a0449832b50cd4f99f2d2952cfc1476e5f26d0f ] Readers walk ctrl->namespaces under ctrl->srcu, and some of them sleep there, e.g. nvme_wait_freeze() waiting for I/O to drain. nvme_remove_namespaces() moves the list onto its on-stack ns_list with list_splice_init_rcu(), which only waits for RCU readers before relinking the entries. A reader still on the last namespace then follows its next pointer to ns_list instead of ctrl->namespaces and treats the stack as a namespace. Deleting a controller while a Format NVM passthrough waits for a delayed read on the last namespace gives: BUG: KASAN: stack-out-of-bounds in nvme_wait_freeze+0x102/0x120 Read of size 8 at addr ff110001d2f3fc38 by task nvme/4413 Call Trace: nvme_wait_freeze nvme_passthru_start nvme_submit_user_cmd nvme_user_cmd nvme_dev_ioctl BUG: unable to handle page fault for address: ffffffff8af04850 Use list_splice_init_srcu() instead, which waits for the SRCU readers. This also takes the RCU grace period out of every controller deletion. Deleting 64 tcp controllers with one namespace each, median of 3 runs on each of two boots per kernel: before after nvme disconnect-all (ms) 3491 / 3509 2996 / 3165 nvme_remove_namespaces() avg (ms) 39.0 / 40.5 31.9 / 34.7 Fixes: be647e2c76b2 ("nvme: use srcu for iterating namespace list") Cc: stable@vger.kernel.org Signed-off-by: Qiliang Yuan Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit b66e38c17e5e1e9095f9c3cd203458c2bb11ea5b Author: Qiliang Yuan Date: Wed Nov 4 01:30:39 2026 -0500 srcu: Add list_splice_init_srcu() [ Upstream commit d06917d0ba226206dbd606330d73a8eb1e3029c1 ] list_splice_init_rcu() makes a list look empty to new readers, waits for the current ones with the given sync function, and only then links the entries into the new list. The sync function takes no argument, so it can wait for RCU readers but not for the readers of an srcu_struct. Passing synchronize_rcu() for a list read under SRCU still builds, but leaves SRCU readers on the entries while the last one's next pointer is moved onto the new list head. nvme_remove_namespaces() does this today. Add list_splice_init_srcu(), which waits for the readers of the given srcu_struct instead. Cc: stable@vger.kernel.org Suggested-by: Christoph Hellwig Signed-off-by: Qiliang Yuan Reviewed-by: Paul E. McKenney Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit d90f4cf6b8edc7e45aedf0036858448d0c1d4e2e Author: Imre Kaloz Date: Wed Oct 21 21:24:16 2026 +0200 MIPS: sgi-ip32: Leave MACE PCI control alone in config accesses [ Upstream commit a55a7df2cf788234850d9053ecc25a5470175929 ] mace_pci_read_config() clears the master abort interrupt enable in the MACE PCI control register around each config read. A register read followed by two register writes can hang CRIME 1.1 under DMA load. Ack master aborts in the error register instead, and follow every write with a read so back-to-back accesses cannot form that sequence. Fixes: c990081bf87b ("[MIPS] Fix IP32 breakage") Cc: stable@vger.kernel.org Signed-off-by: Imre Kaloz Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin commit 6e786c4081682e21b56e6e26356d3473f2b114a1 Author: Imre Kaloz Date: Wed Oct 21 21:24:15 2026 +0200 MIPS: sgi-ip32: Mask MACE PCI interrupts in CRIME only [ Upstream commit 4e65c502b8975e7c3c3d84aba59cd04af1dd6b8a ] Masking PCI interrupts in the MACE PCI control register overwrites the error and arbitration enables set at init, and a read-modify-write can hang CRIME 1.1 machines under DMA load. Enable the slot interrupts once and mask them in CRIME. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Imre Kaloz Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin commit 8f3d85db66c58a25373e6536db091a1f0fd2b039 Author: Imre Kaloz Date: Wed Oct 21 20:57:09 2026 +0200 MIPS: mm: Fix the cache error vector jump for XKPHYS kernels [ Upstream commit 30b76362f80d39d80f1197c88b284d9fa7952356 ] except_vec2_generic jumps to cache_parity_error with a j, which cannot leave the vector's 256MB region. An XKPHYS kernel such as IP30's, linked at 512MB, is outside it, so the j targets an unbacked address and its speculative fetch raises bus errors on unrelated fetches. Jump to the handler's uncached XKPHYS address instead. Fixes: 7505576d1c1a ("MIPS: add support for SGI Octane (IP30)") Cc: stable@vger.kernel.org Signed-off-by: Imre Kaloz Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin commit 9ecd3d7ed7d7a57ee6af27dc22be0b3fdc9526f7 Author: Matthias Goergens Date: Fri Oct 30 22:05:37 2026 +0800 udf: don't use eloc after the end of the unallocated space table [ Upstream commit 94401199df90e1c2a50c6e4b73618ac5a4ba83ba ] When udf_next_aext() returns 0, its eloc, elen and etype outputs hold no defined value. Two walks of the unallocated space table still use eloc after the walk has reached the end of the table. udf_table_prealloc_blocks() looks for a free extent starting at first_block and decides whether it found one by comparing eloc with first_block after the walk. If the table's list ends in a continuation descriptor that leads to an empty allocation extent, eloc is then the block of that allocation extent, which is in use, and if that is first_block, the block is handed out as preallocation. Once udf_discard_prealloc() no longer frees the wrong block, this is what still makes fsx in generic/091 and generic/263 read back bad data on a table, in about one run in four. Only take the extent if the walk stopped at it. When udf_table_free_blocks() cannot merge the freed blocks into an existing extent, it appends a new one and sets only its block number, so the partition reference comes from whatever eloc held after the walk, and with long allocation descriptors it is written to disk. For a table without extents, eloc was never set. Take the partition reference from the freed blocks instead. Short allocation descriptors do not store the partition reference, which is why this half remains a latent long-descriptor fix rather than a reproduced failure. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Matthias Goergens Link: https://patch.msgid.link/fd9ca4c4ba98c00c012ec861f6c0bc08a3b1d07b.1793349907.git.matthias.goergens@gmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin commit 0efa27a0d8b8f4b75eed80728d2c331c6104c308 Author: Matthias Goergens Date: Fri Oct 30 22:05:36 2026 +0800 udf: fix preallocation discarding before an empty allocation extent [ Upstream commit 0c52750caaaccee8b0e929450fe6538ec4985722 ] udf_discard_prealloc() finds the last extent of a file by peeking at the next one with udf_next_aext() and stopping when that returns 0. The peek reads into eloc and elen, and the code then uses them as the last extent. But when udf_next_aext() returns 0 they hold no defined value: if the extent list ends in a continuation descriptor that leads to an empty allocation extent, they describe that continuation, i.e. the block of the empty allocation extent, one block long. The kernel creates such lists itself: when udf_delete_aext() removes the only descriptor of the last allocation extent in a list, it leaves that allocation extent empty and the continuation to it in place. If the last extent is a preallocation, udf_discard_prealloc() deletes it with udf_delete_aext(), which finds the following allocation extent empty, so it also removes the continuation and frees that allocation extent's block. udf_discard_prealloc() then frees eloc and elen: that block a second time, instead of the preallocated blocks. On a space bitmap the preallocated blocks leak and the free block count drifts. On an unallocated space table the second free adds a second free extent for the same block, which is later handed out twice: fsx as run by generic/091 and generic/263 ends up with two parts of its test file in one block and reads back bad data. Peek into separate variables, so that eloc and elen keep the last extent that udf_next_aext() returned with 1. Fixes: cfe4c1b25dd6 ("udf: Fix preallocation discarding at indirect extent boundary") Cc: stable@vger.kernel.org Suggested-by: Jan Kara Signed-off-by: Matthias Goergens Link: https://patch.msgid.link/480eccd1264a4cea5226fc36ed108931b2c403fb.1793349907.git.matthias.goergens@gmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin commit 302eb1fa5be5e476a633d8ed0fd56ea5efa57374 Author: Matthias Goergens Date: Fri Oct 30 22:05:35 2026 +0800 udf: check the unallocated space table when it is loaded [ Upstream commit e614c3e35a6699ed691b4d17e1ec4230e34aa3eb ] udf_table_new_block() hands out the first block of the extent closest to its goal and trusts that the extent covers at least one whole block inside the partition. Nothing checks that. A zero-length extent makes it return the block the extent points at, which need not be free, and the subtraction of one block then underflows the length into the type bits, turning the entry into a bogus continuation. An extent running past the end of the partition makes it return blocks behind the partition. Such tables are not only found on crafted images: until the previous commit, udf_table_new_block() itself left zero-length extents behind in tables written by mkudffs, and then converted them into extents running past the partition. Check every extent once when the table is loaded, and refuse read-write access if one is empty, is not a whole number of blocks, or does not lie inside the partition, in the same way as for other allocation information the kernel cannot use. Check first that the table is an Unallocated Space Entry at all: the walk starts at the offset of the allocation descriptors in one, and for a file entry that offset lies before the inode's in-memory copy of the descriptors. Treat a chain of allocation extent descriptors that leads back to itself the same way: the walk would otherwise return the same extents forever, and the mount would never finish. Let a fatal signal interrupt the walk and fail the mount. Refusing read-write access to an empty extent is deliberate. It shows that an old kernel took the last block but left the entry behind. If consumed again, the entry returns an in-use block and turns into a huge bogus extent. Refusing the table before that happens avoids this second allocation; the filesystem can still be mounted read-only. The check cannot detect every overlap that may already exist in a damaged table. This patch should be backported together with the previous one: that patch stops creating new empty extents, and this one rejects existing ones before they are consumed again. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Matthias Goergens Link: https://patch.msgid.link/81233decd91f4a48bf4d74e3d15b547c7711e39f.1793349907.git.matthias.goergens@gmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin commit c4f8f503f2038269ffe9bca218bea65bbece9998 Author: Matthias Goergens Date: Fri Oct 30 22:05:34 2026 +0800 udf: don't let the extent type hide an exhausted free-space table extent [ Upstream commit da582d84fcf5f2f0c1d7760e1a899ca7cedb80fc ] udf_table_new_block() takes the first block of the free-space table extent closest to the goal. It keeps that extent's type and length together in goal_elen, subtracts one block, and deletes the extent only if goal_elen then reaches zero. UDF 2.60 section 2.3.7.1 requires the free-space extents of an Unallocated Space Entry to be of type 1 (allocated but not recorded), and mkudffs writes them that way. For such an extent the type bits keep goal_elen non-zero, so taking its last block leaves a type-1 extent of length zero behind, starting at the block after the extent, which is in use. The next allocation that picks this empty extent returns that in-use block. Subtracting a block from 0x40000000 then borrows from the type bits, and the extent becomes type 0 with a length of 2^30 - blocksize: about a gigabyte of "free" space overlapping live metadata, the other table extents and whatever lies behind the partition. From then on blocks are handed out twice, or past the end of the partition. Extents that udf_table_free_blocks() adds are type 0, where the check works, so only tables written by mkudffs or by another implementation are affected. Nothing more than filling such a filesystem is needed: on a fresh 1 MiB "mkudffs --space=unalloctable" image, creating empty files until the partition is full writes file entries over the reserve volume descriptor sequence and the backup anchor, and df then reports a negative amount of used space. On syzbot's images the same double allocation is what the two reports below trip over. In the first, ftruncate() extends a new file with enough hole extents to need a chain of allocation extent descriptors; one AED is placed on another inode's file entry, and a later one is placed on the block of the AED currently being filled, which udf_setup_indirect_aext() zeroes, so __udf_add_aext() finds lengthAllocDescs out of step with its cursor. In the second, an AED is placed past the end of the device, sb_getblk() fails, and the error path of udf_do_extend_file() calls udf_truncate_extents() on an extent list that no longer covers i_size. Keep the type separately from the length, as udf_table_prealloc_blocks() already does. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reported-by: syzbot+799a0e744ac47f928024@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=799a0e744ac47f928024 Reported-by: syzbot+43fc5ba6dcb33e3261ca@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=43fc5ba6dcb33e3261ca Signed-off-by: Matthias Goergens Link: https://patch.msgid.link/6b51c38d2d069544053c542470950e2a448b0b8d.1793349907.git.matthias.goergens@gmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin commit 78856ded7ec7995e8a05cdc9d08df4c5a62479aa Author: Kyle Zeng Date: Thu Oct 29 21:22:55 2026 -0700 mptcp: pm: kernel: use RCU to free endpoint listeners [ Upstream commit 49b09ae0bf57b4230187d4cdd0a370558e44a6e8 ] mptcp_pm_nl_create_listen_socket() starts the TCP listener directly instead of going through mptcp_listen(). It consequently misses setting SOCK_RCU_FREE on the parent MPTCP socket. tcp_child_process() can invoke the listener's subflow_data_ready() callback without holding the MPTCP parent lock or a reference to the parent. An authenticated MP_JOIN racing with endpoint teardown can therefore access the parent after its last reference has been dropped. The ADD_ADDR error path can also close an already published listener. Set SOCK_RCU_FREE before __inet_listen_sk() publishes the TCP listener, matching mptcp_listen(). This protects the parent on every subsequent close path, including a failed endpoint addition. Fixes: 1729cf186d8a ("mptcp: create the listening socket for new port") Cc: stable@vger.kernel.org Signed-off-by: Kyle Zeng Reviewed-by: Matthieu Baerts (NGI0) Link: https://patch.msgid.link/20261030042255.74216-1-kylebot@openai.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 8029abb1b67b7c1056e4404541e1f1ae568ad888 Author: Tvrtko Ursulin Date: Wed Oct 21 10:42:27 2026 +0100 drm/sched: Adjust run-queue when changing priority at runtime [ Upstream commit 75709a35da45bc67f94c9ceb91bf8871fdfe4d9e ] Another consequence of the recent revert of commit 77a6809f1dc3 ("drm/sched: Remove FIFO and RR and simplify to a single run queue") is that after the revert we need to adjust entity->rq_priority when runtime priority changes are requested. Only amdgpu does that so the impact is minimal. Also considering dynamic priority changes are largely broken there, due currently broken entity scheduler list handling where the special case of a single scheduler can never change it's run-queue. And coupled with the fact for the rest a two- tier approach of drm_sched_entity_set_priority() and drm_sched_entity_modify_sched() is used, where later directly maps to different hardware queue priority by replacing the set of schedulers completely. Hence the regression is limited to rings which have multiple instances other than compute and graphics, which would be SDMA only, for which I am not sure any userspace actually does dynamic priority changes in the first place. Signed-off-by: Tvrtko Ursulin Fixes: 2fa4d8e2c109 ("drm/sched: Add fair scheduling policy") Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner Cc: stable@vger.kernel.org # v7.2+ [phasta: fix checkpatch error] Signed-off-by: Philipp Stanner Link: https://patch.msgid.link/20261021094227.48034-3-tvrtko.ursulin@igalia.com Signed-off-by: Sasha Levin commit 51dd2e3c8a706e0bd53068e5257d9b4166e4a0e8 Author: Tvrtko Ursulin Date: Wed Oct 21 10:42:26 2026 +0100 drm/sched: Fix out of bounds entity priority check [ Upstream commit cda6f72545f2372234c72f93fd1be61841295e19 ] When the out of range priority at entity init time is clamped to the number of run queues in the supplied scheduler the internal run-queue priority needs to be adjusted as well. There is no impact since none of the drivers hit the clamping path, but we still need to address it by moving the entity->rq_priority assignment to after the clamping is done. Note that a lot of this will hopefully get removed once again when the single run-queue simplification lands. Signed-off-by: Tvrtko Ursulin Fixes: 2fa4d8e2c109 ("drm/sched: Add fair scheduling policy") Cc: Christian König Cc: Danilo Krummrich Cc: Matthew Brost Cc: Philipp Stanner Cc: stable@vger.kernel.org # v7.2+ Signed-off-by: Philipp Stanner Link: https://patch.msgid.link/20261021094227.48034-2-tvrtko.ursulin@igalia.com Signed-off-by: Sasha Levin commit e75d39dc2a4dbfa6064bd7e59e0cf5d3d1b89b6d Author: Christian Gmeiner Date: Mon Nov 2 11:18:53 2026 +0100 drm/etnaviv: Flush the tile status cache through both the PE and BLT [ Upstream commit c1a757f8df1363032623fa9b1baaba0dcf34de6d ] Since commit f232d9ec029c ("drm/etnaviv: fix TS cache flushing on GPUs with BLT engine"), jobs on GPUs with a BLT engine use a BLT command to flush the tile status cache instead of TS_FLUSH_CACHE, which is broken on most of these GPUs. GC7000 r6008/r6009 and GC8200 r6401 are the other way around: TS_FLUSH_CACHE works, but the BLT command does not flush the cache. The vendor driver handles these GPUs using TS_FLUSH_CACHE, but the etnaviv kernel driver has no way to identify them. As a result, dirty tile status cache lines survive the end of a job. They are written back by the next cache flush, using the page table of the job issuing it. If that job belongs to another process, the write goes to the wrong address space. On GC7000 r6009 this causes MMU faults and GPU recoveries blamed on an innocent process. I see around 1100 per run of a multisample depth/stencil test running alongside two other GPU clients. Emit both flushes at the end of every job on GPUs with a BLT engine. Whichever does not work on a given GPU is a no-op. Since dirty lines are only written back once, this costs one additional state load per job. Fixes: f232d9ec029c ("drm/etnaviv: fix TS cache flushing on GPUs with BLT engine") Cc: stable@vger.kernel.org Reviewed-by: Lucas Stach Link: https://patch.msgid.link/20261102-etna-pe-ts-flush-v1-1-e4454ed86f85@igalia.com Signed-off-by: Christian Gmeiner Signed-off-by: Sasha Levin commit 1fc4d88bb5398d9687993220effd7d79364e7a13 Author: Christian Gmeiner Date: Mon Nov 2 11:38:17 2026 +0100 drm/etnaviv: Fix NULL dereference on unbind without PPU flop reset [ Upstream commit a0560a12d8c1a03e925c5d9be8479da75663a40f ] flop_reset_data_ppu is only allocated on GPUs that need the PPU flop reset. However, etnaviv_unbind(..) frees it unconditionally, and etnaviv_cmdbuf_free(..) dereferences cmdbuf->suballoc before checking whether cmdbuf is NULL. As a result, unloading the driver on GPUs that do not need the PPU flop reset causes a NULL pointer dereference at address 0. Fixes: 85ba57ad88cf ("drm/etnaviv: Add PPU flop reset") Cc: stable@vger.kernel.org Reviewed-by: Lucas Stach Link: https://patch.msgid.link/20261102-etnaviv-unbind-flop-fix-v1-1-588fd16f6768@igalia.com Signed-off-by: Christian Gmeiner Signed-off-by: Sasha Levin commit 26b9d1b5ca10ce19fde6d6465336d257c542955c Author: James Clark Date: Mon Nov 2 20:51:17 2026 +0700 net: ethernet: ti: am65-cpsw-nuss: Enable timestamping of unicast PTP packets [ Upstream commit 6887a8f98244ba4c0fbe2d2461b9b8f8a300e326 ] On a BeagleY-AI (J722S), ptp4l as a unicast master (unicast_listen) logs "received DELAY_REQ without timestamp" for each unicast Delay_Req, and its port goes to FAULTY after "timed out while polling for tx timestamp" for the first unicast Sync. am65_cpsw_nuss_hwtstamp_set() does not set the TS_UNI_EN bit (bit 24) of the port's TS_CTL_LTYPE2 register. According to the TRM (J722S TRM SPRUJB3D, 12.2.1.4.7.13.5.1 Ethernet Port Receive Event and 12.2.1.4.7.13.5.2 Ethernet Port Transmit Event), this bit must be set for the port to timestamp PTP event messages over UDP sent to a unicast address; without it, only messages sent to the PTP multicast addresses selected by the TS_107 and TS_129 to TS_132 bits are timestamped. TI's netcp_ethss driver for the Keystone 2 Ethernet switch, which has the same timestamping registers, always sets TS_UNI_EN. Set TS_UNI_EN along with the other bits. With this change, ptp4l in the same setup gets timestamps for the unicast Delay_Req and Sync messages. Fixes: b1f66a5bee07 ("net: ethernet: ti: am65-cpsw-nuss: enable packet timestamping support") Cc: stable@vger.kernel.org Signed-off-by: James Clark Reviewed-by: Sebastian Andrzej Siewior Link: https://patch.msgid.link/20261102135117.419539-1-jjc@jclark.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 55e4044c1bc87e69b127790d4e73d34dddb9afdf Author: Ray Zhang Date: Sun Nov 1 00:51:45 2026 -0700 net: count last skb of each sk_backlog pass in __release_sock() [ Upstream commit c4e4056b21355356f6a95bcdf03a850edd9f49e7 ] Running 500 concurrent TCPv6 streams (neper "tcp_stream -6 -T 1 -F 500") on a 2-core Cortex-A53 (CONFIG_PREEMPT_NONE=y, HZ=1000, LATENCY_WARN) triggers resched_latency_warn() in __release_sock(): [ 3655.311821] sched: CPU 0 need_resched set for > 100006892 ns (100 ticks) without schedule [ 3655.311889] Call trace: ... [ 3655.311944] resched_latency_warn+0x7c/0x88 [ 3655.311958] sched_tick+0x1c0/0x418 ... [ 3655.312578] net_rx_action+0x238/0x438 ... [ 3655.312641] do_softirq+0x4c/0x90 [ 3655.312651] __local_bh_enable_ip+0x84/0x90 [ 3655.312663] local_bh_enable+0x1c/0x28 [ 3655.312674] __dev_queue_xmit+0x4a8/0xb00 ... [ 3655.312782] tcp_v6_do_rcv+0x240/0x5f8 [ 3655.312793] __release_sock+0x9c/0x188 [ 3655.312806] release_sock+0x150/0x168 [ 3655.312817] tcp_sendmsg+0x4c/0x70 __release_sock() can loop past 100 ms without calling cond_resched(): - Each outer-loop pass drains sk_backlog, but "if (!skb) break;" runs before "++nb", so a pass of B skbs only adds B - 1 to nb (0 for 1 skb). - With 500 TCPv6 streams and NAPI sharing two Cortex-A53 cores, runnable tasks keep TIF_NEED_RESCHED set on CPU 0. - During spin_unlock_bh() and TX softirqs (__dev_queue_xmit() -> local_bh_enable()), tcp_add_backlog() coalesces arriving pure ACKs into a single tail skb. - Repeated 1-skb passes never advance nb or call cond_resched(), triggering resched_latency_warn() after 100 ticks. Restore the do-while loop and drop "if (!skb) break;" so every skb increments nb across passes and calls cond_resched() every 16 skbs. Reproduced the issue and verified the fix on two 2-core Cortex-A53 hosts (CONFIG_PREEMPT_NONE=y, HZ=1000, LATENCY_WARN, latency_warn_once=0) with a userspace reproducer over /dev/net/tun: - CPU 0 runs a TCPv6 sender and a second runnable task while CPU 1 writes pure ACKs to /dev/net/tun (~30k TCPBacklogCoalesce/run), sustaining 1-skb sk_backlog refills in __release_sock() for ~400 ms (ftrace). - Before: CPU 0 stayed unscheduled in __release_sock(), hitting resched_latency_warn() 293 and 275 times on the two hosts (> 100.9 ms). - After: cond_resched() yielded CPU 0 inside __release_sock(), with 0 resched_latency_warn() hits on both hosts. - Also observed no regression with the workload from commit 16c610162d1f ("net: call cond_resched() less often in __release_sock()"), "super_netperf 4 -H srv -T,10 -l 3000 &". Fixes: 16c610162d1f ("net: call cond_resched() less often in __release_sock()") Cc: stable@vger.kernel.org Signed-off-by: Ray Zhang Reviewed-by: Kuniyuki Iwashima Reviewed-by: Eric Dumazet Link: https://patch.msgid.link/20261101075145.698399-1-sgzhang@google.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 883b66d11ee3ed89cc22599280d3c319cf38903f Author: Bryam Vargas Date: Thu Oct 29 03:03:33 2026 -0500 net/smc: don't spin in smc_rx_recvmsg() while a pipe holds spliced data [ Upstream commit 8288ba942cfd20621c05e16978b7c3da91513ae1 ] While bytes spliced off the RMB are still in a pipe, recvmsg() waits for the pipe to release them before it copies the data behind them. The path to that wait skips the timeout and signal checks, and smc_rx_wait() returns at once on RCV_SHUTDOWN. With a signal pending, after SHUT_RD, or once the peer closes or shuts down writing, recvmsg() spins on a CPU until the pipe is drained, and SIGKILL cannot stop it. MSG_DONTWAIT and an expired SO_RCVTIMEO wait there too instead of returning -EAGAIN. Check the timeout and signals before that wait, and end it when the pipe releases the data or the connection is killed, not on RCV_SHUTDOWN. A zero-length read returns 0 without waiting for the pipe; a non-blocking one returns -EAGAIN while poll() still reports the socket readable (splice() can still take those bytes). The wait sets SOCKWQ_ASYNC_WAITDATA like smc_rx_wait(), so a byte arriving behind the pipe raises no SIGIO on a reader already asleep for it, and a full barrier orders its wait queue entry before its read of splice_pending, so no wake is lost. Fixes: 9014db202cb7 ("smc: add support for splice()") Cc: stable@vger.kernel.org Signed-off-by: Bryam Vargas Reviewed-by: Dust Li Link: https://patch.msgid.link/20261029-b4-disp-da7f8e6a-v2-1-9052904adf72@proton.me Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 2e114662c376f5a5342f2f997c459971dbdf836b Author: Hungyu Lin Date: Thu Oct 29 01:36:16 2026 +0000 ext2: preserve IOMAP_F_DIRTY for extending direct writes [ Upstream commit 4f91b042af212ca0b610e43f9a975ddc7f0d0923 ] ext2_iomap_begin() sets IOMAP_F_DIRTY for writes that may extend i_size, but clears the flag after ext2_get_blocks(). When the write uses an existing mapped block, iomap can then use FUA and skip generic_write_sync(), even though ext2_dio_write_end_io() updates the inode size. An O_DSYNC write can therefore return without persisting the new size. For example, on a FUA-capable device, a 512-byte O_DIRECT|O_DSYNC write at offset 512 into a fsynced one-byte file returns successfully and extends the in-memory size to 1024, while an immediate read of the on-disk inode still shows size 1. An explicit fsync persists the new size. Move setting of IOMAP_F_DIRTY after the initialization. Fixes: fb5de4358e1a ("ext2: Move direct-io to use iomap") Cc: stable@vger.kernel.org Signed-off-by: Hungyu Lin Link: https://patch.msgid.link/20261029013616.97194-1-dennylin0707@gmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin commit deeccc01999ed8982507945e5ca750e75f0437dc Author: Sinan Turunc Date: Wed Nov 4 12:22:03 2026 +0000 ALSA: usx2y: Guard the playback copy [ Upstream commit e2c6de52ffacb2c0f4076884ee3fdb744735a4cb ] usx2y_urb_play_prepare() sums the packet lengths of a whole URB, copies that many frames with a single wrap, and sizes each playback packet from the capture packet's actual_length. Three things are unchecked: that the URB fits in the ring buffer, that a packet fits in the playback endpoint's maxpacksize, from which tmpbuf is allocated, and that actual_length is a whole number of frames. The ISO descriptors take the raw actual_length while transfer_buffer_length and the copies take count * stride, so a packet that is not a multiple of the stride makes the descriptors add up to more than the buffer, by up to stride - 1 bytes per packet. Return -EPIPE, as the existing packet-size check does, when the URB is larger than the buffer or a packet is larger than maxpacksize, and size each descriptor from whole frames, so the descriptors add up to transfer_buffer_length and each stays within maxpacksize. The buffer case is prevented by the previous patch and this is the guard for it; the other two depend only on the device. The first case is reachable on the unpatched driver with ordinary packets: on 7.3-rc7, a USB/IP device presenting the US-122 interface layout and sending 48-frame packets, with a 100-frame playback buffer (two 50-frame periods, inside the stock constraints), KASAN reports: BUG: KASAN: out-of-bounds in i_usx2y_urb_complete+0x79b/0x1ac0 Read of size 18446744073709551280 at addr ffff88800e6b02e0 by task vhci_rx/80 With both patches, the same device and a 200-frame playback buffer is refused at hw_params with EINVAL, and a 400-frame buffer plays for 30 s with the position advancing inside the buffer, no KASAN report and neither guard message. The maxpacksize check is not exercised: the emulated device reports the same wMaxPacketSize on both endpoints. The descriptor case is visible with capture packets of 195 bytes at stride 4 (48 frames and 3 bytes): without this change the four descriptors add up to 780 bytes for 768 bytes of data, and USB/IP's completion check refuses the URB ("total length of iso packets 780 not equal to actual length of buffer 768", -EPROTO), after which the driver stops the streams. With this patch every descriptor is 192 bytes, the descriptors add up to the data in every URB for 30 s, the position advances inside the buffer and KASAN reports nothing. The 48-frame playback run above is unchanged. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Sinan Turunc Link: https://patch.msgid.link/20261104122136.1518-3-enscrpt@pm.me Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 824fdf771cb7cbe9ae50eaec588eaf1acee6da94 Author: Sinan Turunc Date: Wed Nov 4 12:21:57 2026 +0000 ALSA: usx2y: Require a buffer of two URBs [ Upstream commit 4cbb826b3b36df6c275454287ba1df4564a5370b ] usx2y_urb_capt_retire() wraps the ring buffer once per packet and usx2y_urb_play_prepare() once per URB of nr_of_packs() packets of up to 50 frames. Both assume that the data fits in the buffer, and the hw constraints only require about two 1 ms periods, so a packet larger than the buffer on capture, or a URB larger than the buffer on playback, violates that assumption. Constrain SNDRV_PCM_HW_PARAM_BUFFER_SIZE in snd_usx2y_pcm_open() to at least two URBs, 2 * nr_of_packs() * 50 frames, for both directions. The bound is in frames and derived from the driver's own packet limit, so it does not read the endpoint, whose altsetting is only selected in prepare. Two URBs rather than one, because the position advances by a URB on playback and only moves when a URB is less than the whole buffer. Keep a guard in usx2y_urb_capt_retire() that drops a packet larger than the buffer, for the case the constraint makes unreachable. With nrpacks above about 163 (S16_LE) or 109 (S24_3LE) the bound exceeds the 64 KiB buffer the substream preallocates (twice that with the preallocation raised to its 128 KiB maximum), so hw_params fails for those module settings. That is intended: the driver cannot be safe with a URB larger than half the largest buffer. Reproduced on 7.3-rc7 with a USB/IP device presenting the US-122 interface layout and 1024-byte packets into a 512-byte capture buffer: BUG: KASAN: out-of-bounds in i_usx2y_urb_complete+0x1285/0x1ac0 Read of size 18446744073709551104 at addr ffff88800e448800 by task vhci_rx/83 Tested on 7.3-rc7 with the same device, S16_LE at 44100 Hz, nrpacks 4, so the bound is 400 frames. A 128-frame capture buffer and a 200-frame playback buffer are refused at hw_params with EINVAL. A 400-frame buffer streams for 30 s in each direction with the position advancing inside the buffer and no KASAN report; the capture guard did not fire. The same 400-frame capture buffer with S24_3LE, which selects altsetting 2 in prepare, streams for 30 s with the same result. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Sinan Turunc Link: https://patch.msgid.link/20261104122136.1518-2-enscrpt@pm.me Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 5c1bbdfe5331b287c179fe118cb7e6db04c4032b Author: Wentao Liang Date: Wed Nov 4 02:53:41 2026 +0000 ALSA: caiaq: free the EP4 URB when input setup fails [ Upstream commit d21746bafdb8e1a5fc9bdcb86f603d827a500a62 ] The three controllers that use the EP4 input URB allocate it before checking the endpoint type and before registering the input device. On failure they jump to exit_free_idev, which clears cdev->input_dev but leaves cdev->ep4_in_urb set. The card teardown then calls snd_usb_caiaq_input_free(), which returns early because input_dev is NULL, so the URB is never freed. Release the URB before dropping the input device on the error path. Fixes: 6da7a2aa899f ("ALSA: usb/caiaq: Add support for Traktor Kontrol X1") Cc: stable@vger.kernel.org Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex Signed-off-by: Wentao Liang Link: https://patch.msgid.link/20261104025341.1527407-1-vulab@iscas.ac.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 9885eaa2091335ed181c93f2b406604ee2bf2312 Author: Sinan Turunc Date: Tue Nov 3 13:22:44 2026 +0000 ALSA: line6: Reject capture buffers smaller than two packets [ Upstream commit db51425c9eb038a8e40e09b837afde015ae9e3ec ] line6_capture_copy() splits the copy into the ALSA ring buffer once at the buffer end and wraps pos_done once, which is only correct when one packet holds at most buffer_size frames. The packet size comes from the device's endpoint, and the per-device hw structs allow 64-byte periods with periods_min 1, so a packet can be larger than the whole buffer. audio_in_callback() logs an oversized packet and then copies it anyway. The packet size is known at probe time, so constrain SNDRV_PCM_HW_PARAM_BUFFER_BYTES in snd_line6_capture_open() to at least twice the larger of the two endpoints' packet sizes. Two rather than one, because pos_done advances by the packet and wraps once, so a buffer of exactly one packet leaves the position unchanged after every packet. hw_params then rejects a buffer that cannot hold two packets, and the single wrap is valid for every configuration that gets through. Keep a guard in line6_capture_copy() that drops an oversized packet with a ratelimited error, for the case that should no longer be reachable. Reproduced on 7.3-rc7 with a USB/IP device presenting the GuitarPort interface layout and 1024-byte packets into a 128-byte buffer: ALSA logged "invalid position: pos = 224, buffer size = 32" and the driver logged "driver bug: len" on every following packet. With this patch a 1024-byte buffer is refused at hw_params, and a 2048-byte buffer streams for 30 s with no report and with the position moving inside the buffer. Fixes: 705ececd1c60 ("Staging: add line6 usb driver") Cc: stable@vger.kernel.org Signed-off-by: Sinan Turunc Link: https://patch.msgid.link/20261103132227.696-1-enscrpt@pm.me Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 27ab1608f730961d21988e0f3bf03791982dfb9d Author: Mohamed Yassine Jebabli Date: Tue Nov 3 10:27:12 2026 +0100 ALSA: hda/tas2781: Only accept CRC-less V1 data if all entries are valid [ Upstream commit 8dbab764f1e0a92c3fac0ce070ce30c0c33c2692 ] Commit 408249089c48 ("ALSA: hda/tas2781: Accept V1 calibration data without CRC") only checked the first device entry. On machines where the BIOS populates fewer entries than p->ndev, the remaining all-zero entries are applied and tas2781_cali_preproc() divides by zero on playback open. Accept CRC-less V1 data only if every expected entry is non-zero and self-consistent (R0 * 1/R0 close to 1.0), otherwise reject it as before. Fixes: 408249089c48 ("ALSA: hda/tas2781: Accept V1 calibration data without CRC") Reported-by: Cristian Castellano Closes: https://lore.kernel.org/all/4e500063-d985-46b6-a0a1-3feaa77c4b2f@leemhuis.info/ Cc: stable@vger.kernel.org Signed-off-by: Mohamed Yassine Jebabli Link: https://patch.msgid.link/20261103-tas2781-v1-nocrc-fix-v1-1-a769c27f21ce@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit e2a462dcad8ea2231972b71822fbf14897528660 Author: Alexandr Date: Tue Nov 3 21:21:21 2026 +0700 ALSA: hda/realtek: Enable mute and mic-mute LEDs on HP ENVY 17-cr0xxx [ Upstream commit cf79cc4996bf936fe159af2a600519b3ebd4ccb7 ] The HP ENVY Laptop 17-cr0xxx (subsystem ID 103c:8a2e) has mute and mic-mute LEDs on the F8 and F5 keys that never light up on Linux: the existing quirk entry only sets up the CS35L41 amplifiers. The board uses the same LED wiring as the HP ENVY x360 15-ey0xxx (103c:8a31): the mute LED is driven by COEF 0x0b bits 3:2 and the mic-mute LED by GPIO2 with inverted polarity. Both were verified with hda-verb on the actual hardware. Switch the entry to ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS, which chains the amplifier setup with ALC245_FIXUP_HP_X360_MUTE_LEDS, and use the DMI product name of the board. Fixes: aa8e3ef4fe53 ("ALSA: hda/realtek: Add quirks for various HP ENVY models") Cc: Signed-off-by: Alexandr Link: https://patch.msgid.link/20261103142121.74032-1-youdoit@mail.ru Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit bcb37b8abc6d4a1e2a6e7983d86a24e25f7ab53a Author: Yuqiang Sun Date: Mon Nov 2 11:52:37 2026 +0800 ALSA: usb-audio: qcom: Check the return value of qmi_handle_init() [ Upstream commit a3cf5ebab5f1db9e6f751e2a08df05a84f37ea57 ] qc_usb_audio_probe() overwrites the return value of qmi_handle_init() with that of qmi_add_server() without checking it. When qmi_handle_init() fails, it has already freed the receive buffer and destroyed the workqueue, and qmi->sock may hold an error pointer. If QRTR is not available, qmi_handle_init() returns -EPROBE_DEFER and qmi->sock is ERR_PTR(-EAFNOSUPPORT), so qmi_add_server() passes it to kernel_sendmsg(): BUG: unable to handle page fault for address: ffffffffffffffb7 RIP: 0010:selinux_socket_sendmsg+0xa0/0x590 Call Trace: security_socket_sendmsg+0x29/0x50 __sock_sendmsg+0x43/0x150 kernel_sendmsg+0xd6/0x180 qmi_send_new_server+0x1b8/0x2b0 qmi_add_server+0x165/0x200 qc_usb_audio_probe+0xf4/0x2e0 really_probe+0x2b4/0x850 Had the probe gone on, the error and remove paths would call qmi_handle_release() on the half-initialized handle, which destroys the workqueue and frees the receive buffer a second time. Return the error from qmi_handle_init(), so that -EPROBE_DEFER defers the probe, and check qmi_add_server() as well. The bug was found with kbound, a static analysis prototype for ownership mismatches at kernel interfaces, on v7.2.12; it is present in mainline. Build-tested with x86_64 and arm64 allmodconfig (W=1, sparse): no new warnings. Run-tested on QEMU (x86_64, KVM) with KASAN and kmemleak, with the driver built in and a test module that registers the q6usb.qc-usb-audio-offload auxiliary device. Without QRTR, the probe crashes as above without this patch; with it the device is deferred and removing it again reports nothing. With QRTR the probe succeeds, and removal reports nothing either. Fixes: 326bbc348298 ("ALSA: usb-audio: qcom: Introduce QC USB SND offloading support") Cc: stable@vger.kernel.org Signed-off-by: Yuqiang Sun Link: https://patch.msgid.link/20261102035237.56253-1-izaiahsun@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 8b21cc8bd182b49415faa24ea9f26b51eea96efb Author: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Date: Sun Nov 1 03:15:57 2026 +0800 ALSA: usx2y: Refuse a retried DSP load after a failure [ Upstream commit 1f8101b6adc87a3ddbd51fcb6609251591758026 ] snd_usx2y_hwdep_dsp_load() sets up the asynchronous sequence URBs and the interrupt URB when the FPGA firmware image with index 1 is loaded, and then creates the ALSA devices. If usx2y_in04_init() or usx2y_create_alsa_devices() fails, the URBs that were already set up are left in place. The core keeps the index unloaded when the callback fails, so user space may issue the same request again. The second attempt then enters usx2y_async_seq04_init() or usx2y_in04_init() with the URBs still allocated and trips WARN_ON(usx2y->as04.buffer) or WARN_ON(usx2y->in04_urb). The URBs cannot be released at this point: the card may already have registered PCM devices that user space can still open, and the disconnect handler accesses the URBs without holding the DSP lock. Mark the chip as hung instead, so that a retried request is refused with -ENODEV and the assertions keep their meaning. The URBs are released by snd_usx2y_card_private_free() when the card is freed. A failing usx2y_async_seq04_init() still releases its own URBs, so that path remains retryable. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Co-developed-by: Bin Yu Signed-off-by: Bin Yu Co-developed-by: Cheng Wen Signed-off-by: Cheng Wen Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Link: https://patch.msgid.link/20261031191557.8460-1-25031212351@stu.xidian.edu.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit a4c306eb3ba35a1e7201e25aef7e0537da609e72 Author: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Date: Sun Nov 1 03:09:36 2026 +0800 ALSA: bcd2000: Fix use-after-free of MIDI URBs on file close [ Upstream commit f6c7bb1f0799591a62be75b9bcf84245b4f208b7 ] bcd2000_disconnect() calls snd_card_disconnect(), which only prevents new opens, and then frees the MIDI URBs. A rawmidi file that was already open can still be closed afterwards, and its close callback, bcd2000_midi_output_close(), calls usb_kill_urb() on midi_out_urb. The URB pointers are cleared on disconnect and their accesses are serialized with midi_lock, but bcd2000_midi_output_close() reads midi_out_urb without that lock. The check can therefore pass just before the pointer is cleared, and usb_kill_urb() then runs on the URB that has already been freed: BUG: KASAN: slab-use-after-free in usb_kill_urb+0x74/0x80 Read of size 8 at addr ffff8880078e7d40 usb_kill_urb bcd2000_midi_output_close close_substream rawmidi_release_priv snd_rawmidi_release Allocated by: usb_alloc_urb <- bcd2000_init_midi <- bcd2000_probe Freed by: usb_free_urb <- bcd2000_midi_free <- bcd2000_disconnect Take the lock in bcd2000_midi_output_close() and reference the URB with usb_get_urb() before releasing it. The URB then stays valid until usb_put_urb() after usb_kill_urb() has returned, even if a disconnect frees it in the meantime. usb_kill_urb() itself cannot run under midi_lock, as the completion handler takes the same lock. Fixes: b47a22290d58 ("ALSA: MIDI driver for Behringer BCD2000 USB device") Cc: stable@vger.kernel.org Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Link: https://patch.msgid.link/20261031190936.5696-1-25031212351@stu.xidian.edu.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 18b7342e7f67022b5c7b51d126550cc74add3e88 Author: Alex Kazinsky Date: Fri Oct 30 18:25:27 2026 +0400 ALSA: cs46xx: Handle SCB creation failures before dereferencing [ Upstream commit 023d3e1176202339cd94a3d732e3aec74e36ba22 ] With CONFIG_PM_SLEEP enabled, cs46xx_dsp_create_scb() can return NULL if kmemdup() fails to allocate the SCB data saved for resume. cs46xx_dsp_scb_and_task_init() and _dsp_create_generic_scb() dereference the returned pointer without checking it, causing a NULL pointer dereference on allocation failure. Check both return values before accessing the SCB descriptors. Return -ENOMEM when creating the null SCB fails and propagate NULL from _dsp_create_generic_scb(). Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool. Fixes: 41116e926cb9 ("ALSA: cs46xx - Fix suspend/resume with new DSP") Cc: stable@vger.kernel.org Signed-off-by: Alex Kazinsky Link: https://patch.msgid.link/20261030142529.415697-1-a.kazinsky@ideco.ru Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 33aae36d6e6f606edafd779e3530bbc793574e3f Author: Chris Simpson Date: Thu Oct 29 16:49:10 2026 -0600 ALSA: hda/realtek: Enable bass speakers on Alienware m17 R3 [ Upstream commit eb296114d5ba4d335a640dbbbbc9618fded0ffe7 ] The Alienware m17 R3 (ALC289, PCI SSID 1028:09d1) has a second speaker pair, the bass speakers, on pin 0x17, which the BIOS leaves unconnected (0x411111f0). No PCI SSID quirk matches the machine, so it gets ALC269_FIXUP_DELL4_MIC_NO_PRESENCE from the fallback pin quirk table, and only the speakers on pin 0x14 play. Use ALC289_FIXUP_DUAL_SPK, as on the Alienware x16 R2 and Dell XPS 15 9510/9520: it sets pin 0x17 up as a speaker on DAC 0x02, so one volume control covers both pairs, and chains to ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, so the headset mic setup is unchanged. Tested on an Alienware m17 R3 (BIOS 1.38.0), Linux 7.3 with this change applied: the bass speakers play, and volume and mute cover both pairs, also after suspend and resume. Headphones and a headset mic were not tested. I used Claude Code (Claude Opus 5.5) to find the unused pin, pick the existing fixup and write this patch and changelog; I did the listening tests myself. Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Chris Simpson Link: https://patch.msgid.link/20261029-alc289-m17r3-v1-1-5d3eac605e7a@nilk.net Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 0b56905c8d97c8516730f59bbebfe3627940b63e Author: HyeongJun An Date: Thu Oct 29 22:05:37 2026 +0900 ALSA: ump: Fix dropped data bytes at UMP System message conversion [ Upstream commit ac1cac4c1f1b143650f7261ae78f64a3e22fa4d6 ] The cvt_ump_system_to_legacy() function switches on ump_message_status_code(), which returns only the upper 4 bits of the status. The case labels are the full 0xf1, 0xf2 and 0xf3 values, so they never match. MIDI Time Code, Song Position and Song Select are converted to the status byte alone, and their data bytes are lost. Switch on the full status byte in buf[0] instead. Both callers of snd_ump_convert_from_ump() pass the result on as is: the legacy rawmidi input of a UMP endpoint, and the MIDI 1.0 path of the f_midi2 USB gadget. Fixes: 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support") Cc: stable@vger.kernel.org Signed-off-by: HyeongJun An Link: https://patch.msgid.link/20261029130538.1985867-1-sammiee5311@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 992f7f5f34f803144c9cac31d49ff853d8e861a9 Author: Ilia Mirkin Date: Sat Jan 28 15:53:47 2017 -0500 drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts [ Upstream commit 2139cb633d48ebbbaec88d2e5a8ebe8e774df4fb ] Turns out some VBIOSes don't actually set the bit in question in 2240c. Use the nv50-style detection to try avoiding running the vbios twice. Fixes: a6a0f67ca7aa ("drm/nouveau/devinit/gf100-: detect if BIOS invoked devinit") Link: https://bugs.freedesktop.org/show_bug.cgi?id=97620 Cc: # v4.6+ Signed-off-by: Ilia Mirkin Reviewed-by: Dave Airlie Signed-off-by: Dave Airlie Link: https://patch.msgid.link/20170128205347.17453-1-imirkin@alum.mit.edu Signed-off-by: Sasha Levin commit caac5e214c2b8434f3765f47d6b6e87ecc73f9b9 Author: Finn Zeruhn Date: Fri Oct 2 17:28:33 2026 -0400 drm/dp: keep MOT set between messages when no_zero_sized is set [ Upstream commit 06bb2e5c71e9983519929a8482bea89da6d80ad8 ] When aux->no_zero_sized is set, drm_dp_i2c_xfer() cannot use a bare address packet to close the transaction, so it clears MOT on the last data packet instead. The check only looks at the position within the current i2c_msg, so MOT is cleared at the end of every message and each one is terminated by an I2C stop. This breaks E-DDC reads of EDID blocks 2 and up. Those are read as three messages: a write of the segment pointer to 0x30, a write of the offset to 0x50, and the read. The stop after the first message resets the segment pointer, so the read returns segment 0 again. On a Pimax Dream Air (three EDID blocks, native timings in a DisplayID extension in block 2) connected to an RTX 5070 Ti with nouveau, block 2 reads back as a copy of block 0. The checksum is valid, so nothing is reported, and the connector only offers fallback modes. Clear MOT only on the last packet of the last message, as the commit that added the option describes. With this, block 2 reads correctly and the native 7104x3840 modes are listed for the Dream Air. The same problem was pointed out by the Sashiko review of the patch that sets no_zero_sized for all DisplayPort connectors in nouveau. Fixes: f0ddbb1eed18 ("drm/dp: add option to disable zero sized address only transactions.") Link: https://lore.kernel.org/all/20260827015758.0B4FB1F000E9@smtp.kernel.org/ Cc: stable@vger.kernel.org Signed-off-by: Finn Zeruhn Reviewed-by: Dave Airlie Signed-off-by: Dave Airlie Link: https://patch.msgid.link/20261002212833.9674-1-fzeruhn@icloud.com Signed-off-by: Sasha Levin commit 765b4f3fe5003b91d8ad8a47a4d3f62dba5d9e3d Author: Rosen Penev Date: Sun Nov 1 12:04:28 2026 -0800 drm/nouveau/nvkm: clear use.enabled when subdev init fails [ Upstream commit a1f7f37417bacf2eaf80a8ce6b598b1fa56f8906 ] On Kepler boards without the video decode falcon firmware installed (msvld/mspdec/msppp), every other VA-API decode attempt binds to an engine with no ucode loaded. The submitted work never completes, which leads to a context switch timeout, a channel recovery that cannot reset the engine, and eviction waits on fences that never signal. The process ends up stuck in D state, or killed by SIGBUS when it touches a buffer evicted after the wait times out: msvld: unable to load firmware data msvld: init failed, -19 fifo: SCHED_ERROR 0a [CTXSW_TIMEOUT] vo[5444]: channel 14 killed! WARNING: drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c:117 at nvkm_runl_rc+0x2a4/0x3b0 [nouveau] [TTM] Buffer eviction failed WARNING: drivers/gpu/drm/nouveau/nouveau_bo.c:1092 at nouveau_bo_move_ntfy.part.0+0x9b/0x100 [nouveau] Tracing nvkm_subdev_ref() and nvkm_subdev_init_() shows the pattern: a reference taken with enabled=0 runs nvkm_falcon_init(), which returns -ENODEV; the next reference sees enabled=1 and succeeds without running it. Clear use.enabled when init() fails, so that every later reference retries init and fails cleanly. The other readers of use.enabled are fini() handlers that use it to skip teardown, which they now also do after a failed init(). On a GK107 (Quadro K1100M) without video firmware, playing H.264 with mpv --hwdec=auto: without this patch the GPU channel is killed within a minute and mpv hangs; with it, VA-API decoder creation fails, mpv falls back to software decoding, and no faults are logged. Fixes: 8478cd5a740a ("drm/nouveau/nvkm: add locking to subdev/engine init paths") Cc: stable@vger.kernel.org Signed-off-by: Rosen Penev Signed-off-by: Dave Airlie Link: https://patch.msgid.link/20261101200428.16959-1-rosenp@gmail.com Signed-off-by: Sasha Levin commit 2dec8c5a6928f27a40e8880df2af3289693abbcd Author: Hengyu Liang Date: Thu Oct 29 23:26:17 2026 -0400 l2tp: only return sessions of the given tunnel in l2tp_session_get() [ Upstream commit a75facf4bb3e866103ddca4f47a6f3ca4b090d8b ] Commit 5f77c18ea556 ("l2tp: use IDR for all session lookups") made pppol2tp_connect() and the netlink session commands find sessions with l2tp_session_get(), passing the socket of the tunnel they name. L2TPv3 session IDs are unique per network namespace, except that sessions carried over UDP are only unique per UDP socket, the socket of their tunnel. However, l2tp_v3_session_get() only checks the socket when another session has the same session ID. Otherwise it returns the session, whichever tunnel it belongs to. As of now, a session command that names the wrong tunnel acts on a session of another tunnel, and a PPPoL2TP socket for a second L2TPv3 tunnel fails with EEXIST, because it finds session 0 of the first tunnel. The issue can be reproduced with: ip l2tp add tunnel tunnel_id 3 peer_tunnel_id 3 encap udp \ local 127.0.0.1 remote 127.0.0.1 udp_sport 5003 udp_dport 6003 ip l2tp add tunnel tunnel_id 4 peer_tunnel_id 4 encap udp \ local 127.0.0.1 remote 127.0.0.1 udp_sport 5004 udp_dport 6004 ip l2tp add session tunnel_id 3 session_id 7 peer_session_id 7 ip l2tp del session tunnel_id 4 session_id 7 ip l2tp show session Before that commit, the delete fails with "No such device", and session 7 of tunnel 3 is still listed. After that commit, the delete succeeds, and session 7 of tunnel 3 is gone. This patch will make l2tp_session_get() return NULL when the L2TPv3 session it finds does not belong to the given socket. The receive path calls l2tp_v3_session_get() directly and is not changed. Fixes: 5f77c18ea556 ("l2tp: use IDR for all session lookups") Cc: stable@vger.kernel.org Signed-off-by: Hengyu Liang Acked-by: Guillaume Nault Link: https://patch.msgid.link/20261030032617.4065353-1-hengyul@cs.unc.edu Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 253ae48e22c2160627ad03e644a6fb1abcc52772 Author: Amir Goldstein Date: Mon Nov 2 14:21:40 2026 +0100 selftests/fscontext_ns: expect EINVAL for overlay descendant userns create [ Upstream commit db1c5da238dc80a61ab429a7b71b0e2835766c45 ] Commit a518e63c3775 ("ovl: return EINVAL instead of EIO in case of mismatched user_ns") changed the errno for completing an overlay fscontext from another user namespace. Update the overlay test variant to match binfmt_misc. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202611020115.2281e158-lkp@intel.com Fixes: a518e63c3775 ("ovl: return EINVAL instead of EIO in case of mismatched user_ns") Cc: stable@vger.kernel.org Signed-off-by: Amir Goldstein Signed-off-by: Sasha Levin commit 7cd237effa89a6bb59da3bc9f98c9823cf1429ba Author: Chris Mason Date: Fri Oct 16 21:17:22 2026 +0000 ovl: look up the index by the decoded origin [ Upstream commit 520ef67f47f69255695859b0008281a384d0bc20 ] A file opened by file handle on an overlay with nfs_export=on can show the stale lower data of a file that was copied up to the upper layer. While the file opened this way stays in the inode cache, a lookup of the copied up file by path fails with ESTALE for all users. The open can also succeed for a file that was removed, where it has to fail with ESTALE. This happens with a handle that has one byte changed. The handle comes from an NFS client, or from a process that calls open_by_handle_at() with CAP_DAC_READ_SEARCH in the initial user namespace. When a file in a lower layer is about to be modified, overlayfs first copies it to the upper layer (copy up). With nfs_export=on, each copy up also creates an entry in the index directory, a directory that overlayfs keeps for itself on the upper filesystem. The handle of an overlay file that comes from a lower layer wraps the handle of its lower inode. Overlayfs calls this lower inode the origin. The overlay handle stays valid after a copy up. To decode such a handle, ovl_lower_fh_to_d() first decodes the wrapped handle to the origin. If no overlay inode is cached for the origin, it looks in the index directory: - An index entry there leads to the upper file. - A whiteout, the marker that overlayfs uses for a removed file, means that the overlay file was removed. The name of an index entry is the handle that copy up encoded for the origin, as a hex string. ovl_lower_fh_to_d() builds the name for this lookup from the bytes that the caller passed in. But handles with different bytes can decode to the same inode: - Overlayfs ignores some flag bits of the handle. - A lower filesystem can accept a different fid type, extra bytes, or generation 0 for any generation. Such a handle decodes to the origin but misses the index entry or the whiteout. So the decode returns an overlay inode that has only the lower file. While that inode is cached, a path lookup of a copied up file fails with ESTALE, since the upper file that the lookup finds does not match the cached inode, which has none. Reproduced on tmpfs and on ext4 with open_by_handle_at(), after a copy up and a mount cycle. A handle in which one flag bit, the fid type, the length or the generation was changed read the old lower data, and path lookups returned ESTALE. Fix this by re-encoding the decoded origin and building the index name from that handle. Fixes: f71bd9cfb692 ("ovl: decode indexed non-dir file handles") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Signed-off-by: Amir Goldstein Signed-off-by: Sasha Levin commit f333182e8881030764fe57a6bd91d5aa70cd209c Author: Sasha Levin Date: Wed Nov 4 07:18:16 2026 -0500 nvme-pci: add NVME_QUIRK_DMAPOOL_ALIGN_512 for KIOXIA XG10d [ Upstream commit c64d9b2c1f4fd1d8fa52dab37b48428a99c4d58d ] The KIOXIA XG10d reads past the end of a PRP list that completely fills a 256 byte small pool block. When that block is the last one in its dmapool page, the read lands on the next page, which usually isn't mapped. The IOMMU faults it and the controller craps itself: arm-smmu-v3 arm-smmu-v3.0.auto: event: F_TRANSLATION client: 0001:09:00.0 sid: 0x20900 ssid: 0x0 iova: 0xff7fe000 ipa: 0x0 nvme nvme0: controller is down; will reset: CSTS=0xffffffff, PCI_STATUS=0xffff Filling the block requires a slightly larger write, and those became common with commit 2e8e30b3cf9f ("Revert "nvme-pci: clamp max_hw_sectors based on DMA optimized limitation""). Do what we do for other disks and use 512 byte aligned small pool blocks for this controller. Cc: stable@vger.kernel.org # 6.4.x Signed-off-by: Sasha Levin Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit c9a54fc8147f45020badd9001d4ed234c74b9526 Author: Zhao Gongyi Date: Mon Nov 2 01:10:30 2026 +0800 arm64: mm: validate /dev/mem mmap ranges without overflow [ Upstream commit b0958b1397fb5ffdb995c0ccc74349841929c08d ] An arm64 syzkaller reproducer creates a FUSE character device with major:minor 1:1, so opening it uses the /dev/mem file operations. It maps one page from offset 0xfffffffffffff000 at user address zero. The next openat() with a NULL pathname triggers a synchronous external abort (SEA, ESR 0x96000010) in strncpy_from_user() via do_getname(), panicking the kernel. valid_mmap_phys_addr_range() checks the exclusive end by adding the mapping size to the starting address. For this offset, the sum wraps to zero and passes the PHYS_MASK test, allowing an out-of-range PFN to reach remap_pfn_range(). The inclusive-end overflow check in mmap_mem_prepare() does not catch it because the end is ULONG_MAX. Reject starting PFNs outside PHYS_MASK and compare the inclusive length against the remaining physical range without overflowing. This also allows mappings that end exactly at PHYS_MASK, which the old check incorrectly rejects. Fixes: 1d18c47c735e ("arm64: MMU fault handling and page table management") Cc: stable@vger.kernel.org Signed-off-by: Zhao Gongyi [catalin.marinas@arm.com: changed the check to look more like __access_ok()] Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin commit c23125523817ae4304702de6ae2970a85a7dc6f8 Author: Wei Wang Date: Tue Nov 3 17:59:41 2026 +0000 arm64: suspend: Save and restore TPIDR2_EL0 across CPU suspend [ Upstream commit beeec04046227eba42b7cc5ab32498aa43da9632 ] TPIDR2_EL0 is a live EL0 register on systems with SME, but cpu_do_suspend()/cpu_do_resume() don't preserve it. Its value is UNKNOWN after a warm reset, so the task that initiates suspend can return to userspace with a corrupted TPIDR2_EL0. Save and restore it alongside TPIDR_EL0 and TPIDRRO_EL0. The new slot fits in existing padding, so sizeof(struct cpu_suspend_ctx) is unchanged. Fixes: a9d691585950 ("arm64/sme: Implement support for TPIDR2") Cc: stable@vger.kernel.org Acked-by: Will Deacon Reviewed-by: Mark Brown Signed-off-by: Wei Wang Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin commit 73bbd572a0a8c05f38eb9f0d046c583ba7f62f15 Author: Ewan D. Milne Date: Wed Nov 4 12:28:33 2026 -0500 nvmet: don't return memory contents beyond valid data when reading ANA log page [ Upstream commit 29b8758b4700357909f06705a0c48c7a60c556d5 ] The host side does not know how much valid data will be returned by the target so it will typically provide a buffer larger than the amount of valid data in the ANA log page. The memory allocation used by the target does not guarantee that prior kernel memory contents will not be returned past the end of the valid page data. Fix this to ensure that the SGL is zeroed before copying the data. Fixes: 72efd25dcf4f ("nvmet: add minimal ANA support") Cc: stable@vger.kernel.org Signed-off-by: Ewan D. Milne Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit 9135c7b4666a8b49d1ef3d6a214a46e69eea2f2d Author: Jesse Zhang Date: Tue Nov 3 15:05:12 2026 +0800 drm/amdgpu: don't drop the gang dependency fence twice [ Upstream commit 6d1f901a83603a7d314e4a756b416b11d8dc7e35 ] drm_sched_job_add_dependency() drops the fence reference when it fails, but amdgpu_cs_submit() drops it again, so the scheduled fence of a gang member loses a reference it still needs. A GFX+COMPUTE gang waiting for another context, with the xarray node allocation for the leader's dependency failed through failslab: WARNING: drivers/dma-buf/dma-fence.c:589 at dma_fence_release+0x34d/0x730, CPU#1: amd_uapi_regres/2993 drm_sched_job_cleanup+0x2c2/0x340 [gpu_sched] amdgpu_job_free+0xcb/0x3e0 [amdgpu] amdgpu_cs_parser_fini+0x435/0x710 [amdgpu] amdgpu_cs_ioctl+0xcd2/0x7a60 [amdgpu] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] RIP: 0010:dma_fence_signal_timestamp_locked+0x1b8/0x610 Fixes: ed21f6c3fe42 ("drm/amdgpu: fix another missing fence reference in the CS code") Reviewed-by: Christian König Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit 5aa070a83c8378810b906cc8bfc650ce69822a7c) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit b879edc85e0e4130f6b9b3ae3744c9d2f976c0af Author: renpanpan Date: Mon Nov 2 17:49:29 2026 +0800 drm/amdgpu: Only enable HDMI audio if display supports it [ Upstream commit 0de95c96655c8a12df62e47871016f49e5cd8618 ] The amdgpu legacy DCE audio path (dce_v6/v8/v10) unconditionally calls audio_enable(pin, true) at the end of afmt_setmode(), regardless of whether the connected display advertises audio support in its EDID. This causes a phantom HDMI audio output to appear for displays that have no audio capability (no basic audio bit, no Audio Data Block in EDID), because the GPU sets the AUDIO_ENABLED register bit, which drives the HDA codec's ELDV pin sense, making the codec report the jack as audio-available. The radeon, nouveau, and dw-hdmi drivers all gate audio enablement on display_info.has_audio. Apply the same check to amdgpu's DCE afmt_setmode functions. Reviewed-by: Alex Deucher Signed-off-by: renpanpan Signed-off-by: Alex Deucher (cherry picked from commit 842a45c68e0355eea47796551c8761c0c77e8ce0) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit be90166ed3be02c13253f54ed2a8fe98a66cea30 Author: Jesse Zhang Date: Tue Nov 3 15:05:12 2026 +0800 drm/amdgpu: don't walk the CS chunks when allocating them failed [ Upstream commit ade92d50aad6799a5a9d7e73cd1604fd0576e656 ] amdgpu_cs_pass1() sets p->nchunks before allocating p->chunks, and the allocation failure path skips resetting it. amdgpu_cs_parser_fini() then frees the kdata of nchunks chunks from a NULL array. On navi48 with the chunk array allocation failed through failslab: Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] RIP: 0010:amdgpu_cs_parser_fini+0x35d/0x710 [amdgpu] amdgpu_cs_ioctl+0xcae/0x7a20 [amdgpu] drm_ioctl_kernel+0x180/0x320 [drm] Set nchunks once the array exists. Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)") Signed-off-by: Jesse Zhang Reviewed-by: Christian König Signed-off-by: Alex Deucher (cherry picked from commit 0c828445757b86aaa3ed2638832d76f450022bdf) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit c1e3cf3304c9356c03a10280d57502017a0bacd6 Author: Jesse Zhang Date: Sat Oct 31 23:31:43 2026 +0800 drm/amdgpu: rewrite all PTEs of the BOs after a VM reset [ Upstream commit 71388e1ed836d7645b4807cead35edf24da00bcd ] amdgpu_vm_bo_reset_state_machine() moves all idle vm_bos to needs_update so that their mappings are written again, e.g. after a GPU reset lost VRAM. Since commit 5be7f6720a0f ("drm/amdgpu: Only set bo->moved when the BO was actually moved") amdgpu_vm_bo_needs_update() no longer sets the moved flag, so amdgpu_vm_bo_update() writes nothing for the kernel and always valid BOs. The same applies to vm_bos already on a needs_update list, e.g. after an AMDGPU_VM_DELAY_UPDATE mapping, where only the new mapping gets written. An SDMA write to an always valid BO after a VRAM-losing reset faults: amdgpu 0000:03:00.0: VRAM is lost due to GPU reset! amdgpu 0000:03:00.0: [gfxhub] page fault (src_id:0 ring:40 vmid:7 pasid:9) amdgpu 0000:03:00.0: in page starting at address 0x0000000100000000 from client 10 Set the moved flag for all vm_bos on the needs_update lists after moving the idle ones there; the root PD still goes back to idle. Fixes: 5be7f6720a0f ("drm/amdgpu: Only set bo->moved when the BO was actually moved") Reviewed-by: Christian König Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit d397f95f63cc0f711c3e8f2043edc59b575345ab) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 1ae594845217ce740b27ec5a202e9e8cb144e0aa Author: Jesse Zhang Date: Sun Nov 1 01:41:40 2026 +0800 drm/amdgpu: unlock the VM and BO when attaching a KFD BO fails [ Upstream commit e0a1404b34e0002f03f7979cdb791a9b5c3963f5 ] kfd_mem_attach() locks the page directory and the BO with a drm_exec transaction on its stack, but leaves through the unwind label without drm_exec_fini() when locking fails, e.g. when MAP_MEMORY_TO_GPU gets a signal while the page directory or the BO is busy. Reservations already acquired then remain locked with their ww_acquire_ctx pointing into the expired stack frame. With one thread doing GEM_VA map/unmap on the KFD VM and another one mapping KFD BOs while getting SIGUSR1 every 20 us: BUG: KASAN: stack-out-of-bounds in __ww_mutex_lock.constprop.0+0x34f5/0x3da0 ww_mutex_lock_interruptible+0x2f/0x150 drm_exec_lock_obj+0x107/0x2d0 [drm_exec] kfd_mem_attach+0x4dd/0x1b60 [amdgpu] and the process ends up in D state. Finish the transaction before unwinding. Fixes: fd1fa48b935f ("drm/amdgpu: lock both VM and BO in amdgpu_gem_object_open") Reviewed-by: Felix Kuehling Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit 7b885fa27e4b9fa5cbdc64e66fc35872aee296f5) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 1e65f78269a95052c2de91b4a14ee83f3e780828 Author: Jesse Zhang Date: Sun Nov 1 02:05:22 2026 +0800 drm/amdgpu: drop the dma-buf reference when a KFD import fails [ Upstream commit fb900f8bfd8a16126affd186d21001e4c6533324 ] import_obj_create() takes a reference on the dma-buf for the new kgd_mem, but the error path after validating the BO doesn't drop it. Since the validation reserves the BO interruptibly, an import failing with -ERESTARTSYS leaks the exported BO with its memory, and keeps the module in use. Importing a 64 MiB VRAM BO in a loop while getting SIGUSR1 every 20 us and another thread changes the BO's mappings: INFO: 171821 imports, VRAM used before 65 MiB, after 129 MiB modprobe: FATAL: Module amdgpu is in use. Drop the reference, and free the sync object and the mutex of the kgd_mem as well. With that VRAM usage returns to 65 MiB after the same test. Fixes: 0e2e7c5b3d71 ("drm/amdgpu: Attach eviction fence on alloc") Reviewed-by: Felix Kuehling Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit b4d1eca2729840148ff2ea957724ce764ca5a94e) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit e36430fda69a3b6087bf57ab52f549deca531f3a Author: Hugo Sales Date: Sat Oct 31 15:39:48 2026 +0000 drm/amdgpu: Clamp the ATIF backlight curve to its 99 points [ Upstream commit 7ba7655701c5cad5bfa043d464d1e24873e24aab ] amdgpu_atif_query_backlight_caps() stores the firmware's number_of_points as data_points but copies only the 99 points that luminance_data[] holds. number_of_points is a u8, so a firmware table that claims more makes the custom curve code in amdgpu_dm index past the array, and dm_query_extended_brightness_caps() copy past the end of the data_points[] buffer it fills Clamp the count to ATIF_QBTC_MAX_DATA_POINTS and warn, since a table that claims more is a firmware bug Fixes: f729e63743f0 ("drm/amd: Pass luminance data to amdgpu_dm_backlight_caps") Signed-off-by: Hugo Sales Link: https://patch.msgid.link/20261031153948.127016-1-hugo@hsal.es Reviewed-by: Mario Limonciello Signed-off-by: Mario Limonciello Signed-off-by: Alex Deucher (cherry picked from commit af8a1c2b7d3de4960e10f94e8ba2fc0ccd168072) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit ee488777bde7f0e5b8e4f7fbc2dfe5db0c15aaaa Author: Erhan Bilgili Date: Mon Oct 26 20:50:13 2026 +0100 drm/amdgpu: Report MES ring wait timeouts. [ Upstream commit 122e864861144150e905012b5fb52e63ad5de68d ] Return -ETIMEDOUT when the fence wait before submission expires instead of reporting success without submitting the packet. Fixes: 34e087e8920e ("drm/amdgpu/mes: fix mes ring buffer overflow") Reviewed-by: Alex Deucher Signed-off-by: Erhan Bilgili Signed-off-by: Alex Deucher (cherry picked from commit 34341594a87b4a3f28be41e3e70a4787f02b3d9e) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 4cb2aeb7f23d25b8349ee87048415818b94320ad Author: Erhan Bilgili Date: Sun Oct 25 11:03:32 2026 +0100 drm/amdgpu: Fix duplicate dependency fence releases [ Upstream commit ea47f84199241dd083d40a241beea665415d4f6c ] drm_sched_job_add_dependency() consumes its fence reference on success and failure. Do not release the fence again if drm_sched_job_add_dependency() fails. Fixes: 41cc108b2451 ("drm/amdgpu: fix missing dma_fence_put in error path") Fixes: c1c4a8b21721 ("drm/amdgpu: grab extra fence reference for drm_sched_job_add_dependency") Reviewed-by: Alex Deucher Signed-off-by: Erhan Bilgili Signed-off-by: Alex Deucher (cherry picked from commit e04f3dfb2071451633e6440a3911a9bb65df9144) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit cd54dead0431c2741223f8df7d6c3baa1d19f08d Author: Kevin Wang Date: Thu Oct 29 11:50:31 2026 +0800 drm/amd/pm: populate unique ID for smu 13.0.7 [ Upstream commit 079f9103d9cde68fb2ccc414e94520f43ee102de ] The smu 13.0.7 backend does not register get_unique_id, leaving adev->unique_id at zero and KFD topology without the stable GPU identifier consumed by HIP. The failure is observed at: auto ierr = hipDeviceGetUuid(&uuid, 0); Fixes: 113cc31dde66 ("drm/amd/pm: add SMU_13_0_7 ppt_funcs for SMU_13_0_7") Signed-off-by: Kevin Wang Reviewed-by: Kenneth Feng Signed-off-by: Alex Deucher (cherry picked from commit 5e2585daaf8336d9ce1bf52e55a9b7a8cdbf625b) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 9b4315d340d3126814816998a99ee5faa8e3eb31 Author: Melissa Wen Date: Wed Oct 21 14:29:25 2026 +0200 drm/amd/display: Signal PQ EOTF in FreeSync infopacket for DP HDR [ Upstream commit 81f923b065801c7d30042bcda31ccb9449b4f58b ] Commit c2791297013e ("drm/amd/display: Add color bit info to freesync infoframe") created the app_tf interface for FreeSync HDR and commit c21a764a98cb ("drm/amd/display: Send PQ bit in AMD VSIF") used it to set PB9 bit 5 (PQ EOTF) in v2/v3 AMD Freesync infopacket. However, Linux never made use of this interface: DM ignores what userspace sets regarding HDR and always passes TRANSFER_FUNC_UNKNOWN as app_tf, so the PQ bit is never set in the infopacket received by the eDP panel. Check the EOTF in the HDR static metadata and set the PQ bit in Freesync infopacket for DP accordingly. This fixes gray-washed HDR on KDE/GNOME on Framework 13 Pro AI 9 HX 370 (DCN 3.5) and may fix similar issues on other VRR-capable panels that advertise Replay in its AMD VSDB. It doesn't affect color/EOTF bits on infopackets for SDR and native HDMI. Reported-by: Pierre-Loup A. Griffais Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/3200 Signed-off-by: Melissa Wen Reviewed-by: Alex Hung Signed-off-by: Alex Deucher (cherry picked from commit b318f3e13dd73781404670d3b3c6cf2177e0119c) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 0cbd54ec3e0d529244b491a98804d3433e7a18b4 Author: Mikhail Gavrilov Date: Mon Oct 26 12:33:45 2026 +0500 drm/amd/display: set allow_freesync before validating a new stream [ Upstream commit ab18dd3061eb2d92e60c8bbf9a435c25962e449f ] After resume from S3, DC enables SubVP on a single FreeSync display at a high refresh rate, although dcn32_allow_subvp_high_refresh_rate() is meant to keep SubVP off that configuration ("For single display cases, freesync must be disabled"). On an RX 7900 XTX driving a FreeSync TV at 3840x2160@120, amdgpu_dm_capabilities reports sub-viewport disabled after boot and enabled after "rtcwake -m mem", and the memory clock starts switching. It stays that way until a later commit re-validates the state; a CRTC gamma change (toggling Night Light) turns SubVP off again. The policy reads dc_stream_state::allow_freesync while the new state is validated, but amdgpu_dm sets that field only in amdgpu_dm_update_freesync_state_on_stream(), on the first flip after the commit. A stream created by a modeset is therefore validated as if FreeSync were off. On resume, dm_destroy_cached_state() drops the streams and forces a modeset, so the resumed state is validated without FreeSync. Set allow_freesync in amdgpu_dm_get_freesync_config_for_crtc(), which atomic check calls for every active CRTC and which already writes ignore_msa_timing_param to the stream. It uses vrr_supported, the condition the flip-time value is derived from. With this change the same TV keeps SubVP disabled across "rtcwake -m mem". On this machine SubVP is also what exposes the single-frame scanout corruption reported in the thread linked below, so the FreeSync setting stopped working as a workaround after every suspend. Fixes: 87f0c16e0eeb ("drm/amd/display: Enable SubVP for high refresh rate displays") Link: https://lore.kernel.org/all/20260829010525.29935-1-mikhail.v.gavrilov@gmail.com/ Link: https://gitlab.freedesktop.org/drm/amd/-/work_items/5714#note_3736349 Tested-by: Josh Kasten Signed-off-by: Mikhail Gavrilov Reviewed-by: Alex Hung Signed-off-by: Alex Deucher (cherry picked from commit 29793918b0eb63b6810b248a906f87dd79b70be5) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 648b33a7211f1e918f2e1b798b2b387b64b0e1f1 Author: Kylie C Date: Thu Oct 22 09:30:38 2026 -0400 drm/amd/display: Don't select zero V_TOTAL_MIN/MAX on seamless boot [ Upstream commit d13f36e4e055cce03761de590bc8dc6346b1d5c8 ] Initialize V_TOTAL_MIN/MAX to V_TOTAL before enabling the selectors if they are still 0, as optc1_program_timing() does without seamless boot. Tested on Renoir (DCN 2.1) eDP with amdgpu.seamless=1. This removes the flash between the bios logo & plymouth on my laptop. Signed-off-by: Kylie C Reviewed-by: Alex Hung Signed-off-by: Alex Deucher (cherry picked from commit 1ad7473e82b9242c4ee7eea82ab16d3f82f01651) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit d7287504a35f020a1d16c9565dafa8f18c389043 Author: Matthew Schwartz Date: Mon Oct 19 19:51:57 2026 -0700 drm/amd/display: Keep the nominal vtotal while VRR is inactive [ Upstream commit f2853a06e4b923c77a8cba69d76d2222b198256b ] Commit 33c995709121 ("drm/amd/display: Allow VRR params change if unsynced with the stream") derives the inactive vtotal from max_refresh_in_uhz and rounds it up. The round trip through integer rates can add a line even with VRR off. The ASUS ROG Xbox Ally X20's 120.0004 Hz mode exceeds its 120 Hz EDID maximum, so 1152 lines become 1153 and the CRTC vblank counter measures 119.89 Hz. Take both limits from stream->timing.v_total, as mod_freesync_build_vrr_params() does, which keeps the resync to the stream's timing. Active VRR keeps the helper's rounding. Fixes: 33c995709121 ("drm/amd/display: Allow VRR params change if unsynced with the stream") Signed-off-by: Matthew Schwartz Reviewed-by: Ivan Lipski Signed-off-by: Alex Deucher (cherry picked from commit 428c95d380f07694cbbd9ebe3450214404f57b5a) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 1fb376fd517bac598fb5aeb7beb8c10f5c0c5961 Author: Misha Nasledov Date: Mon Oct 19 16:42:32 2026 -0700 drm/amd/display: Drop clock requirements on DCN32 when no displays are active [ Upstream commit bba4dc3306483335ddbe065c05b2d8359ec387a4 ] amdgpu_dm builds the new dc_state as a copy of the old one. When the last stream is removed, dml1_validate() returns early on pipe_cnt == 0 and never reaches dcn32_calculate_dlg_params(), so bw.dcn.clk keeps the dramclk/dcfclk/fclk requirements of the display that was just turned off. dcn32_update_clocks() then keeps those hard minimums applied. On an RX 7900 XTX this leaves UCLK at 456 MHz and DCFCLK at 637 MHz with the monitor off, and the board idles at 28.4 W. With this change they drop to 96 MHz and 145 MHz and board power falls to 15.3 W. Reset the clock requirements in that case, as calculate_dlg_params() already does when no HUBP is active and as the DML2 path does for stream_count == 0. Signed-off-by: Misha Nasledov Reviewed-by: Alex Hung Signed-off-by: Alex Deucher (cherry picked from commit 0261a0ef89f37ef962fbc9dbc724ebf65fe681cf) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 7473715dcf76196d2242c1b19756a95c98ea21ba Author: Roman Demidov Date: Mon Oct 19 10:29:37 2026 +0300 drm/amd/display: Fix NULL deref in dcn401_update_clocks_update_dtb_dto [ Upstream commit 7fac15d009cf236677a8cddf6bc0e8c85666ac3b ] [Why] resource_get_otg_master_for_stream() can return NULL if no OTG master pipe is found for a given stream. The current code dereferences this pointer without a NULL check. This may lead to a possible NULL pointer dereference. [How] Add an explicit NULL check and skip the stream if the OTG master is not found. This is similar to dcn60_update_clocks_update_dtb_dto(). Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: b6d508533fa1 ("drm/amd/display: fix a crash when clock source is reference for non otg master pipe") Signed-off-by: Roman Demidov Reviewed-by: Alex Hung Signed-off-by: Alex Deucher (cherry picked from commit ffde3d74c1faeeb645b66d02d02fdae3e073941b) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 374aba4bef461462a9640f8355ebff5d5021c459 Author: Jesse Zhang Date: Mon Oct 26 21:24:35 2026 +0800 drm/amdgpu/gfx12: disallow GFXOFF while updating the SPM VMID [ Upstream commit d1551515a3258b43cba60bd7f45bbdd1f4e9e60a ] gfx_v12_0_update_spm_vmid() does a read-modify-write of RLC_SPM_MC_CNTL over MMIO without keeping GFX powered, unlike gfx11. When GFX is in GFXOFF at that point the update doesn't stick, and with the SPM VMID programmed on submission again, the job of a process with a reserved VMID can still run with the SPM writing through VMID 0. On navi48, after a few other submissions and a VM fault on the same VM, a COPY_DATA of RLC_SPM_MC_CNTL from such a job reads 0 although the update was called for it: $ amd_uapi_regression --run-subtest cs-secure-ib-compute,gem-mapping-info-high-va,gpuvm-fault-high-va,reserved-vmid-spm-vmid amdgpu 0000:03:00.0: [gfxhub] page fault (src_id:0 ring:40 vmid:7 pasid:185) amdgpu 0000:03:00.0: Faulty UTCL2 client ID: SDMA1 (0xe) RLC_SPM_MC_CNTL in the job: 0x00000000 With GFXOFF disallowed around the update it reads the reserved VMID 15. Fixes: 52cb80c12e8a ("drm/amdgpu: Add gfx v12_0 ip block support (v6)") Reviewed-by: Alex Deucher Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit 907aebc5578ae09fa5c0e2f0784201295837e60b) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 782b15f2d211ef36e6741a77a2f70ce6dccd9673 Author: Roman Li Date: Tue Oct 27 17:17:10 2026 -0600 drm/amd/display: Reset DET of HUBPs without a plane before outstanding updates [ Upstream commit f3afbf7d832ab138655afc96bd42226775d03ce7 ] [WHY] DC asserts with: WARNING: dc/hubbub/dcn401/dcn401_hubbub.c at dcn401_program_compbuf_segments Call Trace: dcn401_program_outstanding_updates+0x36/0x60 [amdgpu] hwss_process_outstanding_hw_updates+0x33/0x40 [amdgpu] commit_planes_for_stream+0x171f/0x1ff0 [amdgpu] dc_update_state_execute+0xaa/0x170 [amdgpu] dc_update_planes_and_stream+0x42/0x70 [amdgpu] amdgpu_dm_atomic_commit_tail+0x16a9/0x4020 [amdgpu] commit_tail+0xc3/0x1b0 [drm_kms_helper] The DET left by the VBIOS on a HUBP without a plane can be larger than the DET planned for the new state. The compbuf is sized for the planned DET, so DET + compbuf can exceed the CRB size. Programming the compbuf then triggers the ASSERT and sets CONFIG_ERROR in hardware. [HOW] Release the DET of HUBPs without a plane before the compbuf is programmed. Add hwss_reset_unused_det() and call it in the commit and flip paths, to cover both seamless and non-seamless boots. Fixes: 7a1eb6680939 ("drm/amd/display: Perform outstanding programming on full updates") Cc: Dillon Varone Cc: Mario Limonciello Cc: Alex Deucher Signed-off-by: Roman Li Signed-off-by: Alex Hung Tested-by: Dan Wheeler Reviewed-by: Leo Li Signed-off-by: Alex Deucher (cherry picked from commit c93f6fc7175b445ba3b7c85a1fc31e4e4951bbc9) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 41b495570564857a74626a527efef541e0af5fa1 Author: Alex Hung Date: Tue Oct 27 17:17:04 2026 -0600 drm/amd/display: Avoid closing unowned DDC pins [ Upstream commit e7ba638b8116cb5f1a5690f543052371215f1626 ] [WHY] dal_ddc_open() cleans up pins it acquires on later failures. If the data-pin open fails, this attempt acquired nothing. If opening the clock pin or configuring fails, dal_ddc_open() closes the pins it opened. An extra dal_ddc_close() is unnecessary and unsafe: GPIO_RESULT_ALREADY_OPENED can mean AUX owns the existing handles, and closing them here would disrupt AUX. [HOW] Remove the extra dal_ddc_close() from the failed-open path. Cc: Jerry Zuo Cc: Mario Limonciello Cc: Alex Deucher Signed-off-by: Alex Hung Tested-by: Dan Wheeler Reviewed-by: Leo Li Signed-off-by: Alex Deucher (cherry picked from commit 175ae7772b68757b4932f34ff862923cab7abe21) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 28009088c534031640f33bcc6dea8aa061dc37c5 Author: Milan Milicevic Date: Wed Oct 28 15:31:55 2026 +0100 drm/amdgpu: publish IH enabled before PSP programs IH_RB_CNTL [ Upstream commit 9d550dd1a3b4b96da49f3560a84b5c2413a88cd3 ] On SR-IOV, programming IH_RB_CNTL through PSP is slow enough for the first MSI to arrive before ih->enabled is set. amdgpu_ih_process() then drops the interrupt, rptr stays at 0, and RPTR_REARM never generates another edge, so every ring hits the fence fallback timer. Set ih->enabled before psp_reg_program() on the indirect IH path for Navi10 and IH v6.0, and clear it if programming fails. Signed-off-by: Danijel Slivka Signed-off-by: Milan Milicevic Acked-by: Alex Deucher Signed-off-by: Alex Deucher (cherry picked from commit b2f9434f9d17c94798e8d8957af3adc4a9949016) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 79c03c381ea0b4284a1b404931f7e3c0c1dc49b8 Author: Kent Russell Date: Thu Oct 22 16:13:23 2026 -0400 drm/amdgpu: Ensure that harvest information gets set [ Upstream commit 4c5ec969b9b011e824f1850d7ffe4fa5c41ba890 ] After the earlier patch exported IP discovery on probe failure, there was an unexpected consequence where harvest info was not populated. The early-exit in amdgpu_discovery_sysfs_init meant that we never called amdgpu_discovery_get_harvest_info, which is where we set the actual harvest value. The first time we call amdgpu_discovery_sysfs_recurse with NULL instead of adev, most values can get set. The 2nd time amdgpu_discovery_sysfs_recurse is called, we bail early. To keep the logic of the first patch intact, ensuring that older kernels can still discover the IP blocks, add a separate call in the early-exit section that sets the harvest information. This should be the only functionality that is missed in this flow, as the rest of the calls either work fine with adev=NULL, or use the discovery_bin directly. Fixes: 402e04f11ff7 ("drm/amdgpu: Export ip_discovery sysfs on probe failure") Assisted-by: LLM Claude Signed-off-by: Kent Russell Reviewed-by: Mario Limonciello Signed-off-by: Alex Deucher (cherry picked from commit ca0812a625d112df556e37550e6accceea33e485) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit eb0953398da65ca317e84a6a9607359f5699728e Author: Prike Liang Date: Fri Oct 16 09:35:55 2026 +0800 drm/amdgpu: stop the schedulers before preparing the GPU reset [ Upstream commit 5b40c07c7ae9f80ec5277bc44c63f354ff581077 ] amdgpu_device_halt_activities() only stops the ring schedulers after amdgpu_amdkfd_pre_reset() and amdgpu_userq_pre_reset(). With a hung MES every REMOVE_QUEUE in amdgpu_userq_pre_reset() waits for its timeout, so the schedulers keep pushing jobs to the hardware for seconds after the reset has started: GPU reset begin!. Source: 6 MES failed to respond to msg=REMOVE_QUEUE fence_wait_ret=528494 status=0x0 WARNING: amdgpu_device.c:928 at amdgpu_device_skip_hw_access+0x73/0x90 [amdgpu] Workqueue: sdma0 drm_sched_run_job_work [gpu_sched] Call Trace: amdgpu_mm_wdoorbell64+0x20/0x70 [amdgpu] sdma_v6_0_ring_set_wptr+0xa6/0x180 [amdgpu] amdgpu_ring_commit+0x5b/0xa0 [amdgpu] amdgpu_ib_schedule+0x64a/0x8f0 [amdgpu] amdgpu_job_run+0xa2/0x220 [amdgpu] drm_sched_run_job_work+0x10c/0x300 [gpu_sched] Stop the schedulers of all devices in the reset list first. None of the preparation steps needs them, and jobs submitted meanwhile simply wait until amdgpu_device_sched_resume(). Fixes: 290f46cf5726 ("drm/amdgpu: Implement user queue reset functionality") Signed-off-by: Prike Liang Acked-by: Lijo Lazar Signed-off-by: Alex Deucher (cherry picked from commit ea55250ab5594032541c455e1b84e8a7c15a2ba4) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit d7a7d21bebae5e2bf6f0b89d3dd6828de46c8614 Author: Milan Milicevic Date: Wed Oct 28 14:52:35 2026 +0100 drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts for navi10_ih [ Upstream commit 146b96974b33b8cca52755ffed3cd24a82836013 ] Port this change to navi10_ih.c: commit afbf7955ff01 ("drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts") Setting IH_RB_WPTR to 0 does not clear RB_OVERFLOW if RB_ENABLE is not set. Pulse WPTR_OVERFLOW_CLEAR after RB_ENABLE (and with WPTR_OVERFLOW_ENABLE) so overflow is cleared when interrupts are enabled. Signed-off-by: Danijel Slivka Reviewed-by: Alex Deucher Signed-off-by: Milan Milicevic Signed-off-by: Alex Deucher (cherry picked from commit 713fb4ab04f4d2af6120f8eb607c5673b2759b38) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit d89288af0fd3d43b8818145159708db415f4eb84 Author: Prike Liang Date: Thu Aug 20 15:27:56 2026 +0800 drm/amdgpu: finish GPU recovery callbacks before restarting schedulers [ Upstream commit 733389cb31e2c55e355410759fdc68afe74a4582 ] Run GPU post-reset callbacks, including KFD and display-audio resume, before restarting DRM scheduler workqueues. IP hardware initialization already happens inside ASIC recovery; this change orders the remaining callbacks before new scheduler submissions. Preserve the emergency-stop and guity job completition path's callbacks without starting schedulers, Signed-off-by: Prike Liang Acked-by: Lijo Lazar Signed-off-by: Alex Deucher (cherry picked from commit 1f6433e2b264e75c56ae95f187788806201bdbc3) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 50d5e5ec24c25abdc0d6fdfde2a73ce5084be49c Author: Wayne Lin Date: Thu Oct 8 10:55:03 2026 +0800 drm/amd/display: add missing CRC engine 1 registers [ Upstream commit f18c112edb600398b3dbd28a455e17cf945d6d91 ] [why] Opening the CRTC CRC debugfs file programs every CRC engine. On several generations the engine 1 window and data entries were missing, so configure hits a zero field mask and WARNs. DCN4.2, DCN4.2B, and DCN6.0 already had those entries, but configure still writes OTG_CRC1_SELECT with no mask check. DCN6.0 also lacks OTG_CRC1_EN, so optc1_configure_crc() writes OTG_CRC_EN instead. The ASIC headers already define the addresses and fields. The driver tables did not list them. [how] How the missing entries are filled in: 1. DCN3.0 through DCN3.0.3 use OPTC_COMMON_*_DCN3_BASE. Add the six engine 1 addresses and the window, data, and OTG_CRC1_SELECT masks. These headers have no OTG_CRC1_EN bit, so that field is not added. 2. DCN3.1 uses OPTC_COMMON_*_DCN3_1. Add the same addresses and masks, including OTG_CRC1_EN. dcn_3_1_2 defines that bit. DCN3.1.5 and DCN3.1.6 expand DCN3_1 through DCN31X. DCN3.1.4 has its own list. OTG_CRC1_EN was already on it, so only addresses, SELECT, window, and data are added. 3. DCN3.2 and DCN3.2.1 already had OTG_CRC1_EN and OTG_CRC1_SELECT. Add the window and data masks in the OPTC header and the addresses in the resource header. DCN3.2 fills addresses at init from ctx->dcn_reg_offsets[]. 4. DCN4.0.1 also uses optc1_configure_crc() and was missing SELECT, window, and data. Add those masks and the six addresses. OTG_CRC1_EN was already present. 5. DCN3.5, DCN3.5.1, and DCN3.6 already have the addresses and program engine 1 through optc35_configure_crc(). Their mask list included DCN3.2 and then repeated the CRC1 window and data fields. Drop the duplicates. 6. DCN2.0, DCN2.0.1, and DCN2.1 are left unchanged. They inherit the DCN1.0 lists, which already name engine 1 window, data, and OTG_CRC1_SELECT. Their headers have no OTG_CRC1_EN bit. 7. DCN4.2 and DCN4.2B use optc35_configure_crc(). Window, data, and OTG_CRC1_EN were already present. Add OTG_CRC1_SELECT. DCN6.0 uses optc1_configure_crc(). Window and data were already present. Add OTG_CRC1_SELECT and OTG_CRC1_EN. Fixes: ef45aaf73717 ("drm/amd/display: Configure all CRC engines in pipe CRC source path") Reported-by: Mikhail Gavrilov Closes: https://lore.kernel.org/all/20260829085941.106318-1-mikhail.v.gavrilov@gmail.com/ Signed-off-by: Wayne Lin Assisted-by: Cursor:Grok 4.7 Tested-by: Mikhail Gavrilov # Navi 31 (DCN3.2) Reviewed-by: Mikhail Gavrilov Reviewed-by: Tom Chung Cc: Mikhail Gavrilov Signed-off-by: Alex Deucher (cherry picked from commit f42edf63ba4456fa7a02e81a3aa7f2d410a28921) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 2664f497d5e35384736e42fc59e5b9ef27ca791a Author: Jesse Zhang Date: Mon Oct 26 21:03:00 2026 +0800 drm/amdgpu/userq: validate the moved individual BOs on restore [ Upstream commit ce5f2a25bdf6b2bccfc4ffb5e4c5f12e97eeace1 ] An individual BO of a user queue VM, i.e. one which doesn't share the root reservation, goes to the individual needs_update list when it is evicted. The user queue restore looked at vm->invalidated for them, which the VM state machine rework turned into the always_valid evicted list and commit 18decfc9e8cc ("drm/amdgpu/userq: actually validate userq BOs") into the individual evicted one. That list only holds imported DMA-bufs of compute VMs though, so for a user queue VM nothing is validated. The restore then neither locks such a BO nor moves it back. Its PTEs are updated to wherever it is now, cleared if it went to system memory, and it doesn't get the new eviction fence, so it can move again under the running queue. On navi48, once the BOs of an SDMA user queue are evicted from GTT (debugfs amdgpu_evict_gtt) the queue faults on its ring and rptr: amdgpu 0000:03:00.0: in page starting at address 0x0000000100000000 from client 10 amdgpu 0000:03:00.0: Faulty UTCL2 client ID: SDMA0 (0xd) amdgpu 0000:03:00.0: in page starting at address 0x0000000100101000 from client 10 Validate the BOs on the individual needs_update list like before. Fixes: 4cdbba5a16aa ("drm/amdgpu: restructure VM state machine v4") Fixes: 18decfc9e8cc ("drm/amdgpu/userq: actually validate userq BOs") Reviewed-by: Christian König Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit eb0d94765d4be18d41e93ad09947dd9cc06ed31a) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit d534c4d5d99c079e760b5d38b1f1813ea81292ea Author: Dariusz Marcinkiewicz Date: Mon Oct 5 23:28:14 2026 +0200 drm/amdgpu: check amdgpu_vm_ready() in dma-buf move notify [ Upstream commit 920ca822f527e45ce084b36f3c420b625eb7c62a ] amdgpu_dma_buf_move_notify() touches the page tables without first calling amdgpu_vm_ready(). When a process is SIGKILLed, its VM entities are stopped. Teardown of an imported dma-buf then tries to clear PTEs by submitting to one of those stopped entities. That eventually hangs the task. Commit aa5fc4362fac ("drm/amdgpu: fix task hang from failed job submission during process kill") added the stopped entity check in amdgpu_vm_ready() and used it in amdgpu_cs_vm_handling(). That did not cover a call in amdgpu_dma_buf_move_notify(), what was already mentioned in: https://lists.freedesktop.org/archives/amd-gfx/2025-October/133076.html Tested by SIGKILLing a GPU workload holding imported dma-bufs. Without the patch "Trying to push to a killed entity" errors are logged, then a task hangs. With the patch there are no hung tasks. This was tested on a 6.18 kernel. Fixes: aa5fc4362fac ("drm/amdgpu: fix task hang from failed job submission during process kill") Reviewed-by: Alex Deucher Signed-off-by: Dariusz Marcinkiewicz Assisted-by: LLM Signed-off-by: Alex Deucher (cherry picked from commit bee5c9d7a34cb1b510ad3b4c18c30f9d38b0ab7d) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 946561d189340d04ea916971fb715aef5caebe92 Author: Prike Liang Date: Fri Oct 16 09:34:32 2026 +0800 drm/amdgpu/userq: wait for GPU reset before mapping or unmapping queues [ Upstream commit 623507b8f4fe24851b2f1cb2c177f8ae3c8584b8 ] The user queue map and unmap helpers talk to the MES, but only the create path holds reset_domain->sem around them. The eviction, restore, destroy and suspend paths can submit to the MES while a GPU reset is in progress: WARNING: amdgpu_device.c:928 at amdgpu_device_skip_hw_access+0x73/0x90 [amdgpu] Workqueue: events amdgpu_eviction_fence_suspend_worker [amdgpu] Call Trace: amdgpu_mm_wdoorbell64+0x20/0x70 [amdgpu] mes_v11_0_ring_set_wptr+0x71/0x80 [amdgpu] amdgpu_ring_commit+0x5b/0xa0 [amdgpu] mes_v11_0_submit_pkt_and_poll_completion.constprop.0+0x207/0x520 [amdgpu] mes_v11_0_remove_hw_queue+0xd9/0x100 [amdgpu] mes_userq_unmap+0xc3/0x140 [amdgpu] amdgpu_userq_unmap_helper+0x67/0x280 [amdgpu] amdgpu_userq_evict+0x52/0xf0 [amdgpu] amdgpu_eviction_fence_suspend_worker+0x55/0xe0 [amdgpu] Take the semaphore for read in the helpers instead, around both the MES call and the queue state check and update. The reset changes the queue state from amdgpu_userq_pre_reset()/post_reset(), so every caller now waits for a running reset and acts on the state it left behind. Signed-off-by: Prike Liang Reviewed-by: Vitaly Prosyak Signed-off-by: Alex Deucher (cherry picked from commit e6a8b8588f43bd4d7054ac47cccc35f56ad2df90) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 3044e6e19f5746d2c279d0105fd61e759bcb42b3 Author: Jesse Zhang Date: Sat Oct 24 01:26:49 2026 +0800 drm/amdkfd: use the queue's process info for the WPTR BO eviction fence [ Upstream commit da2897ee8b811945fd40ecc4aaf03291c14ce61c ] amdgpu_amdkfd_map_gtt_bo_to_gart() removes the eviction fence of bo->vm_bo->vm->process_info from the WPTR BO of a new queue. bo->vm_bo is the VM which opened the BO last, not necessarily the KFD process' VM, and a render node VM has no process info. On navi31, an unprivileged process which exports its WPTR BO with AMDKFD_IOC_EXPORT_DMABUF and imports it on a second render node fd oopses in AMDKFD_IOC_CREATE_QUEUE: BUG: kernel NULL pointer dereference, address: 0000000000000060 RIP: 0010:amdgpu_amdkfd_map_gtt_bo_to_gart+0x86/0x1a0 [amdgpu] init_user_queue.part.0+0x180/0x250 [amdgpu] pqm_create_queue+0x32d/0x730 [amdgpu] kfd_ioctl_create_queue+0x583/0x9f0 [amdgpu] Pass the process info of the queue instead. With the fix, the queue is created and destroyed normally. Fixes: 7f347e3f8217 ("drm/amdkfd: Fix NULL pointer error for GC 11.0.1 on mGPU") Reviewed-by: Felix Kuehling Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit 6b4157498a176bd1c6083f6bb5aaf8a257a2027e) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 2c7bd4568f5d19d63241ccdf930b15e619af7c2b Author: Jesse Zhang Date: Sun Oct 18 19:17:57 2026 +0800 drm/amdgpu: keep the CS user fence BO in GTT [ Upstream commit 7a56d929dc2304edaa6231e1eb5eb82b7e8b74a9 ] The CS ioctl hands the GPU the GART address of the user fence BO, but since the BO keeps its own preferred and allowed domains, it no longer makes sure the BO is in GTT. A user fence in a VRAM BO, which only needs to be a page in size, gets its address from amdgpu_bo_gpu_offset(), which warns about non-contiguous VRAM. On navi31, a CS with a user fence in a 4K VRAM BO, or in one created with AMDGPU_GEM_CREATE_VM_ALWAYS_VALID: WARNING: amdgpu_object.c:1531 at amdgpu_bo_gpu_offset+0x86/0xb0 [amdgpu], CPU#11: cs_gem_checks/18393 RIP: 0010:amdgpu_bo_gpu_offset+0x86/0xb0 [amdgpu] Call Trace: amdgpu_cs_parser_bos.isra.0+0x4eb/0x850 [amdgpu] amdgpu_cs_ioctl+0x97e/0x2510 [amdgpu] drm_ioctl_kernel+0xac/0x110 [drm] drm_ioctl+0x2c6/0x5b0 [drm] __x64_sys_ioctl+0xa0/0xf0 do_syscall_64+0xa3/0x4d0 entry_SYSCALL_64_after_hwframe+0x76/0x7e and BOs which can't be in GTT at all, like GWS or OA ones of a page in size, pass the checks as well. Only take BOs which can't be anywhere else than in GTT as user fence, which the CS then validates there along with its other BOs. While at it, detect userptrs with amdgpu_ttm_tt_is_userptr(); amdgpu_ttm_tt_get_usermm() returns NULL once the task which created the userptr is gone. v2: only take BOs which can only be in GTT instead of special casing the user fence BO in the validation, use amdgpu_ttm_tt_is_userptr() (Christian) Reviewed-by: Christian König Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit f16989def9561d04d0f2e77216f5319112d29bf1) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit c8dfda985dc42b3d307f57e522a2e2dc40f39384 Author: Jesse Zhang Date: Tue Oct 20 17:53:16 2026 +0800 drm/amdgpu: parse CS IBs at the BO offset their VA mapping starts at [ Upstream commit 63a59637517682a920f86da1a189a3e639dd4fb3 ] For rings which parse or patch the IBs on the CPU, like JPEG and VCN, the CS looks the IB up through its VA mapping and maps the BO, but ignores the offset in the BO the mapping starts at. It then parses other data than the GPU executes. On navi31, an IB of JPEG NOPs in the second page of a BO, mapped with offset_in_bo 4096, is parsed from the zeros in the first page and rejected: amdgpu 0000:03:00.0: Invalid packet [0x00000000]! while the same IB submitted through a mapping of the whole BO works. Add the mapping offset when locating the IB in the BO. Fixes: 4802ce117786 ("drm/amdgpu: fix UVD/VCE VM emulation") Reviewed-by: Alex Deucher Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit 74ba1d87d67d0a38d8248928241c3e1c73d0d53b) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit a38b27199050db54896765cc780b37b6ea6c6e09 Author: Jesse Zhang Date: Tue Oct 20 10:15:22 2026 +0800 drm/amdgpu: sign extend the addresses GEM_OP(GET_MAPPING_INFO) returns [ Upstream commit 37cfaaa6b5e9448ef786342d470d0e0b8eb89fa6 ] GEM_VA takes the GPU virtual addresses above the VA hole sign extended, like the rest of the UAPI, but GET_MAPPING_INFO reports them without the upper bits, so they land in the hole. Mappings in the upper half of the address space can't be recreated or removed with what it returns. On navi31: MAP at 0xffff800100000000 -> 0 GET_MAPPING_INFO -> addr 0x800100000000 UNMAP at 0x800100000000 -> -EINVAL Sign extend the addresses before handing them out. Fixes: 4d82724f7f2b ("drm/amdgpu: Add mapping info option for GEM_OP ioctl") Reviewed-by: Christian König Signed-off-by: Jesse Zhang Signed-off-by: Alex Deucher (cherry picked from commit 9d5524a339390da9145b19bfb40da45640332fb3) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit a4b7810a7587694fb23cbf0563623a86edaef55f Author: Ce Sun Date: Wed Oct 21 17:03:38 2026 +0800 drm/amdgpu: skip RAS error count reset in debug mode [ Upstream commit 9b115ca0e5ceba08da9b9ca09e6ba65d1a2544c0 ] After legacy ACA support was retired, some ASICs systems may trigger security violations during driver load when amdgpu_ras_reset_error_count() is invoked in debug mode. The function only checks whether RAS is supported for the target block before proceeding. In debug mode, ACA/RAS handling is not available and attempting to access the reset path can lead to unexpected HW accesses, resulting in security violation reports during driver initialization. Prevent this by treating debug mode as unsupported for RAS error count reset and return -EOPNOTSUPP early. Fixes: af1ae7d0beaf ("drm/amdgpu: retire legacy ACA support") Signed-off-by: Ce Sun Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher (cherry picked from commit af6b6f1a14dca860468b0fe2a55b7194702d5fa0) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit 190c8304f54550aa773580c6946ead1c48d4d7a2 Author: Bas Nieuwenhuizen Date: Thu Oct 22 01:30:54 2026 +0100 drm/amdgpu: Check cs flags. [ Upstream commit f5ea64f9fcd921bc4e2307a262e19450b8a58524 ] Had no validation before. libdrm_amdgpu memsets this, even for the raw/raw2 functions. We have a lot of functions touching the ioctl struct, no strong opinion on where this is placed, but I thought early would be good. Signed-off-by: Bas Nieuwenhuizen Reviewed-by: Faith Ekstrand Signed-off-by: Alex Deucher (cherry picked from commit 4d01e15e76358f60ef6734462d2b6d9972b9dfbc) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin commit a425d80ed04206e351ed3bf30f19b2473ba2a7f4 Author: Jarkko Sakkinen Date: Tue Nov 3 05:02:07 2026 +0200 nvme-keyring: Add a missing key_put() call to nvme_tls_key_lookup() [ Upstream commit 404a8f6caa63822c1d2a45adbf07fd9c0567a7ef ] Call key_put() before returning -EKEYREVOKED, as the reference count gets incremented by key_lookup(). Cc: stable@vger.kernel.org # v6.12+ Fixes: 5bc46b49c828 ("nvme-tcp: check for invalidated or revoked key") Reviewed-by: Hannes Reinecke Signed-off-by: Jarkko Sakkinen Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit 900c5c0722e2ae5653d2dbf90c5374c7f227ea28 Author: Yitang Yang Date: Tue Sep 1 22:24:38 2026 +0800 ublk: add missing DEL_DEV_ASYNC to unprivileged permission check [ Upstream commit e6ac1da6a53c5f670bf09e60a2500d15be68d2fc ] ublk_ctrl_uring_cmd_permission() is missing the UBLK_CMD_DEL_DEV_ASYNC case, causing the command to always return -EINVAL for unprivileged ublk devices. Fix it by adding the missing case. Fixes: 13fe8e6825e4 ("ublk: add UBLK_CMD_DEL_DEV_ASYNC") Cc: stable@vger.kernel.org Signed-off-by: Yitang Yang Reviewed-by: Ming Lei Link: https://patch.msgid.link/20260901142438.237586-1-yi1tang.yang@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit d6c89cdb5d2a242940caaddc45acce1e6bfdc967 Author: Yilin Zhang Date: Fri Oct 30 23:03:51 2026 +0100 mptcp: do not use Fast Open on MP_JOIN subflows [ Upstream commit 6d2cf411aba2aa0bd641b49be5b1964ac5097a50 ] tcp_fastopen_create_child() hands the SYN packet itself to subflow_syn_recv_sock(). For an MP_JOIN request this takes the fatal fallback: the cloned child is destroyed and handed back with drop_req flagged, but tcp_fastopen_create_child() does not check the flag and queues it, so accept() can expose the freed child. MP_JOIN cannot use Fast Open: data on a subflow requires the completed HMAC exchange (RFC 8684, sec. 3.2). Refuse it (only the TFO path passes a SYN skb here) and let tcp_conn_request() fall back to the regular MP_JOIN handshake; also strip the Fast Open cookie from MP_JOIN SYN/ACKs. Fixes: 90bf45134d55 ("mptcp: add new sock flag to deal with join subflows") Cc: stable@vger.kernel.org Reported-by: Kimi Security Team Suggested-by: Jiayuan Chen Suggested-by: Paolo Abeni Signed-off-by: Yilin Zhang [ Moving code to avoid clearing TS and consolidating checks. ] Signed-off-by: Matthieu Baerts (NGI0) Link: https://patch.msgid.link/20261030-mptcp-tfo-mpj-v4-1-e6eff2027342@kernel.org Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 9819add3aeb66dc823db0a82337f55481ad463be Author: Daehyeon Ko <4ncienth@gmail.com> Date: Mon Oct 5 08:51:01 2026 +0900 vhost/vsock: size receive SKBs from declared payload [ Upstream commit d5e912448cd98b261eba8e35ab838f2dc69a79f5 ] vhost_vsock_alloc_skb() sizes the skb from iov_length(), the total guest descriptor length. virtio_transport_inc_rx_pkt() instead adds hdr->len to rx_bytes and buf_used, and budgets each queued skb as SKB_TRUESIZE(0). The guest controls the descriptor length and hdr->len independently. A guest can therefore provide a 64 KiB descriptor while declaring a zero payload. The descriptor-sized skb remains queued, rx_bytes and buf_used remain unchanged, and only the fixed queue-entry budget limits retention. This is not a lifetime leak: the skb is freed when dequeued or at socket teardown. Repeating this across connections can nevertheless exhaust host memory. On Linux v7.2, 455 such descriptors retained 30,255,680 bytes for a 262,144-byte receive buffer; a full-payload control retained 265,984 bytes. Vhost previously read hdr->len and allocated pkt->buf from that value. The conversion from virtio_vsock_pkt to sk_buff instead allocated receive skbs from the descriptor length, introducing the allocation-accounting mismatch. Copy the header into a stack object and validate hdr->len before allocating the skb. Size the allocation as sizeof(hdr) + payload_len so descriptor capacity no longer determines queued memory. Check payload_len against len - sizeof(hdr) to avoid addition overflow on 32-bit hosts. Fixes: 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") Cc: stable@vger.kernel.org Signed-off-by: Daehyeon Ko <4ncienth@gmail.com> Reviewed-by: Stefano Garzarella Acked-by: Michael S. Tsirkin Link: https://patch.msgid.link/20261004235101.1464007-1-4ncienth@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 765af9e95c840fcbbecf34ca1e787daba8eac569 Author: Alexei Starovoitov Date: Sun Nov 1 19:44:33 2026 +0000 net: reject a negative TCP header offset in qdisc_pkt_len_segs_init() [ Upstream commit 35d2d6e5ac0d22428b2a0216061f3330c095393c ] qdisc_pkt_len_segs_init() stores skb_transport_offset(), or the inner offset, in the unsigned hdr_len. A header in front of skb->data gives a negative offset. For an offset a little below zero, pskb_may_pull() gets a small length and succeeds. Then a 64-bit kernel reads the TCP header far after the skb and can crash. Further below zero pskb_may_pull() fails. Commit 28a57fb2c5df ("net: iptunnel: fix stale transport header during tunnel decapsulation") fixed one source of such offsets. Other code that removes bytes from the front of a packet can leave the same stale header. Return SKB_DROP_REASON_SKB_BAD_GSO for a negative offset in the TCP branch. SKB_GSO_UDP_L4 and the other GSO types read no header and still get a wrong qdisc_pkt_len(). On a 64-bit kernel only packets that cause the read after the skb today get a new result. Then __dev_queue_xmit() drops them and returns -EINVAL, but sch_handle_ingress() ignores the result. Their content can be valid. Thus the code that leaves the header stale needs its own fix. Fixes: 7fb4c1967011 ("net: pull headers in qdisc_pkt_len_segs_init()") Signed-off-by: Alexei Starovoitov Reviewed-by: Eric Dumazet Acked-by: Michael S. Tsirkin CC: stable@vger.kernel.org Link: https://patch.msgid.link/20261101194433.2637113-1-alexei.starovoitov@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit c3ccfbb2acb259b5d3d030fdb63d3cf96de33330 Author: Amir Goldstein Date: Fri Oct 30 18:07:02 2026 +0100 ovl: inherit FMODE_NONOTIFY when opening directory realfiles [ Upstream commit 323899b4ed233d5b6e2fc160c16fbf39cf0317da ] When fanotify hands a listener an fd for a permission event on an overlay directory, ovl_dir_open_realfile() opens the real directory via dentry_open(), not backing_file_open(), so the lower open could still raise FS_OPEN_PERM and deadlock a listener that also marks the backing filesystem. Export dentry_open_nonotify() and call it from ovl_path_open_realfile() when the overlay user file must not generate events. Ordinary ovl_path_open() callers are unchanged. Reported-by: Christian Brauner (Amutable) Closes: https://lore.kernel.org/all/20261030-welpen-anbinden-nullen-b2432cee1d10@brauner/ Fixes: 130fdbc3d1f99 ("ovl: pass correct flags for opening real directory") Cc: stable@vger.kernel.org Tested-by: Edvard Conrad Link: https://lore.kernel.org/ltp/P5Iny41--F-9@tuta.io/ Signed-off-by: Amir Goldstein Signed-off-by: Sasha Levin commit 7327092a678bfcb1bae033acb1be1006a1399e30 Author: Jamal Hadi Salim Date: Thu Oct 29 16:36:31 2026 -0400 net/sched: clamp skb->queue_mapping before indexing the tx queue [ Upstream commit f19f2b308beb158d0e6f6eb806ced636e4ebf6ce ] This issue was caught by Sashiko (nipa). A producer-side path cap is already merged (ea4d4b5dddb5); this patch adds the matching consumer-side caps. The issue: The tx queue is picked and capped in netdev_core_pick_tx() before the __dev_xmit_skb() qdisc enqueue path. A tc BPF program running inside an egress qdisc (not clsact) can then change __sk_buff->queue_mapping; that store is never re-checked. bpf_convert_ctx_access() bounds it only by NO_QUEUE_MAPPING, not by the device's queue count. Two consumers read the stale value: - On dequeue, qdisc_restart() calls netdev_get_tx_queue(), which indexes dev->_tx[]. netdev_get_tx_queue() guards it with just a DEBUG_NET_WARN_ON_ONCE, so sch_direct_xmit() takes the out-of-bounds txq->_xmit_lock and writes txq->xmit_lock_owner past the end of the allocation on non-lltx devices such as ifb. Drivers that index their rings from skb_get_queue_mapping() (ex: ifb) go out of range the same way. - On enqueue, taprio_enqueue() indexes q->qdiscs[] with the same value; the array is sized dev->num_tx_queues. A duplicating netem on a child qdisc clones the skb and re-enqueues the clone at the taprio root (qdisc_root_bh()) through a direct rootq->enqueue() call, so the value reaches taprio_enqueue() before any dequeue cap runs. The Fix: Cap the mapping at the consumers and write the capped value back, so the qdisc's _tx[] lookup, the taprio q->qdiscs[] lookup and any later driver read stay in range. On the dequeue side the cap folds into the dequeue path instead of a separate walk over the returned list: dequeue_skb() caps the head, and each bulk helper caps the element it appends. For a qdisc that is not TCQ_F_ONETXQUEUE, netdev_cap_txqueue() logs a ratelimited notice and selects queue 0. A TCQ_F_ONETXQUEUE qdisc is bound to a single tx queue: dequeue_skb() uses q->dev_queue for the frozen check, the BQL limit and the trace point, while qdisc_restart() transmits on the skb's queue. Capping an out-of-range mapping to queue 0 would therefore send a per-queue child's skb through a different queue than the one it was dequeued for. On mq, mqprio, taprio and htb offload children, a stopped queue 0 could then park the list in q->gso_skb, and the later wake would schedule queue 0's own child instead of this qdisc. Pin a TCQ_F_ONETXQUEUE mapping to the qdisc's own queue to keep the documented invariant. The pin covers every mapping, not only an out-of-range one: an in-range mapping that a filter sets on one of those per-queue children is rewritten to the child's own queue, and this path does not call netdev_cap_txqueue(), so it logs no notice. On a single-queue device qdisc_create() sets TCQ_F_ONETXQUEUE, so the one-queue trigger described below also takes this branch and is corrected without a notice. That also keeps a bulk list on one queue by construction: every element of a TCQ_F_ONETXQUEUE qdisc, including a follower changed by a filter, is pinned to q->dev_queue before it is appended. The fast bulk helper therefore needs no head comparison and no skb_bad_txq requeue; the slow helper, used only by non-ONETXQUEUE qdiscs, still compares and requeues a mismatched follower, where a wake on any queue reschedules q. On the enqueue side taprio_enqueue() caps the mapping against real_num_tx_queues and writes it back before selecting q->qdiscs[queue], so a duplicating child cannot steer the clone out of the array. Conditions to recreate the bug: The dequeue path: load a SCHED_CLS or SCHED_ACT program that stores __sk_buff->queue_mapping (a tc BPF action is enough), attach it to a transmit qdisc (for example a matchall filter on a prio root), and send a packet. With a 1-queue device a store of 1 indexes one past dev->_tx[]. Under KASAN with panic_on_warn=1 the unfixed kernel faults with "BUG: KASAN: slab-out-of-bounds in sch_direct_xmit". Loading the program needs CAP_BPF/CAP_SYS_ADMIN, so the trigger is root. The enqueue path: on a multi-queue device, install a software taprio root, graft a prio child with a duplicating netem on every class, and store an out-of-range queue_mapping from a matchall+bpf filter on the prio. The duplicate is re-enqueued at the taprio root and indexes q->qdiscs[] past dev->num_tx_queues; the unfixed kernel faults in taprio_enqueue_one(). Same CAP_BPF/CAP_SYS_ADMIN requirement. Fixes: 74e31ca850c1 ("bpf: add skb->queue_mapping write access from tc clsact") Reported-by: Sashiko (nipa) Closes: https://lore.kernel.org/netdev/179033713973.2160803.4914570693994398206@kernel.org/ Link: https://lore.kernel.org/netdev/179329777513.3134.12135506558709584471@kernel.org/ Link: https://lore.kernel.org/netdev/179293123940.3134.1149128679923234677@kernel.org/ Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-MD1X.v4.r0.20261021042722-1%40mojatatu.com Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-MD1X.v3.r0.20261015165943-1%40mojatatu.com Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-MD1X.v1.20261005193231%40mojatatu.com Link: https://lore.kernel.org/netdev/20261015125822.GH83879@horms.kernel.org/ Cc: stable@vger.kernel.org Signed-off-by: Jamal Hadi Salim Reviewed-by: Simon Horman Link: https://patch.msgid.link/QDISC-MD1X.v6.r0.20261029162633-1@mojatatu.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 48bd1823237fb076db6e109e35c59b1bc08f550a Author: Chris Mason Date: Fri Oct 16 21:17:21 2026 +0000 ovl: fix whiteout creation in casefolded directories [ Upstream commit e803c82dcdd15e87b48fca1ea8d2cfe6a7ed83d4 ] unlink and rmdir fail with EINVAL on an overlay with casefolded (case-insensitive) layers, if the name exists in a lower layer. Casefolded layers need CONFIG_UNICODE. Root can mount such an overlay, and so can an unprivileged user in a user namespace, with tmpfs layers. Overlayfs does not change a lower layer. To remove a name that exists there, it hides the name with a marker file, a whiteout. It creates the whiteout in the work directory, a scratch directory on the upper filesystem, and renames it over the name in the upper directory: - ovl_whiteout() creates the whiteout with mknod, or as a hard link to an earlier whiteout. - ovl_cleanup_and_whiteout() then prepares the rename with start_renaming_two_dentries(), which returns -EINVAL if the source or the target dentry is unhashed, that is, not in the dentry hash table. With casefolded directories, both dentries can be unhashed: - The target. Lookup in a casefolded directory leaves a negative dentry unhashed, so the rename target is unhashed if the name does not exist in the upper directory. - The source, which is the new whiteout. tmpfs hashes a dentry when mknod or link makes it positive, but ext4 does not, so on ext4 the source is unhashed as well. The cleanup after the failure also refuses an unhashed dentry, so on ext4 the whiteout is left behind in the work directory. Reproduced with rm and rmdir on casefolded tmpfs and ext4 layers, also as uid 1000 in a user namespace. Fix this by creating the whiteout with ovl_create_temp(), which repeats the lookup if the new dentry is unhashed. Prepare the rename with start_renaming_dentry(), which looks up the target name with the directories locked. The caller looked the name up without a lock, so return -ESTALE if the name now refers to a different inode. Fixes: 833d2b3a072f ("Add start_renaming_two_dentries()") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason [amir: pass the name used for lookup instead of taking a name snapshot] Tested-by: Hungyu Lin Signed-off-by: Amir Goldstein Signed-off-by: Sasha Levin commit 0f21cfc2a16f79b52cae10649b0f001fe6ffbf9d Author: Chris Mason Date: Fri Oct 16 21:17:17 2026 +0000 ovl: do not let chattr change the casefold flag [ Upstream commit 83b351c3ade542bbfa1073e8c2d919826628252a ] chattr +F or -F on an overlay directory can make the directory, or the whole mount, unusable. Lookups of the directory, and lookups in it, then fail. From code inspection, the caller only needs to own the directory. The upper filesystem must support casefolding: ext4 or f2fs with the casefold feature, or tmpfs with the casefold option. chattr +F and -F set and clear FS_CASEFOLD_FL, the casefold flag of a directory. The flag enables casefolding (case-insensitive name lookup) for the directory. All directories of an overlay must match the casefold state that was recorded at mount time, and ovl_lookup_single() enforces this: - A lookup in a directory that does not match fails with -ESTALE. - A lookup of the directory itself fails with -EREMOTE. ovl_fileattr_set() copies the directory up, which creates it in the upper layer if it only existed in a lower layer. It then passes FS_CASEFOLD_FL on to the upper filesystem. The upper filesystem accepts the change if the upper directory is empty, regardless of what the merged directory contains. The merged directory is the one that the user sees, with the names from the upper and the lower directories. After the change the upper directory no longer matches the mount. If the directory is the root of the overlay, the whole mount is affected. The flag can also change without chattr +F or -F. chattr reads all flags of a directory, changes one and writes all of them back. For a directory that only exists in a lower layer, overlayfs reads the flags from the lower filesystem. xfs with the ascii-ci feature reports FS_CASEFOLD_FL on every inode, but never sets S_CASEFOLD, the inode flag that overlayfs compares with the mount. So its directories count as not casefolded. With a lower layer on such an xfs and an upper layer on ext4 with the casefold feature, chattr +A on a lower-only directory therefore sets FS_CASEFOLD_FL on the new, empty upper directory. Reproduced as root on tmpfs and on ext4 with chattr +F or -F on an overlay directory whose upper directory was empty. Afterwards lookups below it failed with ESTALE, and lookups of the directory itself failed with EREMOTE. The chattr +A case was seen once, on a kernel with an earlier form of this patch that still passed the caller's flag on: lookups of the directory failed with EREMOTE. Fix this by returning -EOPNOTSUPP if FS_IOC_SETFLAGS, the only call that can change the flag, asks for a casefold flag on a directory that does not agree with the casefold state of the mount. This also refuses the chattr +A case above. Fixes: 083957f9614a ("ovl: support layers on case-folding capable filesystems") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason [amir: check the flag against the casefold state of the mount instead of reading back the flags] Tested-by: Hungyu Lin Signed-off-by: Amir Goldstein Signed-off-by: Sasha Levin commit 549fb7c77951ad9ddfed05ce1776f497538ad13e Author: Chris Mason Date: Fri Oct 16 21:17:21 2026 +0000 ovl: fail the mount if the casefold flag has changed [ Upstream commit c782fc8ada811569811c0fdea5c3412511be95d0 ] An unprivileged user in a user namespace can repeatedly trigger a kernel warning with their own overlay mounts. They do so by changing the casefold flag of the topmost layer's empty root, the top directory of that layer, after the layers are set and before the mount is created. The casefold flag of a directory makes name lookups in that directory case-insensitive. All layers of an overlay must agree on casefolding. ovl_mount_dir_check() reads the casefold flag of a layer root when fsconfig() sets that layer, and saves the result in ofs->casefold. The mount is created later, by another fsconfig() call with FSCONFIG_CMD_CREATE. The casefold flag of an empty directory can be changed. The casefold flag of the overlay root must match ofs->casefold. ovl_get_root() copies the flag from the topmost layer root, as it is when the mount is created. On a mismatch, ovl_get_root() only does a WARN_ON(), and the mount continues. The check is not a WARN_ON_ONCE(), so each such mount warns again. An unprivileged user needs CONFIG_UNICODE, and a tmpfs mounted with the casefold option in their namespace. Reproduced by changing the casefold flag of the empty upper directory after the layers were set and before FSCONFIG_CMD_CREATE, with tmpfs and ext4 layers, and as uid 1000 in a user namespace. Fix this by replacing the WARN_ON() with a check that fails the mount with -EINVAL. Fixes: f9377faaeae0 ("ovl: Add S_CASEFOLD as part of the inode flag to be copied") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Tested-by: Hungyu Lin Signed-off-by: Amir Goldstein Signed-off-by: Sasha Levin commit a8e97051de9b1434a0eca7096c28b64b7bf5eb9c Author: Xia Yan Date: Thu Oct 29 21:58:22 2026 +0800 ipv6: fix device binding after failed datagram connect [ Upstream commit bc53aab4881adc134f495092034e9e7c0791d84c ] __ip6_datagram_connect() can change sk_bound_dev_if when connecting to an address that needs a scope ID. If ip6_datagram_dst_update() fails, the old peer address and port are restored, but the new device binding is left behind. A UDP socket can then keep reporting its original peer while sends and attempts to reconnect to that peer fail with ENETUNREACH. Replies to the socket are also dropped by the device match. The same problem occurs when a scoped multicast destination picks up np->mcast_oif. Save the original binding before processing the scope and restore it along with the peer information on failure. This completes the rollback in commit 2f987a76a977 ("net: ipv6: keep sk status consistent after datagram connect failure") and preserves the new binding on success. Found while reviewing scope-ID handling in __ip6_datagram_connect(). Confirmed by exchanging UDP traffic over ::1, then attempting a link-local connect with a nonexistent scope ifindex or a down interface. After that connect fails, the original peer is still reported but communication and reconnecting to it fail. Tested before and after the fix in UML for three rounds, covering explicit scopes, multicast interface fallback, initially unconnected sockets and existing bindings. With the fix, the old binding and peer are retained, and traffic and reconnection to the original peer work. Also built on x86_64 with W=1 using adjusted allmodconfig and allyesconfig configurations, with no new warnings. Fixes: 2f987a76a977 ("net: ipv6: keep sk status consistent after datagram connect failure") Cc: stable@vger.kernel.org Signed-off-by: Xia Yan Link: https://patch.msgid.link/20261029135822.448299-1-yanxia@cmss.chinamobile.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit e7b992081b44e6c595e542a7acb5920519b86898 Author: Thomas Gleixner Date: Sun Nov 1 18:58:08 2026 +0100 x86/entry: Fix ptrace regression [ Upstream commit b697faab2c92653ee13bd950c8de13551a78971d ] The recent rework of the syscall entry code missed the historical detail of the abuse of syscall number -1L to abort a syscall and keep modifications by tracers to the return value, while a rewrite of the syscall number to an invalid value undoes eventual tracer modification to the return value and overwrite it with -ENOSYS. Restore the original behaviour. Fixes: 1b1f3b3e1b39 ("x86/entry: Get rid of the sys_ni_syscall() indirection") Reported-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Tested-by: Sebastian Andrzej Siewior Cc: stable@vger.kernel.org Link: https://patch.msgid.link/87ecd4xwlr.ffs@fw13 Closes: https://lore.kernel.org/all/20261022142425.3Wx-RrU5@linutronix.de Signed-off-by: Sasha Levin commit 6ac69b444b85d0e511d9bc15f586ebeed49322fa Author: Samiullah Khawaja Date: Sat Oct 31 20:35:40 2026 +0000 mm/gup: check folio->mapping under folio lock in memfd_pin_folios() [ Upstream commit 71555ae8c7572fd99158013ca2e29187c5d2508d ] memfd_pin_folios() pins folios from the page cache without taking the folio lock. khugepaged or MADV_COLLAPSE can therefore replace a folio after checking its refcount while memfd_pin_folios() still pins the old folio. The caller then receives a folio which is no longer part of the memfd. For udmabuf and iommufd, this can cause data corruption: DMA accesses the detached folio rather than the live memfd contents. DMA reads can return stale data, while DMA writes update the detached copy and are lost from the live memfd. The detached folio remains pinned, so these accesses do not constitute a use-after-free or target another application's memory. For memfd live update, the stale contents can reappear in the memfd after handover. Lock the folio and recheck folio->mapping before pinning it, like other page cache users do. If the folio was removed, retry the folio lookup from the index that was removed. Fixes: 89c1905d9c14 ("mm/gup: introduce memfd_pin_folios() for pinning memfd folios") Reported-by: Andy Lutomirski Closes: https://lore.kernel.org/all/CALCETrV5eqg6d9=+BQhCpRwBNe3aCQiut8vxPBs8b7PToqjaHg@mail.gmail.com/ Cc: stable@vger.kernel.org Signed-off-by: Samiullah Khawaja Reviewed-by: Andy Lutomirski Link: https://patch.msgid.link/20261031203540.2282507-1-skhawaja@google.com Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit b9b3c367faf1929fb8192a846b3604ad7eced008 Author: Lance Yang Date: Mon Oct 26 23:20:13 2026 +0800 khugepaged: fix readahead lock inversion in collapse_file() [ Upstream commit eadce52a9ef657d561b3e76c9b5f178bd99735f5 ] collapse_file() can call page_cache_sync_readahead() while still holding source folios locked. If truncate holds mapping->invalidate_lock exclusively and waits for one of those folios, readahead waits for invalidate_lock and neither side can make progress. We need to release those folio locks before starting readahead. On a page cache miss, roll back first, populate the collapse range, and retry once. Doing readahead after rollback avoids an extra pass when all folios are already present. If another miss occurs on retry, give up rather than keep retrying while truncate or reclaim removes folios. Keep page_cache_sync_readahead() and wait for read I/O with filemap_lock_folio(), releasing each folio before moving to the next. The existing uptodate check during collapse still handles read errors. Shmem uses shmem_get_folio() for swapin and fallocated folios without taking mapping->invalidate_lock, so it is unaffected. Reported-by: syzbot+16bf7cd0ebeb1de93aa5@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=16bf7cd0ebeb1de93aa5 Fixes: 730633f0b7f9 ("mm: Protect operations adding pages to page cache with invalidate_lock") Cc: stable@vger.kernel.org Signed-off-by: Lance Yang Reviewed-by: Pedro Falcato Acked-by: David Hildenbrand (Arm) Acked-by: Zi Yan Reviewed-by: Baolin Wang Link: https://patch.msgid.link/20261026152013.10511-1-lance.yang@linux.dev Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit bfd0c1c711660dd5c090a57f1aced2af262a679c Author: Ritesh Harjani (IBM) Date: Fri Oct 30 05:37:36 2026 +0530 mm/huge_memory: set the mmu_gather page size in zap_huge_pud() [ Upstream commit 466d6844c8f19fba16b668b49861bdb8d7ded282 ] Unmapping a device-dax mapping with 1G alignment on powerpc radix kernel built with CONFIG_DEBUG_VM triggers this warning on every munmap: WARNING: mm/mmu_gather.c:176 at __tlb_remove_folio_pages_size+0x38/0x230 NIP [c00000000063d508] __tlb_remove_folio_pages_size+0x38/0x230 LR [c0000000006fb688] zap_huge_pud+0x1b8/0x2d0 Call Trace: zap_huge_pud+0x170/0x2d0 (unreliable) __zap_vma_range+0x1604/0x1e20 unmap_vmas+0xa0/0x1f0 unmap_region+0xb0/0x130 vms_complete_munmap_vmas+0x120/0x310 do_vmi_align_munmap+0x1ec/0x240 __vm_munmap+0x148/0x220 sys_munmap+0x28/0x40 To trigger this - it is enough to mmap() /dev/dax0.0, touch the first byte so that the whole 1G is mapped by a single PUD and then munmap() it. PowerPC needs MMU_GATHER_PAGE_SIZE in which mmu_gather needs to record the page size for which tlb flush is needed. zap_huge_pmd(), zap_pte_range(), change_huge_pud() etc all do this already. However, since commit: dbe54153296d ("mm/huge_memory: add vmf_insert_folio_pud()") a device-dax PUD maps a real folio and zap_huge_pud() now hands it to tlb_remove_page_size(tlb, page, HPAGE_PUD_SIZE). At that point tlb->page_size is still whatever the previous user left behind, which is 0 for the fresh gather set up by munmap() and so the check fires. Fix this in the same way like how other similar paths do. Fixes: dbe54153296d0 ("mm/huge_memory: add vmf_insert_folio_pud()") Cc: stable@vger.kernel.org Reported-by: Pavithra Signed-off-by: Ritesh Harjani (IBM) Acked-by: Zi Yan Acked-by: Muchun Song Tested-by: Pavithra Prakash Link: https://patch.msgid.link/8b853e5f9f16145859407b28af654b0f79e12642.1793318297.git.ritesh.list@gmail.com Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit c6b97a2688e01a6bd323a7d7db1566e7bbc0b424 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:40:15 2026 +0100 mm/memory-tiers: unregister empty tiers outside memory_tier_lock [ Upstream commit 500624f28eca441e35f978979ccfb373202fefd3 ] When offlining a node's last memory empties its tier, clear_node_memory_tier() calls device_unregister() while holding memory_tier_lock. A concurrent sysfs read can hold a kernfs active reference and block in nodelist_show() on that mutex. device_unregister() then waits in kernfs_drain() for the read to finish and release its active reference, while the reader waits for the offlining task to release the mutex. Return the node's former tier from clear_node_memory_tier(), making the helper more similar to set_node_memory_tier(), which also returns a memory_tier pointer. Let the caller unlink an empty tier under memory_tier_lock before rebuilding demotion targets, then unregister its device after dropping the lock. Fixes: 9832fb87834e ("mm/demotion: expose memory tier details via sysfs") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Reviewed-by: Gregory Price (Meta) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-46-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 485214cc031771fdbd5829b431f4f115e285dc21 Author: Rik van Riel Date: Sat Oct 31 10:40:14 2026 +0100 mm/cma: don't release CMA pages still in use [ Upstream commit e8abc61d8a549a91c8fa639f68be2ef13d5fa63b ] When a driver calls dma_free_contiguous() before quiescing DMA, the page might still have a reference from the device. put_page_testzero() there returns false, WARN fires, but the code proceeds to free_contig_frozen_range() putting a live page onto buddy and clearing the bitmap. A subsequent allocation can hand the same PFN to a new owner while the original holder still references it. A concurrent put_page() that drops the last reference between the testzero loop and free_contig_frozen_range() can double-queue the page via page->lru, corrupting buddy lists. Avoid the corruption by not freeing a CMA region if any of the pages inside are still in use. Make it explicit in the warning that the driver allowed a leak. While at it, use page_ref_freeze() to make the semantics clearer and switch to pr_warn_ratelimited(). Fixes: 9bda131c6093 ("mm: cma: add cma_alloc_frozen{_compound}()") Cc: stable@vger.kernel.org Signed-off-by: Rik van Riel Link: https://patch.msgid.link/20260811132045.5f114772@fangorn [ david: use page_ref_freeze() + pr_warn_ratelimited() ] Acked-by: Lorenzo Stoakes (ARM) Acked-by: Muchun Song Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-45-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 1dd99ffea63f3ef82fda213beb3b9b2f9dc41674 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:40:13 2026 +0100 mm/vma: don't leak the charge for stack growth [ Upstream commit b1ee87802111156e27557e82acc31fa7dfc76e2a ] acct_stack_growth() charges stack expansion even without VM_ACCOUNT. This can happen for read-only or MAP_NORESERVE mappings created with MAP_GROWSDOWN. Unmapping these VMAs does not release the charge, leaking Committed_AS. Only check and charge growth for VM_ACCOUNT VMAs, matching mremap(). Unaccounted growth skips the overcommit check while remaining subject to the other stack-growth limits. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Pedro Falcato Reviewed-by: Harry Yoo (Meta) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-44-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 4636bc02303032f20710d97f40adb8f4eed22a66 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:40:12 2026 +0100 mm/huge_memory: split huge PUDs when adjusting VMA boundaries [ Upstream commit 23e570927421d569fdc510d5f3f29542a43eeda5 ] PFN mappings such as VFIO PCI BAR mappings can use PUD leaves while allowing VMA splits at page granularity. However, vma_adjust_trans_huge() only handles PMDs. After faulting a writable PUD-sized VFIO BAR mapping, changing its first page to read-only with mprotect() makes the PMD walk treat the PUD leaf as a PMD table. Applying MADV_DONTFORK to the first PMD-sized chunk leaves the PUD spanning two VMAs: the PMD-aligned boundary skips splitting. Walk the page tables once at each adjusted boundary and split a huge PUD or PMD leaf as needed. Handle PUD leaves even when the boundary is PMD-aligned. Fixes: f9e54c3a2f5b7 ("vfio/pci: implement huge_fault support") Cc: stable@vger.kernel.org Tested-by: Muhammad Usama Anjum Reviewed-by: Kiryl Shutsemau (Meta) Link: https://patch.msgid.link/20261031-fixes_core-v3-43-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 456932cdc6eda70b5ad4c628556098846699ab03 Author: Chris Mason Date: Sat Oct 31 10:40:11 2026 +0100 mm/vma: call ->may_split() before a partial merge [ Upstream commit 0193e83368022a308d19ee0293f55a4f5d548e40 ] A driver can use the ->may_split() hook to forbid a VMA boundary at certain addresses. A device-dax device is a character device that gives raw access to a range of memory through mmap(). device-dax refuses any address that is not a multiple of the device's alignment through vm_ops->may_split. vma_merge_existing_range() can move boundaries, but does not call vm_ops->may_split. If a range at the edge of a VMA gets the attributes of the adjacent VMA, the function moves only that range over to the neighbour: one VMA shrinks and the other grows. This is a partial merge, and vma_modify() tries it before any split. Take a device-dax VMA that lies next to another VMA of the same file. The user calls mprotect() on the one page of the first VMA that touches the second VMA, and asks for the protection that the second VMA already has. The result is a partial merge. It puts the boundary inside a 1 GiB mapping, which is a single leaf entry at the PUD level. As part of the merge, the kernel looks for a huge PMD to split at the new boundary. That code does not expect a PUD leaf: vma_merge_existing_range() commit_merge() vma_adjust_trans_huge() split_huge_pmd_address() mm_find_pmd() treats the PUD leaf as a pointer to a PMD table, so the "table" is the device memory that the leaf maps __split_huge_pmd() reads a PMD that the user wrote to the device memory folio_put() on the folio that this PMD names Bad. While the code must at some point be taught to split PUD entries as well, the issue here is that we move VMA boundaries such that they are incompatible with the driver. Fix this by calling ->may_split() on the address that a partial merge would move the boundary to, and by abandoning the merge if the driver refuses. vma_modify() then tries the split, which fails with -EINVAL. Factor out existing split handling into check_split() and reuse it. Fix generated by an LLM and sent by Chris Mason in private. Fixes: 38607c62b34b ("fs/dax: properly refcount fs dax pages") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Reviewed-by: Lorenzo Stoakes (ARM) [ david: improve description; cleanup the code ] Reviewed-by: Gregory Price (Meta) Tested-by: Gregory Price (Meta) Signed-off-by: Gregory Price (Meta) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-42-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit cc4b71683ee9d8d4ed0b25c0744314005fb3e395 Author: Chris Mason Date: Sat Oct 31 10:40:10 2026 +0100 mm/ksm: check large swap-cache folios before mapping them [ Upstream commit 7f2c000ffb1047b476cbf267f741272c389d3e31 ] KSM folios are always small, but their shared swap slots can be read back as part of a large folio in the swap cache. ksm_might_need_to_copy() skips large folios, so another process can map a page with an incompatible anon_vma or page index. Reverse mapping then cannot find the new mapping, preventing migration or reclaim. Apply the same compatibility checks to large folios as to small ones. Pass the page corresponding to the swap entry and copy only that page when necessary. In do_swap_page()'s copy path, decrement only that slot's swap count, because the source swap-cache folio can now be large. Fix generated by an LLM and sent by Chris Mason in private. Fixes: f1879e8a0c60 ("mm, swap: never bypass the swap cache even for SWP_SYNCHRONOUS_IO") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Reviewed-by: Lorenzo Stoakes (ARM) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-41-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 85260730efefc48111603fa865d224bae1f5447a Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:40:09 2026 +0100 mm/ksm: fix use of a freed anon_vma at swap-in [ Upstream commit 4c2dec1dce368ad9e9b1814307cb5ef3832fa07e ] A folio read from a swap slot previously shared by KSM can remain in the swap cache after the process that first mapped it exits. Its anon_vma can then be freed, so ksm_might_need_to_copy() must not dereference it to compare roots. Doing so can result in some false-positives, resulting in the reverse mapping missing the new folio mapping, preventing migration and reclaim. SLAB_TYPESAFE_BY_RCU allows individual anon_vma objects to be reused immediately after freeing. A stale pointer can then refer to another anon_vma whose root matches, even though the target VMA is not linked to that anon_vma. Move the anonymous rmap compatibility checks into folio_anon_rmap_compatible(). Keep the page-index check and compare the folio's anon_vma pointer against the VMA's own anon_vma and root first. If neither matches, bite the bullet and walk the VMA's anon_vma_chain. The VMA keeps these anon_vmas alive, and finding a match guarantees that reverse mapping can find the new mapping. Lorenzo Stoakes says in a private discussion: "This isn't quite equivalent to the existing check. Every anon_vma in an anon_vma_chain shares the same root, but if you split a VMA then fork both of them like this: VMA A / \ VMA B VMA C \ / root <- anon_vma 1 ----^ ^---- / parent \ anon_vma 2 anon_vma 3 | | VMA D VMA E VMA's D and E both get their own new anon_vma's such that: VMA D: anon_vma 2 -> anon_vma 1 -> root VMA E: anon_vma 3 -> anon_vma 1 -> root And if you found a folio referencing anon_vma 2, the existing check: anon_vma->root == vma->anon-vma->root Would be true for VMA's B, C, D & E. However after your change it'd be true for VMA D only, as it's the only one with anon_vma 2 in its anon_vma_chain. Whether or not that could actually happen in practice... 🙂 I don't know. [...] after your change it'd be true for VMA D only, as it's the only one with anon_vma 2 in its anon_vma_chain. [...] I would [...] say that you are making the test stricter but more correct. " If this affects performance when KSM was never even involved, we could just track whether KSM ever merged anything and just skip these checks. There isn't really a lot we can do otherwise: for mapped folios we might be able to use folio_get_anon_vma(), but for unmapped folios there really is no easy way to see if the anon_vma is still valid. Document the (confusing) lifetime requirements of folio_anon_vma(). Fixes: ba6f0ff3981e ("ksm: fix ksm swapin time optimization") Cc: stable@vger.kernel.org Reported-by: Chris Mason Reviewed-by: Lorenzo Stoakes (ARM) Acked-by: Xu Xin Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-40-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 31a2ba635adae60d23f744db2fef7ad318cdafa1 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:40:08 2026 +0100 mm/ksm: reset the unstable trees of all nodes [ Upstream commit 890e118e95bfc2aae4432ec2a95192d6f9193211 ] Each full scan resets ksm_nr_node_ids unstable tree roots. Enabling merge_across_nodes resets this count to 1, even if per-node roots were previously allocated. So when toggling "merge_across_nodes" 0 -> 1 -> 0, a scan that starts while the setting is 1 and continues after switching back to 0 can encounter stale unstable tree roots, resulting in UAF. Only root is allowed to change "merge_across_nodes", and the documented sequence is: "merge_across_nodes setting can be changed only when there are no ksm shared pages in the system: set run 2 to unmerge pages first, then to 1 after changing merge_across_nodes, to remerge according to the new setting." Let's fix it by tracking in ksm_nr_node_ids the actual number of allocated tree roots. remove_all_stable_nodes() and ksm_check_stable_tree() will now scan more tree roots (skipping the empty ones), which is harmless. Fixes: ef53d16cded7 ("ksm: allocate roots when needed") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Acked-by: Lorenzo Stoakes (ARM) Reviewed-by: Pasha Tatashin Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-39-d6437171ecc3@kernel.org Reviewed-by: Xu Xin Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 3627d4eaa7f4426b979d497544ce23cb8884134b Author: Chris Mason Date: Sat Oct 31 10:40:07 2026 +0100 mm: fix deadlock of mremap() against UFFDIO_MOVE [ Upstream commit d03df42ddae196f20e9cfb775704e60269eb6b44 ] With per-VMA locks, UFFDIO_MOVE can run concurrently with mremap() on different VMAs in the same mm. Those VMAs can share page tables, so both operations can acquire the same pair of page-table locks. UFFDIO_MOVE orders the locks by address, while mremap() takes the source lock first. These conflicting orders can deadlock; mremap() holding mmap_lock for writing no longer helps. Move double_pt_lock() and double_pt_unlock() to mm/internal.h and use them for all page-table moves in mremap(). Preserve the source entry checks after acquiring both locks. Remove the comments claiming that exclusive mmap_lock makes lock ordering irrelevant. In move_ptes(), make sure to just recheck source and destination PMD after taking the locks and drop the overly-long comment. Fix generated by an LLM and sent by Chris Mason in private. [ david: use new helpers consistently; simplify description and comments; move_ptes() fixup ] Fixes: 867a43a34ff8 ("userfaultfd: use per-vma locks in userfaultfd operations") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Reviewed-by: Lorenzo Stoakes (ARM) Acked-by: Muchun Song Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-38-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit a9756f83b8a84b1f50c6af48aeabe9eb6429bcb1 Author: Chris Mason Date: Sat Oct 31 10:40:06 2026 +0100 mm: fix unkillable fault loop on MAP_DROPPABLE memory [ Upstream commit 9f02ca8c15a74bc9e4e8e05ec089f63cb87cbf75 ] handle_mm_fault() suppresses VM_FAULT_OOM for VM_DROPPABLE mappings. For user-mode faults, pending signals are processed before retrying the access. Kernel-mode faults on user buffers instead return directly to the faulting instruction. With persistent allocation failures (esp. memcg limits), a syscall, such as write(), can therefore loop while not dropping locks. Only suppress VM_FAULT_OOM when FAULT_FLAG_USER is set, allowing kernel-mode faults and GUP to fail and signal allocation errors. Fix generated by an LLM and sent by Chris Mason in private. Fixes: 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Reviewed-by: Lorenzo Stoakes (ARM) [ david: simplify description ] Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-37-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 67e6d5468a7d693a00176713d44267e5360d63c3 Author: Josef Bacik Date: Sat Oct 31 10:40:05 2026 +0100 mm: fix unmap_mapping_range() beyond 4 GiB on 32-bit [ Upstream commit 7a81bc23dade8082187be6d9cc36e4be4b7207e2 ] Commit 9eab0421fa94 ("mm: fix unmap_mapping_range high bits shift bug") made holebegin and holelen unsigned before they are shifted, by casting them to pgoff_t. That is an unsigned long: on a 32-bit kernel the cast cuts off the upper half of the two loff_t values, so a hole which begins at 4 GiB or beyond is taken for one in the first 4 GiB of the file. truncate_pagecache() passes the new size of the file and asks for private COWed pages to be unmapped as well. If a file of 6 GiB is truncated to 5 GiB, everything from 1 GiB on is unmapped, and what a process has written to a private mapping of the range between 1 GiB and 5 GiB is lost: it reads the contents of the file again. Where the range has an end, the wrong range is unmapped instead of the right one. The page cache copes with that, as it unmaps every folio that it removes. The callers which only have unmap_mapping_range() to get rid of user mappings do not, for example drm_vma_node_unmap(), whose fake offsets reach beyond 4 GiB on 32-bit, and revoke_iomem() with physical addresses of more than 32 bits. Cast to u64 instead. Nothing changes for 64-bit kernels. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: 9eab0421fa94 ("mm: fix unmap_mapping_range high bits shift bug") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik Acked-by: Lorenzo Stoakes (ARM) Reviewed-by: Pedro Falcato Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-36-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 649937cf1df6c70b8e5b0cd13a34945c547235d1 Author: Chris Mason Date: Sat Oct 31 10:40:04 2026 +0100 mm/memory: reject remote COW faults on PFN mappings [ Upstream commit 8db6921cc07b74197a3866d62ed262b68aeadcf3 ] When handling a COW fault without a normal source page (PFN mappings), __wp_page_copy_user() copies from the faulting user address. For remote faults, this accesses the wrong address space, resulting in wrong data getting copied. For example, user_events updates an enable bit in the registering process's memory. If that memory needs to be faulted in, user_event_enabler_fault_fixup() calls fixup_user_fault() from a work item. Placing the enable bit in a private PFN mapping can trigger this remote COW path. Reject these faults with VM_FAULT_SIGBUS when the target mm differs from current->mm: remote faults. Ordinary (non-PFN) mappings are not affected. The user-address copy dates back to commit 6aab341e0a28 ("mm: re-architect the VM_UNPAGED logic"); likely, actual ways to get remote faults in there on COW PFN mappings appeared afterwards. But the fix is simple and straight forward. Fix generated by an LLM and sent by Chris Mason in private. Fixes: 6aab341e0a28 ("mm: re-architect the VM_UNPAGED logic") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Reviewed-by: Lorenzo Stoakes (ARM) [ david: simplify comment and description ] Reviewed-by: Pedro Falcato Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-35-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 64f273b71bf714dd22b803a87d65bb40faaffcad Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:40:03 2026 +0100 mm/madvise: fix data loss from MADV_FREE on a KSM page [ Upstream commit 22d043c1da48d6c7274f9dd900714b6d58b7b9c6 ] MADV_FREE can clear the dirty flag of a singly mapped KSM folio. The folio remains in the stable tree and can gain new mappings without being dirtied again. Once marked lazyfree, reclaim can discard data that those mappings still need. KSM always marks a folio dirty when converting it to a KSM folio in try_to_merge_one_page(). Marking a folio lazyfree clears PG_swapbacked but leaves PG_dirty unchanged. Preserving PG_dirty makes reclaim restore PG_swapbacked instead of discarding the folio. This also protects folios that were already lazyfree when KSM converted them. Skip KSM folios before clearing their dirty flag, checking under the folio lock to serialize with KSM conversion. Fixes: 854e9ed09ded ("mm: support madvise(MADV_FREE)") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Xu Xin Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-34-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 341816b6d716f5b9d1d84934e22e65d4ebd6422c Author: Josef Bacik Date: Sat Oct 31 10:40:01 2026 +0100 mm/mremap: fix moving PUD leaves [ Upstream commit 440c8779757f09f290770b1d361dc1516a9d0b3e ] pud_none_or_clear_bad() only really works on page tables. PUD leaves confuse the check and make us clear the page table entry and print a warning. Since commit aed877c2b4257 ("device/dax: properly refcount device dax pages when mapping"), this also leaks device-DAX folio references, mapcounts and RSS accounting, resulting in "Bad rss-counter state" warnings on exit. Allow PUD leaves in get_old_pud(). If a PUD leaf cannot be moved as a whole or the move fails, split it. This unmaps it with proper accounting instead of treating the leaf entry as a PMD table. Keep using pud_trans_huge() for now, in the future this code should be cleaned up to just check for PUD leaves. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: a00cc7d9dd93 ("mm, x86: add support for PUD-sized transparent hugepages") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik Reviewed-by: Lorenzo Stoakes (ARM) [ david: fallthrough after splitting ] Reviewed-by: Pedro Falcato Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-32-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 43617ca336fbf67634ce38fa34e9afa8bc75d8de Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:40:00 2026 +0100 mm/mremap: recheck PUDs under the page table lock [ Upstream commit 402882943dfa8bab5c2bcc66189f9fb2828f248e ] Once get_old_pud() is fixed to accept PUD leaves, unmap_mapping_range() can clear a leaf between the lookup and the move. Holding mmap_lock in write mode does not prevent this. If the zap happens before move_page_tables() tests the entry, an empty PUD can reach move_normal_pud(), where pud_populate() turns it into a present page table entry. If it happens after the test, move_huge_pud() can instead try to move an empty entry, triggering CONFIG_DEBUG_VM warnings on powerpc. Recheck the source under the page table lock in both helpers. Treat an empty source in move_normal_pud() as a completed move, and use __pud_trans_huge_lock() in move_huge_pud(). In the future we should likely have the code lookup a PUD/PMD lockless once, instead of multiple times, because one of the problematic bits here is the: pud_trans_huge(*old_pud) Fixes: 0881ace292b6 ("mm/mremap: use pmd/pud_poplulate to update page table entries") Cc: stable@vger.kernel.org Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Pedro Falcato Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-31-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 03d4251b6a010f1cafce2686162f73fff57cfda5 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:59 2026 +0100 mm/mremap: use pudp_huge_get_and_clear() when moving huge PUDs [ Upstream commit b4417d08034a7b4a3083e0e2d95429d4542524f2 ] move_huge_pud() reads the old PUD and clears it in separate operations. Hardware accessed or dirty updates between those operations can be lost when the saved entry is installed at the new address. The raw pud_clear() also bypasses page_table_check_pud_clear(), while set_pud_at() accounts for the destination mapping. This leaves the checker counts unbalanced for mappings tracked by page table checking. To fix it, simply use pudp_huge_get_and_clear(). Fixes: 7d846db7d0e2 ("mm/mremap: convert huge PUD move to separate helper") Cc: stable@vger.kernel.org Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Pedro Falcato Reviewed-by: Dev Jain Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-30-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 0d9450d006506d2af7016afd435b9c1a24985d02 Author: Chris Mason Date: Sat Oct 31 10:39:58 2026 +0100 mm/mmu_notifier: set ->mm only after mmgrab() [ Upstream commit 5ad9e4b0f1104f5dbfb41125c34bb30ea6dc7a94 ] Radeon uses a non-NULL notifier->mm to decide whether to call mmu_interval_notifier_remove() when freeing a buffer object. __mmu_interval_notifier_insert() sets ->mm before validating the range, so a wrapping userptr range can leave ->mm set after insertion fails. Cleanup then tries to remove an unregistered notifier for which no mm reference was acquired. Set ->mm only after mmgrab(), once insertion can no longer fail. While we could fix radeon's code instead, setting ->mm on success only makes the code more robust. Fix generated by an LLM and sent by Chris Mason in private. Fixes: 3506ff69c3ec ("drm/radeon: use mmu_interval_notifier_insert") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason [ david: simplify description ] Reviewed-by: Gregory Price (Meta) Tested-by: Gregory Price (Meta) Reviewed-by: Lorenzo Stoakes (ARM) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-29-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 9439da3fa1ac9a7bdc4a2d3729a5bd0c2660c1b9 Author: Josef Bacik Date: Sat Oct 31 10:39:57 2026 +0100 mm/mmu_notifier: finish non-blocking interval invalidation on error [ Upstream commit 6d65925777ecae9d7a571a327e41c63f3940a0c7 ] When an ordinary MMU notifier rejects a non-blocking invalidation, the interval invalidation started beforehand is left unfinished: the caller skips mmu_notifier_invalidate_range_end(). Subsequent interval notifier operations can then wait forever. The only in-tree trigger is nouveau SVM, which uses both notifier types and rejects non-blocking invalidations. Reaping via the OOM reaper or process_mrelease() can therefore leave the GPU fault worker stuck, holding a reference that prevents the dying process's address space and memory from being freed. End the interval invalidation when an ordinary notifier fails a non-blocking invalidation, like mn_itree_invalidate() already does when an interval notifier fails. Make that handling clearer in the documentation of mmu_notifier_invalidate_range_start_nonblock(). Fix generated by an LLM and sent by Josef Bacik in private. Fixes: 99cb252f5e68 ("mm/mmu_notifier: add an interval tree notifier") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik [ david: simplify description, update function doc ] Acked-by: Lorenzo Stoakes (ARM) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-28-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 3647c49f164004458b5e767deed033bc13a25a2d Author: Josef Bacik Date: Sat Oct 31 10:39:56 2026 +0100 mm/mmu_gather: fix flushing ranges with 4 GiB or larger [ Upstream commit 64ae7959a1df8af8eec504e31df2ec9670424a4e ] __tlb_adjust_range() takes the size of the range which has to be flushed as an unsigned int. Its callers, tlb_flush_{pte,pmd,pud,p4d}_range(), get and pass an unsigned long. Consequently, a range that is 4 GiB or larger gets truncated, possibly to 0. On arm64 with hugetlb, a 64k kernel can have 16 GiB hugetlb folios mapped contiguously at the PMD level and flush them when unmapping, and a 16k kernel can flush 64 GiB PUDs through tlb_unshare_pmd_ptdesc(). So at least these two scenarios are affected. Fix it by flushing the proper range instead of the truncated one by properly using "unsigned long" for range_size. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: b528e4b6405b ("mm/hugetlb: add tlb_remove_hugetlb_entry for handling hugetlb pages") Fixes: 8ce720d5bd91 ("mm/hugetlb: fix excessive IPI broadcasts when unsharing PMD tables using mmu_gather") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik Acked-by: Lorenzo Stoakes (ARM) [ david: use two-tab indent, simplify description ] Reviewed-by: Qi Zheng Reviewed-by: Gregory Price (Meta) Tested-by: Gregory Price (Meta) Reviewed-by: Dev Jain Reviewed-by: Muchun Song Reviewed-by: Pedro Falcato Reviewed-by: SJ Park Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-27-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit aa6ada255b259866579212acdb395908433c5f2d Author: Josef Bacik Date: Sat Oct 31 10:39:53 2026 +0100 mm/userfaultfd: wake all waiters on unregister [ Upstream commit 3afb19d68cc5e7851fdb1069c8094af97bd80417 ] UFFDIO_UNREGISTER only wakes pending faults if VM_UFFD_MISSING is set. Threads waiting on write-protect, minor or RWP faults can therefore remain asleep after unregistering a range that does not track missing faults. Wake pending faults regardless of the registration mode so they can retry without an explicit UFFDIO_WAKE or closing the userfaultfd. This matches the existing behavior for missing faults, including removing unread fault messages for the woken waiters. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: 63b2d4174c4a ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik [ david: rebase; simplify description ] Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Lorenzo Stoakes (ARM) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-24-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 8a47f699a5c184071bb1dc52f08f98c85bfb85a3 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:52 2026 +0100 mm/userfaultfd: write-lock the VMA before waking waiters when unregistering [ Upstream commit 35f7ecd55ce7e51cb6d5ef49e6dd51f3c80f61e4 ] userfaultfd_unregister() wakes pending missing faults before clearing the VMA's userfaultfd registration. With per-VMA fault locking, holding mmap_lock for write does not prevent another fault from queuing after the wakeup but before userfaultfd_clear_vma() write-locks the VMA. That waiter can then remain asleep indefinitely. Call vma_start_write() before waking waiters. Existing fault handlers queue themselves before dropping the VMA read lock, and new readers are excluded until mmap_write_unlock(). Fixes: 29a22b9e08d7 ("mm: handle userfaults under VMA lock") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Suren Baghdasaryan Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-23-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 063cd7c398fb837d811a72e19a6f71df9f104d9b Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:51 2026 +0100 mm/gup: check for overflow when converting nr_pages to bytes in GUP-fast [ Upstream commit 21a3888d3d2f87b7f15ccea1f0befd57346fe899 ] The overflow check in gup_fast_fallback() only covers the addition to start. The preceding nr_pages << PAGE_SHIFT can already have truncated the length on 32bit. Users such as RapidIO's rio_dma_transfer() can derive such page counts from a 64-bit userspace length. Let's just check_shl_overflow() to reject any such overflow with -EOVERFLOW early. Fixes: c28b1fc70390 ("mm/gup: reorganize internal_get_user_pages_fast()") Cc: stable@vger.kernel.org Reviewed-by: Lorenzo Stoakes (ARM) Acked-by: Muchun Song Reviewed-by: Barry Song Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-22-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 5697a3b58722b15fcb06fb30368ce9f46458a95a Author: Chris Mason Date: Sat Oct 31 10:39:50 2026 +0100 mm/gup: fix out-of-bounds write for nr_pages == 0 in GUP-fast [ Upstream commit 1dfe4b276c23189394afb42d114ee8a54cc3aff2 ] With nr_pages == 0, GUP-fast still enters its page table walk and can write past the caller's page array. The old end <= start check caught empty ranges, but was replaced with an overflow check. Users such as OrangeFS can pass a zero page count derived from a userspace-supplied length. So let's return zero for nr_pages == 0 before starting the walk, just like GUP-slow. Fix generated by an LLM and sent by Chris Mason in private. Fixes: c28b1fc70390 ("mm/gup: reorganize internal_get_user_pages_fast()") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason [ david: simplify description ] Reviewed-by: Lorenzo Stoakes (ARM) Acked-by: Muchun Song Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-21-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 65f4a8ef0adf18601c6ddbfd0e3918afffaeb890 Author: Chris Mason Date: Sat Oct 31 10:39:49 2026 +0100 mm/gup: fix clearing folios in memfd_pin_folios() [ Upstream commit c83ee2fa5a94edb2e04102b9dd4f1ee0eeb2b932 ] memfd_pin_folios() pins folios obtained directly from the page cache without checking whether they are uptodate. However, shmem fallocate() can leave newly allocated folios uncleared and not uptodate. Callers such as udmabuf can then expose uninitialized memory to userspace. Clear non-uptodate folios and mark them uptodate under the folio lock before returning them to the caller. Fix generated by an LLM and sent by Chris Mason in private. Fixes: 89c1905d9c14 ("mm/gup: introduce memfd_pin_folios() for pinning memfd folios") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason [ david: simplify description and comment ] Reviewed-by: Pratyush Yadav (Google) Reviewed-by: Samiullah Khawaja Tested-by: Samiullah Khawaja Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-20-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 9eaedd598cd25eb0e18958e2456153a4c1f3db03 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:48 2026 +0100 mm/gup: recheck the PUD under PTL in follow_pud_mask() [ Upstream commit 79cb51d538abc459f74e046d27797d36b133ce0e ] follow_pud_mask() reads the PUD without a lock. If it is a leaf, it takes the lock and calls follow_huge_pud(), which reads the entry again, but only tests whether it is present. A leaf can be zapped concurrently and a page fault can fill the empty entry with a page table. This currently only applies when device-dax makes use of PUD entries, and the fault after e.g., MADV_DONTNEED would find THPs to be disabled. That requires a sequence like 1) Fault in the PUD 2) Disable THP 3) Have GUP race against concurrent MADV_DONTNEED + refault Which is rather unlikely to happen in practice, which is why we never received a report about such a problem. Before commit 1b1676180246 ("mm/gup: handle huge pud for follow_pud_mask()"), we performed that check in follow_devmap_pud() by testing for pud_devmap(). Let's fix it by just structuring follow_pud_mask() similar to follow_pmd_mask(), minus protnone stuff that does not apply and minus FOLL_SPLIT_PMD handling. That makes it much easier to spot any such inconsistencies. Perform the pud_bad() check early in follow_pmd_mask() and just forward the PUD value. We can drop the pud_present() check in follow_huge_pud(), just like we have in follow_huge_pmd(). Even though we are performing more changes than strictly necessary, the fix should be easy to backport. Fixes: 1b1676180246 ("mm/gup: handle huge pud for follow_pud_mask()") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-19-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 1f54708f40b8dea6951426ca567fc96160693388 Author: Chris Mason Date: Sat Oct 31 10:39:46 2026 +0100 mm/khugepaged: preserve dirty bits when collapsing PTE-mapped THPs [ Upstream commit fe2817e3d5ea347214342c9a5cd8bcbff20c0574 ] try_collapse_pte_mapped_thp() clears PTEs without transferring their dirty bits to the folio. A shmem read fault can map a clean folio writable, so a later store only dirties the PTE. Losing that dirty bit allows reclaim to discard modified data. The assumption that regular files are read-only is also obsolete since commit 1b6444331bebb ("mm/khugepaged: enable clean pagecache folio collapse for writable files"). In any case, transferring PTE dirty bits to the folio when removing mappings (and while the folio is still mapped) is the right thing to do. Use get_and_clear_ptes() to collect the dirty bits and mark the folio dirty before unmapping it. Update the comment. This was reproduced with shmem using MADV_COLLAPSE followed by MADV_PAGEOUT. Fix generated by an LLM and sent by Chris Mason in private. Fixes: 27e1f8273113 ("khugepaged: enable collapse pmd for pte-mapped THP") Fixes: 1b6444331bebb ("mm/khugepaged: enable clean pagecache folio collapse for writable files") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason [ david: adjust comment; simplify description; cover file-thp as well ] Reviewed-by: Pedro Falcato Reviewed-by: Gregory Price (Meta) Tested-by: Gregory Price (Meta) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-17-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Reviewed-by: Baolin Wang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit ad5e5800ce560759c8d3c10aac15b48a06cd21c1 Author: Josef Bacik Date: Sat Oct 31 10:39:45 2026 +0100 mm/khugepaged: fix PMD table lock leak in try_collapse_pte_mapped_thp() [ Upstream commit db38b902307e687219ec765ef51a6ef459746c87 ] For a private mapping with userfaultfd, try_collapse_pte_mapped_thp() takes the PMD table lock before it maps the page table for the second time. If that (pte_offset_map_rw_nolock) fails, because the page table vanished in the meantime due to concurrent page table reclaim, it leaves through the abort label, where the PMD table lock is unlocked if it differs from PTE table lock. In case the PMD table lock and the PTE table lock match, which is the case without CONFIG_SPLIT_PTE_PTLOCKS after pte_offset_map_rw_nolock() failed, we miss to unlock the PMD table. To fix it, forget the PTE table lock when we unmap+unlock the PTE table. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: 6375e95f381e ("mm: pgtable: reclaim empty PTE page in madvise(MADV_DONTNEED)") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik [ david: move the ptl = NULL handling; rewrite description, drop wrong comments ] Reviewed-by: Gregory Price (Meta) Tested-by: Gregory Price (Meta) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-16-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Reviewed-by: Baolin Wang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 9c766a46421509d5a2f46753be3964ae128bf938 Author: Josef Bacik Date: Sat Oct 31 10:39:44 2026 +0100 mm/khugepaged: always recheck the pmd in try_collapse_pte_mapped_thp() [ Upstream commit aa72cf34d90da7019591ab67533a8ece8b41da2d ] try_collapse_pte_mapped_thp() drops the PTE lock after it has cleared the page table, and takes the PMD lock and the PTE lock to remove it. In between, MADV_DONTNEED with CONFIG_PT_RECLAIM can reclaim the page table. The pmd_same() check is supposed to handle this, but it is only done with CONFIG_SPLIT_PTE_PTLOCKS. Fix it by performing the check unconditionally. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: 6375e95f381e ("mm: pgtable: reclaim empty PTE page in madvise(MADV_DONTNEED)") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik [ david: adjust description ] Reviewed-by: Gregory Price (Meta) Tested-by: Gregory Price (Meta) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-15-d6437171ecc3@kernel.org Reviewed-by: Lance Yang Reviewed-by: Baolin Wang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 2d7e94a16d0d33ce2cce5ea06cf61079c392d351 Author: Chris Mason Date: Sat Oct 31 10:39:43 2026 +0100 mm/huge_memory: fix zapping migration entries for device-private THPs [ Upstream commit 63a940541358d09cc9f02d40b71eb8d3917a21c0 ] A PMD migration entry can refer to a device-private folio. zap_huge_pmd_folio() checks the folio type instead of the entry type, so it treats such a migration entry as a device-private entry. Installing the migration entry already removed the reverse mapping and dropped the mapping reference. Zapping it must not repeat those operations. Concurrent MADV_DONTNEED during migration back to system memory can trigger this. Check the PMD entry type using pmd_is_device_private_entry(). Fix generated by an LLM and sent by Chris Mason in private. Fixes: 368076f52ebe ("mm/huge_memory: add device-private THP support to PMD operations") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason [ david: simplify description ] Reviewed-by: Gregory Price (Meta) Link: https://patch.msgid.link/20261031-fixes_core-v3-14-d6437171ecc3@kernel.org Reviewed-by: Zi Yan Reviewed-by: Lance Yang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit a5786ec7ba7967433207f20214ff75768497a2c9 Author: Chris Mason Date: Sat Oct 31 10:39:42 2026 +0100 mm/huge_memory: fix truncate racing with PMD zapping [ Upstream commit e6a07d29b0a60f3a4cfe77fe34eeb4b3fb38d6c4 ] zap_huge_pmd_folio() removes the rmap before calling folio_mark_dirty(). If this was the last mapping, truncation can skip unmapping the folio and proceed without waiting for the PMD lock, racing with dirtying. ifs_set_range_dirty() can oops if MADV_DONTNEED races with ftruncate() on XFS, when we get the folio set dirty after it was found to not be mapped anymore. Move folio_mark_dirty() and folio_mark_accessed() before rmap removal, matching the PTE zap path. This keeps the folio mapped while updating its state, so truncation must wait for the page table lock. Fix generated by an LLM and sent by Chris Mason in private. Fixes: fe6cf984939d ("mm/huge_memory: transfer the pmd dirty bit to the folio on zap") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason [ david: simplify comment and description ] Reviewed-by: Gregory Price (Meta) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-13-d6437171ecc3@kernel.org Reviewed-by: Zi Yan Reviewed-by: Baolin Wang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 9fa47708a46ad4514d28cf850d5c6e90a49406c5 Author: Liu Changjie Date: Mon Oct 19 00:46:34 2026 +0800 can: peak_usb: pcan_usb_fd_decode_buf(): accept short uCAN end-of-list records [ Upstream commit 2d4c272e816a5b784f1fc7899256f8826df34edb ] A PCAN-USB FD v2 running firmware 3.2.0 sends a 16-byte status record followed by a four-byte zero-size end marker. Since commit 93fcab2c6968 ("can: peak_usb: validate uCAN receive record lengths") these transfers cause repeated receive-buffer dumps while the interface is up. This has been observed on Linux 7.2.11-arch1-1 with matching kernel headers: - Classic CAN, 500 kbit/s: 25 decoder errors in 5 s before the fix; none in 15 s after. - CAN FD, 500 kbit/s nominal and 2 Mbit/s data: 26 decoder errors in 5 s before the fix; none in 60 s after. - Three additional down/up cycles: no decoder errors. pcan_usb_fd_decode_buf() requires a complete 12-byte struct pucan_msg before checking the size field, so it rejects the end marker with -EBADMSG. Check that the size field is present before testing for an end marker. Require the full header for nonzero-size records and keep the remaining record and payload length checks. This patch was created with LLM assistance. Fixes: 93fcab2c6968 ("can: peak_usb: validate uCAN receive record lengths") Signed-off-by: Liu Changjie Reviewed-by: Stéphane Grosjean Link: https://patch.msgid.link/CH5PR19MB997156AB3BE253C3BE445223B0AC992@CH5PR19MB997156.namprd19.prod.outlook.com Cc: stable@vger.kernel.org [mkl: copy additional info to commit message] [mkl: convert Assisted-by: tag to prose] Signed-off-by: Marc Kleine-Budde commit 0a6f6dcf4c9c03c74de17453bef21697cbff4dc3 Author: ChunYuZhiQiang Date: Tue Oct 27 14:50:11 2026 +0800 can: dev: can_fill_info(): don't wake up controller if interface is down [ Upstream commit 75332c410c8190d61499001c5516af977ca426c3 ] If the interface is down, the CAN controller might be powered down and its clocks gated. Don't call do_get_berr_counter() to read the bus error counters if the interface is down, and adjust can_get_size() to match. This removes one trigger for a synchronous external abort seen on i.MX8QXP when "ip link show" is run on a flexcan interface that was never brought up. The underlying cause is platform-specific: on i.MX8QXP the CAN clocks are gated through the SCU LPCG and the subsystem shares the IMX_SC_R_CAN_0 power domain, and there is a window after pm_runtime_resume_and_get() returns where the clock has not reached the module yet. This patch avoids the netlink query path while the interface is down, but does not root-cause the LPCG window itself. As a result, IFLA_CAN_BERR_COUNTER is no longer reported for down interfaces. Userspace must treat the attribute as optional. The issue was triggered on an i.MX8QXP board by running "ip link show" without ever bringing the interface up: Internal error: synchronous external abort: 0000000096000210 pc : flexcan_read_le+0x0/0x18 lr : flexcan_get_berr_counter+0x4c/0x8c Call trace: flexcan_read_le+0x0/0x18 flexcan_get_berr_counter+0x4c/0x8c can_fill_info+0x1f8/0x434 rtnl_fill_ifinfo+0x8fc/0xbb4 rtnl_dump_ifinfo+0x364/0x448 This is the same class of problem fixed for m_can in commit 91a55c72a821 ("can: m_can: m_can_get_berr_counter(): don't wake up controller if interface is down"). Fixes: ec56acfef2af1 ("can: flexcan: flexcan_get_berr_counter(): switch on clocks before accessing ecr register") Cc: stable@vger.kernel.org Signed-off-by: ChunYuZhiQiang Reviewed-by: Vincent Mailhol Link: https://patch.msgid.link/20261027065012.191348-1-chunyuzhiqiang@yinhe.ht Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin commit 0ce168d3f8a83bb6db280cab3442b455a535620e Author: Oliver Hartkopp Date: Tue Oct 27 15:31:10 2026 +0100 can: proc: skip stats calculation after reset in can_stat_update() [ Upstream commit 01b19ed9fa031a649f3dd103ebe6e0102602e542 ] Commit 80b5f90158d1 ("can: statistics: use atomic access in hot path") introduced local snapshots of the statistics counters at the beginning of can_stat_update(). When can_init_stats() resets the statistics, these stale pre-reset snapshots are still used for the following total/current /max calculations and overwrite the freshly reset values. Additionally a jiffies tick between the snapshot and the reset could trigger a second can_init_stats() call. Merge the reset conditions into a single check and skip the calculation for the current interval when the statistics have been reset. Fixes: 80b5f90158d1 ("can: statistics: use atomic access in hot path") Cc: stable@vger.kernel.org Signed-off-by: Oliver Hartkopp Link: https://patch.msgid.link/20261027-can-rx-lock-v12-6-eb5afc2d8b9b@hartkopp.net Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin commit b59818f9081b8c5e7a64954ba300252c0d3a448b Author: Runyu Xiao Date: Tue Oct 27 15:31:09 2026 +0100 can: proc: reset pkg_stats atomics individually [ Upstream commit 12297f855bbd943847cb8893a3614caef5a9c2a8 ] Commit 80b5f90158d1 ("can: statistics: use atomic access in hot path") converted several members of struct can_pkg_stats to atomic_long_t and updated the hot TX/RX and procfs read paths to use atomic_long_*() helpers. However, can_init_stats() still clears the whole struct with memset(). can_init_stats() is reached from can_stat_update() in timer context and also from the procfs reset path. Those paths can run while the TX/RX hot paths are concurrently updating rx_frames, tx_frames, matches and their *_delta counters. Hitting the whole-struct memset() in that window performs plain writes to fields that otherwise follow an atomic_long_t access contract, which can lose or mix live statistics updates. This issue was found by source-level API-misuse analysis looking for whole-object resets left behind after atomic_long_t conversions, then manually audited on Linux v6.18.21. Replace the whole-struct memset() with a helper that resets the atomic_long_t counters via atomic_long_set() and clears the derived scalar statistics explicitly. This preserves the existing reset semantics for scalar fields while restoring atomic access discipline for the live counters. Build-tested by compiling net/can/proc.o on x86_64 netdev/main. Runtime-tested with a QEMU + vcan setup on Linux v6.18.21 by driving concurrent traffic and reset_stats reads, which reproduced inconsistent exported statistics before the fix. [Hartkopp] can_stat_update() also read the *_delta counters at the beginning and cleared them with atomic_long_set() at the end. Increments from the hot path in between were lost for both the current and the next interval. Use atomic_long_xchg() to fetch and clear the *_delta counters in one atomic step instead. On x86_64 atomic_long_set() is a plain store like memset(), so the memset() is an actual problem only on architectures with lock-based atomics (e.g. parisc). The inconsistencies seen on x86_64 come from the *_delta handling and from the stale snapshots, which are fixed in "can: proc: skip stats calculation after reset in can_stat_update()". As before, the counters are reset one at a time and the derived scalar statistics use plain stores. Fixes: 80b5f90158d1 ("can: statistics: use atomic access in hot path") Cc: stable@vger.kernel.org Signed-off-by: Runyu Xiao Acked-by: Oliver Hartkopp Signed-off-by: Oliver Hartkopp Link: https://patch.msgid.link/20261027-can-rx-lock-v12-5-eb5afc2d8b9b@hartkopp.net Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin commit 12b2ddd7d01b7e5ec466c128ff862197d59c2440 Author: Oliver Hartkopp Date: Tue Oct 27 15:31:08 2026 +0100 can: raw, isotp: copy socket options outside of lock_sock() [ Upstream commit 43c973a0887d3d7b2ee0a446603c97bf0f38c58e ] The CAN_RAW and CAN_ISOTP specific socket options are copied from and to user space while holding lock_sock(). A copy that faults or stalls, e.g. on a userfaultfd or FUSE backed mapping, holds lock_sock() for its whole duration. raw_notify() and isotp_notify() take lock_sock() of a socket that is bound to the vanishing device while holding RTNL. As the CAN_RAW options can also be changed on a bound socket, a stalled copy can block RTNL on an unregistration or namespace change of the bound device. Before "can: protect the receive lists with a per-device lock", raw_setsockopt() even held RTNL itself during the copy. CAN_ISOTP only copies its options for unbound sockets, which isotp_notify() skips without taking lock_sock(). Keep the user space copies out of the locked sections: Check the option name and length and copy the option values, including the CAN_RAW_FILTER filters, to kernel memory before lock_sock(). raw_setsockopt_locked() and isotp_setsockopt_locked() get the copied values directly and drop their now redundant length checks and copies. As a side effect, a failing copy can not leave partially overwritten options behind anymore. In raw_getsockopt() duplicate the filters under lock_sock() and copy them to user space after release_sock(). As the option name and length are now checked before lock_sock(), the order of the checks in isotp_setsockopt() and accordingly the order of the returned error values changes. This is in line with POSIX, which does not define an order in which multiple error conditions are detected and reported. The generic SOL_SOCKET options in sk_setsockopt() are not affected by this patch. Fixes: c18ce101f2e4 ("[CAN]: Add raw protocol") Fixes: 1e5185c09058 ("can: raw: add locking for raw flags bitfield") Cc: stable@vger.kernel.org # depends on "can: protect the receive lists with a per-device lock" Signed-off-by: Oliver Hartkopp Link: https://patch.msgid.link/20261027-can-rx-lock-v12-4-eb5afc2d8b9b@hartkopp.net Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin commit 228e795ec650c33ebbce8ba81ce983c84d64d889 Author: Oliver Hartkopp Date: Tue Oct 27 15:31:07 2026 +0100 can: protect the receive lists with a per-device lock [ Upstream commit 0f3ad9ab40e3dad06d5c0693806e07935ceedbc3 ] The receive lists of a CAN device are located in the device's can_ml_priv and travel with the device when it is moved to another network namespace. But they are protected by the per-netns rcvlists_lock. So can_rx_unregister() needs dev_net(dev) to pick the right lock and silently returns when the passed namespace does not match dev_net(dev) anymore. isotp_release() and bcm_release() leave their notifier list before they take any lock that serializes against the netdev notifier, which runs under RTNL. When the bound device is moved to another namespace in this window, the notifier skips the socket and the release path has to remove the filters itself. isotp_release() passes the socket's namespace, which does not match dev_net(dev) anymore. bcm_rx_unreg() passes dev_net(dev), which can_rx_unregister() reads again for its check, so a namespace change between both reads makes the check fail as well. In both cases can_rx_unregister() silently returns. As can_rx_register() stores rcv->sk without a reference, the remaining receivers point to the freed socket (isotp) or the freed op (bcm): BUG: KASAN: use-after-free in isotp_rcv+0x1570/0x24d0 Read of size 1 at addr ffff888118130552 by task isotp_ns_uaf/578 can_rcv_filter+0x4af/0x8c0 can_receive+0x28d/0x3c0 can_rcv+0x2a9/0x310 __netif_receive_skb_one_core+0x21a/0x260 process_backlog+0x210/0x760 Besides this, the lists of a device are protected by the rcvlists_lock of the namespace that is passed in. Callers which pass dev_net(dev) read it at different times, so the same lists may be modified under the locks of different namespaces while the device is moved. Taking RTNL in these release paths is no option: raw_bind(), raw_setsockopt() and raw_release() already hold RTNL while adding and removing up to CAN_RAW_FILTER_MAX filters per socket, which unprivileged users can trigger repeatedly and which makes RTNL a global bottleneck. Instead fix the root cause and add a spinlock to struct can_dev_rcv_lists, which protects the receive lists of a CAN device or the 'any' CAN device lists of a namespace. It is initialized in can_set_ml_priv(), which is used by all CAN network devices. With this, can_rx_unregister() finds the subscription independently of the current namespace of the device. The protocols keep the device valid with their tracked references. The per-netns rcvlists_lock only protects the receive list statistics anymore, and CAN_RAW, CAN_BCM and CAN_ISOTP pass the namespace that has been used for can_rx_register(). So isotp_release() and bcm_release() now remove their filters correctly without RTNL, and raw_release(), raw_setsockopt(), raw_bind() and isotp_bind() do not need RTNL anymore and add and remove their filters under lock_sock(). To serialize bind() with NETDEV_UNREGISTER, bind() publishes the device inside the RCU section of its lookup, and raw_notify() and isotp_notify() recheck the bound device under lock_sock(). As RTNL does not keep NETDEV_DOWN out of bind() anymore, bind() checks IFF_UP after publishing the bound device, with a barrier pair against raw_notify() and isotp_notify(), so a down transition during bind() is still reported with ENETDOWN. Fixes: 20bab8b88baa ("can: isotp: fix use-after-free race with concurrent NETDEV_UNREGISTER") Fixes: 8e8cda6d737d ("can: initial support for network namespaces") Reported-by: Norbert Szetei Link: https://lore.kernel.org/linux-can/CEA6A38A-2646-4ADA-95B4-CBAE2F301A8E@doyensec.com/ Cc: stable@vger.kernel.org Signed-off-by: Oliver Hartkopp Link: https://patch.msgid.link/20261027-can-rx-lock-v12-3-eb5afc2d8b9b@hartkopp.net Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin commit e93b494daf46034c70c2285aade0e529dea956fe Author: Oliver Hartkopp Date: Tue Oct 27 15:31:06 2026 +0100 can: isotp: check the return values of can_rx_register() in isotp_bind() [ Upstream commit 874f5f14cf626f72477071eff381c8485554250d ] isotp_bind() ignores the return values of can_rx_register() for the RX and the echo receiver and binds the socket anyway. When a receiver can not be allocated, bind() succeeds without this receiver, so the socket does not receive frames or its transmissions time out. isotp_release() and isotp_notify() later try to remove the missing receiver, which triggers the "receive list entry not found" warning in can_rx_unregister(). As the device has been checked before and RTNL prevents a namespace change during bind(), only -ENOMEM can be returned here. Check the return values and register the RX receiver as the last step. The echo receiver is registered first, as it only handles the socket's own echo frames and does nothing while no transmission is in progress. So a failed RX registration only needs to remove the echo receiver, and isotp_rcv() has never processed a frame for this socket. Set so->ifindex before the registrations, so that a First Frame received before so->bound is set can be answered with a Flow Control frame and the RX timeout is started as usual. As the RX receiver is registered last, this can only happen for a bind() that succeeds. Reset so->ifindex when bind() fails. Check IFF_UP only after the receivers have been registered, so that a bind() that fails on a down device does not report ENETDOWN. As bind() holds RTNL, the device state can not change in between. Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol") Cc: stable@vger.kernel.org Signed-off-by: Oliver Hartkopp Link: https://patch.msgid.link/20261027-can-rx-lock-v12-2-eb5afc2d8b9b@hartkopp.net Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin commit 27edc672a80ae9d5e7e8aa0cc8f5e3ed2b5dab19 Author: Oliver Hartkopp Date: Tue Oct 27 15:31:05 2026 +0100 can: replace ARPHRD_CAN type checks with can_get_ml_priv() [ Upstream commit 962947b69589881167054bae5accc8abfd5aa4b6 ] Commit 4e096a18867a ("net: introduce CAN specific pointer in the struct net_device") introduced an explicit way to assign the midlayer private pointer (dev->ml_priv) to named users like ML_PRIV_CAN. A valid pointer returned by can_get_ml_priv() therefore identifies a real CAN device. The referenced commit only converted the j1939 and proc code to this check, while the other parts of the CAN subsystem still rely on dev->type == ARPHRD_CAN. The TUNSETLINK ioctl allows a down TUN/TAP device to set its hardware type to ARPHRD_CAN while dev->ml_priv remains NULL. Such a repurposed netdevice passes the ARPHRD_CAN checks. Commit 8aa59e355949 ("can: af_can: fix NULL pointer dereference in can_rx_register()") already made can_rx_register() reject such devices. But can_rx_unregister() still only checks dev->type and dereferences the NULL ml_priv when it walks the receive lists of the device. CAN_ISOTP reaches this path: isotp_bind() ignores the return values of can_rx_register() and binds the socket anyway. When the socket is released or the device is unregistered, isotp_release() and isotp_notify() remove the filters that have never been registered and trigger the NULL pointer dereference in can_rx_unregister(). This only requires owning a TUN/TAP device or CAP_NET_ADMIN in an unprivileged user namespace. Convert the remaining ARPHRD_CAN checks in af_can, bcm, gw, isotp and raw to can_get_ml_priv(). Fixes: 4e096a18867a ("net: introduce CAN specific pointer in the struct net_device") Cc: stable@vger.kernel.org Cc: Oleksij Rempel Signed-off-by: Oliver Hartkopp Link: https://patch.msgid.link/20261027-can-rx-lock-v12-1-eb5afc2d8b9b@hartkopp.net Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin commit 9bdc4d361f9b48b3ae10c497ba582ec56d134db2 Author: Cunhao Lu <1579567540@qq.com> Date: Fri Jul 31 17:45:02 2026 +0800 can: dev: can_put_echo_skb(): free skb on invalid echo index [ Upstream commit b4ebcbbf66ba6c5816dfe229effb4641c46e4b4c ] can_put_echo_skb() consumes the skb on all paths except when the echo index is out of bounds. This leaves ownership with the caller on -EINVAL, unlike the other error paths, and can leak the skb if the caller expects consistent semantics. Free the skb before returning -EINVAL so that all return paths consume it. Fixes: 6411959c10fe ("can: dev: can_put_echo_skb(): don't crash kernel if can_priv::echo_skb is accessed out of bounds") Cc: stable@vger.kernel.org Reviewed-by: Vincent Mailhol Signed-off-by: Cunhao Lu <1579567540@qq.com> Link: https://patch.msgid.link/tencent_683AA16E643DE00211CD2FB62991264DC605@qq.com Signed-off-by: Marc Kleine-Budde commit 3e42ef9c30fa1fc7222793055b48bd82224da5ea Author: Cunhao Lu <1579567540@qq.com> Date: Fri Jul 31 17:45:00 2026 +0800 can: skb: make echo skb freeing safe in any IRQ context [ Upstream commit d743071964920c92af598c87a9e6f4369263ee09 ] can_put_echo_skb() can be called with hardware interrupts disabled. Its direct drop paths use kfree_skb(), while can_create_echo_skb() uses kfree_skb() when cloning fails and consume_skb() after a successful clone. None of these helpers is safe in every IRQ context. Use dev_kfree_skb_any() for all drop paths and dev_consume_skb_any() when consuming a successfully cloned skb. This preserves the respective skb drop and consumed semantics regardless of the caller IRQ context. Signed-off-by: Cunhao Lu <1579567540@qq.com> Link: https://patch.msgid.link/tencent_E84809CF236D0137885E7E4E4D58340B3208@qq.com Cc: stable@kernel.org Fixes: ae64438be192 ("can: dev: fix skb drop check") Fixes: 0ae89beb283a ("can: add destructor for self generated skbs") Fixes: 3ccd4c6167d3 ("can: Unify droping of invalid tx skbs and netdev stats") Fixes: 39549eef3587 ("can: CAN Network device driver and Netlink interface") [mkl: also convert can_dropped_invalid_skb(), can_dev_dropped_skb()] [mkl: add stable on Cc + add Fixes tags] Signed-off-by: Marc Kleine-Budde commit 25173665a0481087bb07eac4781ddbc54322324c Author: Kaixuan Li Date: Sun Sep 20 11:56:26 2026 +0800 can: isotp: check the frame type, not just the length [ Upstream commit 933bf0fcb325e67b19c86c9c4da7f029878d5170 ] isotp_rcv() separates Classic CAN from CAN FD by skb->len alone: if (skb->len != so->ll.mtu) return; cf = (struct canfd_frame *)skb->data; A CAN XL frame with cxl->len 4 is CAN_MTU bytes, so it passes, and is then read as a canfd_frame whose len comes out of canxl_frame.flags: at least 0x80. Of the paths that follow, only the flow control one uses that length without bounding it first, so check_pad() walks to 255 over a 16-byte frame and the caller reports EBADMSG on an unrelated socket. bcm_rx_handler(), j1939_can_recv(), can_can_gw_rcv() and raw_rcv() check the frame type here, and can_dropped_invalid_skb() switches on skb->protocol on the transmit side. isotp_rcv() is the gap. Fixes: fb08cba12b52 ("can: canxl: update CAN infrastructure for CAN XL frames") Signed-off-by: Kaixuan Li Reviewed-by: Oliver Hartkopp Acked-by: Oliver Hartkopp Reviewed-by: Quchaosheng Link: https://patch.msgid.link/20260920035626.2581040-1-kaixuanli0131@gmail.com Cc: stable@vger.kernel.org Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin commit 2de9c3df452e159f82ef14ca497e5be407c66493 Author: Vincent Mailhol Date: Fri Jul 31 18:29:44 2026 +0200 can: dev: can_dropped_invalid_skb: drop CAN XL frames on non-CAN XL devices [ Upstream commit 0fce44e29fce4b07642491b098afb41bd571e4f2 ] Sending a PF_PACKET bypasses the CAN framework logic and can directly reach a CAN driver's xmit() function. The PF_PACKET framework only checks that skb->len does not exceed the net_device MTU. For a CAN device that is not CAN XL capable, anything above CANFD_MTU (72 bytes) is therefore dropped before it reaches the driver. However, CAN XL frames are variable length. can_is_canxl_skb() accepts lengths in the range CANXL_HDR_SIZE + CANXL_MIN_DLEN up to CANXL_MTU, i.e. 13 to 2060 bytes. As a result, an ETH_P_CANXL skb with a length between 13 and 72 bytes can pass both the MTU and the can_dropped_invalid_skb() checks. A driver that does not support CAN XL will interpret canxl_frame->flags as a length because of the overlap with can_frame->len. And because CANXL_XLF is set, the resulting length is between 128 and 255. For drivers that do not check can_frame->len before copying can_frame->data, as most drivers do, this results in a buffer overflow of up to 247 bytes. Drop ETH_P_CANXL skbs if the device does not have the CAN_CAP_XL capability. Keep can_is_canxl_skb() for the validation of CAN XL skbs. Closes: https://sashiko.dev/#/patchset/20260731-master-v5-0-5b27029dee20@qq.com?part=1 Fixes: fb08cba12b52 ("can: canxl: update CAN infrastructure for CAN XL frames") Signed-off-by: Vincent Mailhol Link: https://patch.msgid.link/20260731-drop_canxl_frames-v1-1-7387b70353b3@kernel.org Cc: stable@kernel.org Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin commit 884b47ced96c01e2689ee45dc42902d888c4b7f2 Author: Yingjie Wang <1075151112@qq.com> Date: Fri Oct 30 16:46:22 2026 +0800 nvmet: reject keep-alive timeouts that would overflow [ Upstream commit 96ae13f40ce5930cd58c43128e385131476f2a66 ] nvmet_set_feat_kato() and nvmet_alloc_ctrl() convert the 32-bit millisecond KATO from the host to seconds with DIV_ROUND_UP(kato, 1000). The addition in DIV_ROUND_UP() is done in 32 bits, so any KATO above 4294966296 ms wraps around and rounds to 0 seconds. A Set Features command with KATO 0xffffffff then succeeds but disables the keep-alive timer: Get Features returns 0 and Keep Alive fails with Keep Alive Timeout Invalid. A Connect command with such a KATO creates a controller without a keep-alive timer. The converted value has more consumers that can overflow. Get Features multiplies it by 1000, and the timer paths multiply it by HZ in 32 bits and arm a delay that must not exceed MAX_JIFFY_OFFSET. Reject a KATO whose rounded value does not fit all of these. Return Keep Alive Timeout Invalid from both Set Features and Connect. Validate Set Features before stopping the current timer so a failed update leaves its timeout unchanged. Round in 64 bits. A KATO of 0 keeps its current meaning. Fixes: a07b4970f464 ("nvmet: add a generic NVMe target") Cc: stable@vger.kernel.org Reviewed-by: Christoph Hellwig Signed-off-by: Yingjie Wang <1075151112@qq.com> Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit cdf5cd988fce9ad6005bad8e67a9d5f438d0ca15 Author: Christoph Hellwig Date: Wed Oct 28 09:09:39 2026 +0100 xfs: fix recovery of partial attr removals [ Upstream commit 30bb61651d2da5a502cf504bcdad16c093c1bb08 ] When running xfs/753 on parent pointer-enabled file systems with DEBUG enabled, log recovery will eventually crash after a few dozen iterations due to an ASSERT that XFS_ATTR_INCOMPLETE is not already set when xfs_attr3_leaf_setflag is called: XFS: Assertion failed: (entry->flags & XFS_ATTR_INCOMPLETE) == 0, file: fs/xfs/libxfs/xfs_attr_leaf.c, line: 3045 This is because parent pointer use logged attributes, and the attribute intents do not track the work that has been done as the transaction rolls, and the recovery mechanism is to run the operation from scratch. Because of this various places check for XFS_DA_OP_RECOVERY skip work already done. But while recovery tolerates an attribute already fully removed, it currently trips the above assert for an attribute that already has the INCOMPLETE bit set, but still exists. Fix this by handling the case like all the others. Fixes: 1d08e11d04d2 ("xfs: Implement attr logging and replay") Cc: stable@vger.kernel.org # v5.19 Signed-off-by: Christoph Hellwig Reviewed-by: Carlos Maiolino Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 52f5a5ab318f5b120eb686069fbd0108016c02b2 Author: Hyunwoo Kim Date: Fri Oct 30 06:42:17 2026 +0900 net: restore refcount ordering for lockless socket access [ Upstream commit 5b5d8f351dd96f56a58bb516a80e2d4d742fe4e2 ] Before commit fb041bb7c0a9 ("locking/refcount: Consolidate implementations of refcount_t"), default builds implemented refcount_inc_not_zero() using atomic_add_unless(), which provided full memory ordering on success. The commit removed that ordering on weakly ordered architectures, allowing accesses after a successful reference acquisition to be reordered before it. Use refcount_inc_not_zero_acquire() in the IPv4 and IPv6 established lookups and in inet_twsk_purge(), where the socket is validated again after taking a reference. bpf_sk_assign() can receive a socket pointer obtained through BTF without a reference. Use acquire ordering when it takes its own reference for a refcounted socket. Use refcount_set_release() when setting refcounts in the SYN cookie, TCP Fast Open, request migration, and TIME_WAIT paths. Keep the existing TIME_WAIT smp_wmb(), which separately orders the refcount store before ehash publication. Fixes: fb041bb7c0a9 ("locking/refcount: Consolidate implementations of refcount_t") Fixes: 27e5203bd9c5 ("bpf: Change bpf_sk_assign to accept ARG_PTR_TO_BTF_ID_SOCK_COMMON") Cc: stable@vger.kernel.org Signed-off-by: Hyunwoo Kim Reviewed-by: Kuniyuki Iwashima Link: https://patch.msgid.link/20261029214219.1035176-3-imv4bel@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit e8c7a13a7b63542753ab3c6c55b142b09d207c78 Author: Daejun Park Date: Thu Oct 29 11:23:03 2026 +0900 xfs: clamp the pNFS layout range to the maximum file size [ Upstream commit 29f3c1be4e554c9dbc66e13333034e0947477cb6 ] xfs_fs_map_blocks() lets two bad layout ranges through. An offset of 2^63 or more is negative and passes "offset > limit". A length above the limit, such as NFS4_UINT64_MAX, wraps "offset > limit - length" and stays unclamped. With NFS4_UINT64_MAX, a read layout is built from an uninitialized mapping. Reject a negative offset and one at the limit, and clamp the length. This needs "xfs: cap the block count of xfs_iomap_write_direct() at one extent". Fixes: 527851124d10 ("xfs: implement pNFS export operations") Cc: stable@vger.kernel.org Signed-off-by: Daejun Park Reviewed-by: Darrick J. Wong Reviewed-by: Pankaj Raghav Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 83e0edb26d05515083784db26a02a809371ccdb3 Author: Daejun Park Date: Thu Oct 29 11:23:02 2026 +0900 xfs: cap the block count of xfs_iomap_write_direct() at one extent [ Upstream commit 66d1ce09ebd72709f8d739630c39f440445173fd ] xfs_iomap_write_direct() reserves blocks for the whole count in an unsigned int. For a pNFS layout the client chooses that count, and an RW LAYOUTGET for 16 TiB wraps the reservation and shuts XFS down. xfs_bmapi_write() maps at most XFS_MAX_BMBT_EXTLEN blocks here, so cap the count at that. nfsd asks again for the rest. The other callers get the same mapping as before. Suggested-by: Darrick J. Wong Suggested-by: Christoph Hellwig Suggested-by: Pankaj Raghav Fixes: 527851124d10 ("xfs: implement pNFS export operations") Cc: stable@vger.kernel.org Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 30aa3b7ff1ae962f5028183ae55879d82a2f3384 Author: Daejun Park Date: Thu Oct 29 11:23:01 2026 +0900 xfs: clamp a pNFS LAYOUTCOMMIT extent before computing its end [ Upstream commit d8c2bc88460f89e543ab3af622fc8f34c7011d71 ] xfs_fs_commit_blocks() adds the client's length to the offset before it clamps the end to the file size. A large length wraps the sum and reaches xfs_iomap_write_unwritten() unclamped. With the previous two patches the LAYOUTCOMMIT then fails with -EIO and converts nothing. Clamp the length first. Fixes: 527851124d10 ("xfs: implement pNFS export operations") Cc: stable@vger.kernel.org Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Reviewed-by: Pankaj Raghav Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit d13039937a44e935ed57d661f3f4adcde8375785 Author: Daejun Park Date: Thu Oct 29 11:23:00 2026 +0900 xfs: refuse a pNFS LAYOUTCOMMIT of a range without blocks [ Upstream commit bcf0b7f18ad11e1d410e82ffef678705eff0a317 ] A client can commit a hole in a LAYOUTCOMMIT, because nfsd does not check the extents against its layouts. xfs_iomap_write_unwritten() then allocates written blocks there. A large hole overruns the block reservation and shuts XFS down. A small one exposes stale data. Refuse such a range with -EIO, using XFS_BMAPI_CONVERT_ONLY. Link: https://lore.kernel.org/r/20261014130834.GB15773@lst.de Fixes: 527851124d10 ("xfs: implement pNFS export operations") Cc: stable@vger.kernel.org Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit c37527a5338440ff2be774f591c69a79195221a7 Author: Daejun Park Date: Thu Oct 29 11:22:59 2026 +0900 xfs: add a flag to convert unwritten extents without allocating blocks [ Upstream commit f3ca3498dfe624f9b604c934263538a3acd55af5 ] xfs_bmapi_write() with XFS_BMAPI_CONVERT also allocates blocks for holes and delalloc extents in the range. Add XFS_BMAPI_CONVERT_ONLY for callers that may only convert already allocated blocks. It stops at a hole or delalloc extent, and returns -ENOSR if it stops before mapping anything. Marked for stable because "xfs: refuse a pNFS LAYOUTCOMMIT of a range without blocks" needs it. Suggested-by: Christoph Hellwig Link: https://lore.kernel.org/r/20261013120359.GB2944@lst.de Cc: stable@vger.kernel.org Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Reviewed-by: Pankaj Raghav Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 2748b9277ff5e35e222b6c4d46a8285e3cf6051d Author: Daejun Park Date: Thu Oct 29 11:22:58 2026 +0900 xfs: mark the inode preallocated for pNFS write layouts past EOF [ Upstream commit 8b8e265991556d99b6d721697f148975a7c68767 ] xfs_fs_map_blocks() marks the inode XFS_DIFLAG_PREALLOC only when it allocates blocks for a write layout. A write layout past EOF can also hand out allocated blocks, such as speculative preallocation. blockgc then frees them under the layout, and another file may get them. Mark the inode whenever a write mapping ends past EOF. Fixes: 527851124d10 ("xfs: implement pNFS export operations") Cc: stable@vger.kernel.org Reported-by: Chuck Lever Link: https://lore.kernel.org/r/4de5356f-bc4d-4f1a-9c81-fce09b1b46fd@slotpi15m67 Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Reviewed-by: Pankaj Raghav Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 09cc9ec6bce666c0a49f5702557aa73bd59a046c Author: Zhe Liu Date: Mon Nov 2 14:18:02 2026 +0800 blk-iocost: account flush sequence latency only once [ Upstream commit e9804489e27dd6e33aec5511fe3780ff3009f57f ] A flush sequence with a DATA phase can complete its original request twice. Both completions invoke ioc_rqos_done(), causing the request to contribute two latency samples and adding the same queue wait time twice. This gives such requests disproportionate weight compared to ordinary writes, distorting the device-wide latency and queue wait feedback used to adjust iocost's virtual time rate. Skip requests marked RQF_FLUSH_SEQ in ioc_rqos_done(). The flag is set when the request enters the flush machinery and is still set when the data phase completes; blk_flush_restore_request() clears it before the final completion, so accounting happens only once, after the whole sequence finishes. The remaining sample covers the request's lifetime through any postflush, and its queue wait time is accumulated only once. Fixes: 7caa47151ab2e ("blkcg: implement blk-iocost") Cc: stable@vger.kernel.org Signed-off-by: Zhe Liu Acked-by: Tejun Heo Link: https://patch.msgid.link/20261102061802.408173-1-liuzhe1@kylinos.cn Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit 92ea40ca224ca9909dc7a5ac80dfb3e7cb0e6cae Author: Krystian Kaniewski Date: Wed Oct 14 19:05:36 2026 +0200 blk-mq: fix out-of-bounds read in blk_mq_free_rqs [ Upstream commit 894e4e6084924cfd590968d45fad20908e02ddae ] A KASAN slab-out-of-bounds read can occur in blk_mq_free_rqs() when there is a mismatch between the number of hardware queues allocated for the IO scheduler (et->nr_hw_queues) and the number of hardware queues in the block tag set (set->nr_hw_queues). This mismatch can happen if blk_mq_update_nr_hw_queues() fails halfway through (e.g., due to memory pressure during blk_mq_prealloc_tag_set_tags()). In this error path, the elevator is restored with a larger number of hardware queues than the block tag set actually has. When the elevator is later freed, blk_mq_free_sched_tags() iterates up to the new et->nr_hw_queues and calls blk_mq_free_rqs(). In blk_mq_free_rqs(), it attempts to access set->tags[hctx_idx] to get the driver tags. Because set->nr_hw_queues was not updated due to the earlier failure, set->tags still has the old (smaller) size, leading to an out-of-bounds read. BUG: KASAN: slab-out-of-bounds in blk_mq_free_rqs+0xde/0x680 Read of size 8 at addr ffff88818d67fc28 by task syz-executor117/5839 Call Trace: blk_mq_free_rqs+0xde/0x680 blk_mq_free_map_and_rqs+0x40/0xf0 blk_mq_free_sched_tags blk_mq_free_sched_res+0xeb/0x280 elevator_change_done+0x1d2/0x5c0 elevator_change+0x34f/0x480 elv_iosched_store+0x504/0x630 queue_attr_store+0x207/0x2b0 To fix this, explicitly check if hctx_idx < set->nr_hw_queues before accessing set->tags[hctx_idx]. If hctx_idx >= set->nr_hw_queues, the hardware queue doesn't exist in the tag set, meaning there are no driver tags to clear mappings from. In this case, safely set drv_tags to NULL. The subsequent call to blk_mq_clear_rq_mapping() already handles a NULL drv_tags pointer and will safely return. Fixes: 04225d13aef1 ("block: fix potential deadlock while running nr_hw_queue update") Assisted-by: Gemini:gemini-3.5-flash Gemini:gemini-3.1-pro-preview syzbot Reported-by: syzbot+e90526cab23b9efcd03c@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=e90526cab23b9efcd03c Link: https://syzkaller.appspot.com/ai_job?id=827b5760-86a0-4f44-9c69-430b572eac12 Reviewed-by: Nilay Shorff Cc: stable@vger.kernel.org # 6.17+ Signed-off-by: Krystian Kaniewski Tested-by: syzbot@syzkaller.appspotmail.com Link: https://patch.msgid.link/20261014170538.1089448-1-krystianmkaniewski@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit e68b22b51c60d02d1ab22f795804c0f1db167c09 Author: Laveesh Bansal Date: Fri Oct 30 21:41:41 2026 -0700 block: only serialize elevator switches of the same queue [ Upstream commit 603523fd54664f17630f742229166278568c3ce8 ] Since commit 4ff58d6bc9dd ("block: serialize elevator changes for the same queue using a writer lock"), a write to queue/scheduler fails with -EBUSY whenever something else holds set->update_nr_hwq_lock. That commit takes the lock for write, and it has to be a trylock because of commit ce8ee8583ed8 ("block: use trylock to avoid lockdep circular dependency in sysfs"). The lock covers the whole tag set, so it is easy to hit. A scheduler write fails while another queue of the set is switching, or while a sibling disk of the same SCSI host or NVMe controller is added or removed. This matches the udev failures reported on 7.2. Go back to taking the lock for read. The write lock was there to keep two switches of one queue from overlapping in elevator_change_done(), which touches the elevator sysfs and debugfs entries outside of q->elevator_lock. Use QUEUE_FLAG_NO_ELV_SWITCH for that instead: a write sets it before elevator_change() and clears it afterwards, and a write that finds it set returns -EBUSY. Disk removal already sets the flag under the write lock, so no switch can start once it has run. Writes to the same queue, and writes that race with an nr_hw_queues update, an nr_requests write or disk removal, can still get -EBUSY, as with 4ff58d6bc9dd. A write to a disk that is being removed now gets -EBUSY instead of -ENOENT. Fixes: 4ff58d6bc9dd ("block: serialize elevator changes for the same queue using a writer lock") Cc: stable@vger.kernel.org # v7.2+ Reported-by: Reindl Harald Closes: https://lore.kernel.org/r/077dd42e-cbc9-4c23-a5ef-3d20e4fc7757@thelounge.net Suggested-by: Nilay Shroff Assisted-by: LLM Signed-off-by: Laveesh Bansal Reviewed-by: Nilay Shroff Link: https://patch.msgid.link/20261031044141.5569-1-laveeshb@laveeshbansal.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit e7ef76db8b952628ff7a753a3264089aee3190d0 Author: Reid Downing Date: Tue Oct 27 12:17:48 2026 -0400 xfs: fix wrong compat fields in xfs_ioctl32_bstat_copyin() [ Upstream commit b7eb276a39b14e685c2fe578f8ac22fc48ff9e6c ] bs_blocks and bs_xflags were both read from bstat32->bs_size. Read each one from its own field instead. Fixes: e94fc4a43e5c39 ("[XFS] Add compat handlers for swapext ioctl") Cc: stable@vger.kernel.org # v2.6.29 Signed-off-by: Reid Downing Reviewed-by: Carlos Maiolino Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit ccb4be72111f4a294b650721aad3b287c2481ed3 Author: Hungyu Lin Date: Fri Oct 23 15:36:45 2026 +0000 block: Return the soft block size for compat BLKBSZGET [ Upstream commit 57cd1a08717690e5ea01d7ac7a96bb33a2dca117 ] BLKBSZGET returns the block device's soft block size, while BLKSSZGET returns its logical sector size. The compat BLKBSZGET_32 handler uses bdev_logical_block_size(), so it returns the wrong value when these sizes differ. For example, on an x86_64 kernel a native query of a RAM or loop device with 512-byte logical sectors returns the initial soft block size of 4096 bytes, but an i386 process gets 512 bytes. This makes 32-bit blockdev --getbsz and the BSZ column of --report disagree with native queries, even without a preceding BLKBSZSET. Use block_size() as the native handler and the pre-regression compat handler do, and correct the case comment to describe the soft size. Fixes: 9b81648cb5e3 ("compat_ioctl: simplify up block/ioctl.c") Cc: stable@vger.kernel.org Signed-off-by: Hungyu Lin Reviewed-by: Christoph Hellwig Reviewed-by: Arnd Bergmann Link: https://patch.msgid.link/20261023153645.37546-1-dennylin0707@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit 76f6e24c08a613361fb636d492934cda705d8890 Author: Cong Zhang Date: Tue Nov 3 18:32:21 2026 +0800 virtio_blk: use synchronous quiesce in virtblk_freeze_priv() [ Upstream commit 6c6dec7883f8eb10b326bc9d109a4990c885d949 ] blk_mq_run_work_fn() can call blk_mq_sched_dispatch_requests() through blk_mq_run_dispatch_ops(). The dispatcher checks QUEUE_FLAG_QUIESCED while the flag is clear. It can then be preempted before it gets a request. At that time, it has no queue usage reference, so blk_mq_freeze_queue() does not wait for it. virtblk_freeze_priv() then calls blk_mq_quiesce_queue_nowait() and blk_mq_unfreeze_queue(). A new request can enter the queue. The old dispatcher can run again, use its old flag check, get the new request, and call virtio_queue_rq(). At the same time, virtblk_freeze_priv() can reset the device, delete the virtqueues, and free vblk->vqs. The old dispatcher can then use a deleted virtqueue or a NULL vblk->vqs, and the kernel can crash. Fix this by using blk_mq_quiesce_queue(), which waits for dispatch code that was already running. Keep the existing freeze and unfreeze order. The queue remains quiesced until virtblk_restore_priv() calls blk_mq_unquiesce_queue(). Fixes: 7678abee0867 ("virtio-blk: don't keep queue frozen during system suspend") Cc: stable@vger.kernel.org Acked-by: Jason Wang Reviewed-by: Stefan Hajnoczi Signed-off-by: Cong Zhang Link: https://lore.kernel.org/20260911-virtblk_sync_quiesce-v1-1-a883f8f31258@oss.qualcomm.com Link: https://patch.msgid.link/20261103-virtblk_sync_quiesce-v3-1-f40233f9bdd9@oss.qualcomm.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit db798d356d75732f6225c14605434b77a7905e97 Author: Josef Bacik Date: Thu Oct 29 20:01:10 2026 +0000 blk-mq: end the request if getting a keyslot fails [ Upstream commit e67cb6ed40e7f45912b63d7d575f18dfd2ebc98a ] When blk_crypto_rq_get_keyslot() fails, blk_mq_submit_bio() ends the bio by hand and frees the request. By then blk_mq_bio_to_request() has done the IO accounting, which blk_mq_free_request() doesn't undo, so the in_flight counter never drops and iostat shows a device that is 100% busy. If the bio went through zone write plugging the zone stays plugged as well, and every later write to it waits forever. Use blk_mq_end_request() like the dispatch path does for a request the driver rejected, after marking it for zone write plugging. Move the call to blk_zone_write_plug_init_request() before blk_crypto_rq_get_keyslot() so that it doesn't need to be duplicated. It doesn't depend on the keyslot. Fixes: 99dc422335d8 ("block: support to account io_ticks precisely") Fixes: dd291d77cc90 ("block: Introduce zone write plugging") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik Signed-off-by: Eric Biggers Reviewed-by: Christoph Hellwig Link: https://patch.msgid.link/20261029200110.1328103-1-ebiggers@kernel.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit a0ff2e9881726c6a14b982a98a96eef1b846fba2 Author: Hungyu Lin Date: Tue Oct 27 19:20:27 2026 +0000 inotify: do not coalesce rename events [ Upstream commit 581230d2ec3c0380917d1255792508851e7c4627 ] inotify compares the mask, watch descriptor and name when coalescing adjacent unread events, but ignores their rename cookies. Distinct IN_MOVED_FROM events can therefore be coalesced, losing the cookie needed to match a later IN_MOVED_TO event. For example, watch two directories with IN_MOVE. Move an entry from the first directory into an unwatched directory, recreate it under the same name, then move it from the first directory into the second watched directory before reading the events. The second IN_MOVED_FROM is merged with the first, while the IN_MOVED_TO retains the second rename's cookie. Userspace can no longer pair the second rename's events. The original inotify implementation compared cookies before coalescing. The fsnotify conversion lost this comparison. Do not coalesce IN_MOVED_FROM or IN_MOVED_TO events, which carry the identity of their respective renames. Leave coalescing of other event types unchanged. Fixes: 63c882a05416 ("inotify: reimplement inotify using fsnotify") Cc: stable@vger.kernel.org Suggested-by: Amir Goldstein Signed-off-by: Hungyu Lin Reviewed-by: Amir Goldstein Link: https://patch.msgid.link/20261027192027.8617-1-dennylin0707@gmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin commit 4c8fdb725614189b6c73cf5f7f509592758b6d18 Author: chenglong.ma Date: Mon Nov 2 12:08:55 2026 -0500 vduse: fix VA/PA confusion in the coherent page fault path [ Upstream commit bb2e6f166547838fd7c320b01c90918b736f76e2 ] vduse_domain_get_coherent_page() assumes that iotlb entries above bounce_size were installed by vduse_domain_alloc_coherent(), so it treats map->addr as a physical address. But vduse registers with use_va = true, and when the device is bound to vhost_vdpa, vhost_vdpa_va_map() stores a userspace virtual address in map->addr, which vduse_domain_set_map() then copies into the same iotlb. A process holding the domain file descriptor across a rebind can therefore fault in an arbitrary physical page with read/write access, ignoring the entry permissions. Additionally, since the domain file mmap lacks VM_IO, the domain file itself can be mapped and passed to vhost_vdpa_va_map(), producing self-referential entries that bypass the coherent path check. To fix, only translate entries whose backing file is the domain file itself in vduse_domain_get_coherent_page(), reject such entries in vduse_domain_set_map() since only external mappings should be imported, and set VM_IO on the domain file mmap so vhost_vdpa_va_map() refuses to map it in the first place. Fixes: 8c773d53fb7b ("vduse: Implement an MMU-based software IOTLB") Cc: Xie Yongji Cc: stable@vger.kernel.org Reported-by: chenglong.ma Signed-off-by: chenglong.ma Signed-off-by: Michael S. Tsirkin Co-Authored-By: Claude Code Signed-off-by: Sasha Levin commit b18bda055c0d3e44fdf419e2739d92ea92a6f1d2 Author: Thorsten Blum Date: Fri Oct 16 12:36:40 2026 +0200 hwrng: virtio - prevent use-after-free after a failed restore [ Upstream commit 0f7bf47f5a0cc26320aa4b14f4504d03a07f4b74 ] remove_common() frees the driver data during freeze, but does not clear vdev->priv, which points to freed memory. If probe_common() then fails during restore, a later remove or freeze can dereference the dangling pointer. Clear vdev->priv on the probe_common() error cleanup path and before freeing the driver data in remove_common(). Also reset the device and return early from remove_common() if vdev->priv is already NULL for a safe teardown after a failed restore. Fixes: 08e53fbdb85c ("virtio-rng: support multiple virtio-rng devices") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum Reviewed-by: PrasannaKumar Muralidharan . Signed-off-by: Michael S. Tsirkin Message-ID: <20261016103640.4989-2-blum@kernel.org> Signed-off-by: Sasha Levin commit 4d68e5bd45bf30969aa936d604ff877f3216f370 Author: Esben Haabendal Date: Tue Oct 27 11:33:50 2026 +0100 drm/bridge: nwl-dsi: Limit LCDIF specific sync override [ Upstream commit 54a88d9afcca66221d14f438d0960472984968ec ] When using DCSS with NWL, overriding the mode flags to enforce active high sync is preventing the use of active low with downstream bridges, such as ti-sn65dsi83, which will not see such mode flags set by the panel. Fixes: 44cfc6233447 ("drm/bridge: Add NWL MIPI DSI host controller support") Cc: stable@vger.kernel.org Reviewed-by: Luca Ceresoli Signed-off-by: Esben Haabendal Link: https://patch.msgid.link/20261027-nwl-dsi-fixes-v5-2-b6d1d3d2d356@geanix.com Signed-off-by: Luca Ceresoli Signed-off-by: Sasha Levin commit 883266c18b20972e77f421666fc2eb73b19f9523 Author: Esben Haabendal Date: Tue Oct 27 11:33:49 2026 +0100 drm/bridge: nwl-dsi: Cleanup endpoint mux control selection [ Upstream commit 8dad0ebd822f54102aadc6ca4f0f8777112d175d ] Using the endpoint define values makes it more clear that the argument to mux_control_try_select() must be valid state integers, and not something that looks like a boolean. The endpoint value is kept, as it will be used in a following patch that changes behavior slightly based on which endpoint is selected. Cc: stable@vger.kernel.org Reviewed-by: Luca Ceresoli Signed-off-by: Esben Haabendal Link: https://patch.msgid.link/20261027-nwl-dsi-fixes-v5-1-b6d1d3d2d356@geanix.com Signed-off-by: Luca Ceresoli Signed-off-by: Sasha Levin commit 0a06affe7c69805c837f2beb33a9a81b6ac2e8a5 Author: Yuho Choi Date: Mon Oct 5 00:47:45 2026 -0400 vdpa/snet: Don't discard the DPU error in snet_send_ctrl_msg() [ Upstream commit f41f153d49b4c18172ec61b69ba934c36e1be745 ] snet_send_ctrl_msg() reads the error code the DPU reports when it ACKs a control message, but then overwrites it with the return value of snet_wait_for_dpu_completion(). As a result, a DESTROY, SUSPEND or RESUME that the DPU rejects is reported to the caller as a success as long as the DPU clears the opcode register in time. For SUSPEND this means vhost-vdpa marks the device as suspended and lets userspace reprogram the vrings while the DPU is still running them; for DESTROY, snet_reset_dev() never even sees that the device failed to stop. Return the error from the saved ACK value once the completion wait itself has succeeded. Fixes: 3f3a1675b731 ("vdpa/snet: support getting and setting VQ state") Cc: stable@vger.kernel.org Signed-off-by: Yuho Choi Signed-off-by: Michael S. Tsirkin Message-ID: <20261005044915.264532-1-oss.patchbox@gmail.com> Signed-off-by: Sasha Levin commit cfdb3b6915299ebb6ffc98566f9cf73d4d1f1598 Author: Yuho Choi Date: Sun Oct 4 14:21:10 2026 -0400 iommu/virtio: Reset device before deleting virtqueues on probe failure [ Upstream commit 1f8efac19a0870cdfdf8477e447e5a07ddce9623 ] viommu_probe() marks the device DRIVER_OK before populating the event virtqueue and registering the IOMMU device in sysfs. viommu_fill_evtq() hands the device a set of device-writable buffers through virtqueue_add_inbuf(), so from that point on the device may write into them and into the rings. If either step fails, the error path deletes the virtqueues without resetting the device first. The event buffers are allocated with devm_kmalloc_array() and are released as probe unwinds, so the device can go on writing to memory that has been freed. Reset the device before deleting the virtqueues, the way viommu_remove() already does. Fixes: edcd69ab9a32 ("iommu: Add virtio-iommu driver") Cc: stable@vger.kernel.org Signed-off-by: Yuho Choi Signed-off-by: Michael S. Tsirkin Message-ID: <20261004182218.177343-1-oss.patchbox@gmail.com> Signed-off-by: Sasha Levin commit 308e148cf771ed36ad8cd7ef0e9bee2f7ec478d0 Author: Fang Xieyan Date: Wed Oct 21 07:29:56 2026 +0800 vhost: fix used ring index wrap in vhost_add_used_n_in_order [ Upstream commit e244725e86be02cd85cb878b3ed8570eba2e4be1 ] vhost_add_used_n_in_order() advances start by nheads[i] but wraps it with a single subtraction. If start + nheads[i] >= 2 * vq->num, start can remain outside the ring. With used-ring logging enabled, start > vq->num makes (vq->num - start) underflow. log_write() then sets bits beyond the dirty-log bitmap, potentially corrupting adjacent userspace memory. This is reachable on the vhost-net TX path with VIRTIO_F_IN_ORDER: done_idx can reach VHOST_NET_BATCH (64), triggering the issue with a 32-entry ring. Wrap start with a mask to keep it within the ring. VHOST_SET_VRING_NUM enforces a nonzero power-of-two ring size, allowing start to be wrapped using & (vq->num - 1). Fixes: 67a873df0c41 ("vhost: basic in order support") Cc: stable@vger.kernel.org Reviewed-by: Weibin Liu Signed-off-by: Fang Xieyan Acked-by: Eugenio Pérez Signed-off-by: Michael S. Tsirkin Message-ID: <20261020232956.99970-1-fangxy@xiaopeng.com> Signed-off-by: Sasha Levin commit e048d90d63d6cdf05b23ba5015de7f7652f11e10 Author: Shubham Antil Date: Tue Oct 20 16:25:03 2026 +0530 vhost-scsi: zero misaligned I/O bounce pages [ Upstream commit 01c3a5fa6d641c93c7cef4fb25c5f12938316e18 ] The misaligned I/O fallback copies the full bounce scatterlist to the request buffer during completion. If a data-in command transfers less than requested, part of a newly allocated bounce page can remain unwritten. Allocate bounce pages with __GFP_ZERO so all bytes copied during completion have a defined value. This path is already the slow fallback for misaligned I/O, so the added initialization cost is acceptable. Found during an LLM-assisted source audit and validated with a QEMU/KVM vhost-scsi target using misaligned data-in commands. Fixes: 5ced58bfa132 ("vhost-scsi: Fix alignment handling with windows") Cc: stable@vger.kernel.org Assisted-by: LLM (OpenAI Codex, gpt-5.6-sol) Signed-off-by: Shubham Antil Reviewed-by: Mike Christie Signed-off-by: Michael S. Tsirkin Message-ID: <20261020105503.75904-1-shubham@octane.security> Signed-off-by: Sasha Levin commit 519f327c7fd1b67327de2e1cff6fbe85a02a151b Author: Kyle Zeng Date: Thu Oct 29 14:09:57 2026 -0400 net/sched: sch_qfq: prevent aggregate self-replacement [ Upstream commit 2e54b3e187300893688c2c7517894f5d96732e05 ] qfq_change_class() snapshots the current aggregate settings while holding the qdisc tree lock, but drops the lock before selecting the destination aggregate. During that gap, qfq_enqueue() can move the class to an aggregate matching the requested settings. When qfq_change_class() resumes, qfq_find_agg() then returns cl->agg. If it is a singleton, qfq_deact_rm_from_agg() frees the aggregate before qfq_add_to_agg() immediately accesses the same pointer, causing a use-after-free. While holding the tree lock, skip the replacement when the destination is already the current aggregate. Any estimator replacement has already completed, so the class change can finish normally. Fixes: 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost") Link: https://lore.kernel.org/netdev/20260731140533.566493-1-david.lee@trailofbits.com/ Cc: stable@vger.kernel.org Signed-off-by: Kyle Zeng Co-developed-by: David Lee Signed-off-by: David Lee Link: https://patch.msgid.link/20261029180957.43015-1-david.lee@trailofbits.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 845ef1a6277f8b8bdf6479c6f561c16e5d5f56e2 Author: Jianyun Gao Date: Mon Nov 2 23:01:41 2026 +0800 xfs: fix temporary cursor leak in btree shift corruption paths [ Upstream commit 2bbca049deeb1699cafd966cb2793fee576ee409 ] In xfs_btree_lshift and xfs_btree_rshift, when XFS_IS_CORRUPT detects an invalid firstrec/lastrec result after xfs_btree_dup_cursor has successfully allocated a temporary cursor, the error path jumps to error0 which returns without freeing tcur. This leaks the cursor memory, the xfs_group reference, and the per-level buffer references held by the duplicated cursor. Jump to error1 instead, which calls xfs_btree_del_cursor(tcur, XFS_BTREE_ERROR) to properly release all resources. Cc: stable@vger.kernel.org Fixes: 9eaead51bed95 ("[XFS] implement generic xfs_btree_rshift") Signed-off-by: Jianyun Gao Reviewed-by: Carlos Maiolino Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 7bcc459c5f9ddc08bca1b31c721255cbfc414923 Author: Naman Jain Date: Mon Aug 31 08:25:28 2026 +0000 x86/init: Initialize wall clock in get_rtc_noop() [ Upstream commit 7d5af1f256fdecff6a7986bbc9146b69cb355bb5 ] get_rtc_noop() is used when an RTC is unavailable, but leaves its output argument untouched. When CONFIG_INIT_STACK_ALL_ZERO is not enabled, timekeeping_init() may therefore receive a nonzero invalid persistent clock value and warn: "Persistent clock returned invalid value" Initialize the output to zero, the documented representation of an unsupported persistent clock. Fixes: c311ed6183f4 ("x86/init: Allow DT configured systems to disable RTC at boot time") Signed-off-by: Naman Jain Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Thomas Gleixner Reviewed-by: Roman Kisel Reviewed-by: Hardik Garg Reviewed-by: Dexuan Cui Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260831082528.1623843-1-namjain@linux.microsoft.com Signed-off-by: Sasha Levin commit 85bc2a3b1bece826c908a31c34a4865a80136bee Author: Cen Zhang Date: Tue Oct 20 22:25:53 2026 +0800 ocfs2: cache the mount context for dentry lock callbacks [ Upstream commit 5b4696e0bfc358619adaeab25ad35b4979af8331 ] ocfs2_drop_dentry_lock() drops the inode reference before releasing the DENTRY lock. This lets inode eviction release the local inode and open locks before a remote unlink can proceed past the DENTRY lock. A DLM callback can still arrive before the DENTRY lock has been dropped. ocfs2_get_dentry_osb() obtains the mount context through dl_inode->i_sb, which can access a freed inode when the downconvert thread drops the last inode reference in its post-unlock callback: Downconvert thread DLM callback thread ------------------ ------------------- ocfs2_process_blocked_lock() ocfs2_dentry_post_unlock() ocfs2_dentry_lock_put() ocfs2_drop_dentry_lock() iput(dl->dl_inode) [inode reclaimed after RCU] ocfs2_blocking_ast() ocfs2_get_dentry_osb() dl->dl_inode->i_sb ocfs2_simple_drop_lockres() Store the mount context in the DENTRY lock resource's l_priv field and use the default mount-context lookup. Recover the containing dentry lock with container_of(), as already done for refcount locks, and remove ocfs2_get_dentry_osb(). ocfs2_dismount_volume() shuts down the DLM before freeing the mount context, so callbacks can use it without accessing the inode. Preserve the existing iput-before-unlock order to avoid delaying local inode and open lock release until after the DENTRY lock is released. Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0012-v9-eeb9084fb29577971229@gmail.com Fixes: 8ed6b23709b3 ("ocfs2: revert iput deferring code in ocfs2_drop_dentry_lock") Signed-off-by: Cen Zhang Signed-off-by: Andrew Morton Suggested-by: Joseph Qi Reviewed-by: Joseph Qi Assisted-by: LLM Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Jia-Ju Bai Cc: Cc: Signed-off-by: Sasha Levin commit 9c81fade880026ec85cc2b50b80fd30599473372 Author: Cen Zhang Date: Sun Oct 25 00:18:52 2026 +0800 ocfs2: wait for filecheck kobject release after a failed add [ Upstream commit a25c02af29c3e95128e4343fceb4bdace8e480a0 ] The filecheck kobject and its release completion are embedded in ocfs2_super, so the osb must outlive the kobject. On a failed kobject_init_and_add(), creation clears fs_fcheck and calls kobject_put(), but returns without waiting for the release callback. With CONFIG_DEBUG_KOBJECT_RELEASE, the last put queues delayed cleanup. Mount failure can then free the containing osb before the embedded release timer expires: Mount failure Delayed cleanup ------------- --------------- ocfs2_filecheck_create_sysfs() kobject_init_and_add() fails fs_fcheck = NULL kobject_put() queue delayed release return to mount error cleanup ocfs2_dismount_volume() remove_sysfs() skips the wait kfree(osb) expire embedded release timer access freed osb The normal removal path waits for fs_kobj_unregister, but it returns early when fs_fcheck is NULL. The failed-add path therefore leaves the delayed work and its completion in freed storage. Wait for the existing release completion after the failed-add kobject_put(), before returning to mount error cleanup. This keeps the enclosing osb alive until the kobject has finished releasing, matching the normal teardown path. KASAN report as below: BUG: KASAN: slab-use-after-free in __run_timers+0xa6d/0xa90 Write of size 8 at addr ffff8881178a5658 by task swapper/0/0 CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 7.3.0-rc4-next-20260921-pmb-ocfs2-functional-v1+ #1 PREEMPT(lazy) Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0x93/0xd0 print_report+0xce/0x630 ? __run_timers+0xa6d/0xa90 ? srso_alias_return_thunk+0x5/0xfbef5 ? __virt_addr_valid+0x20e/0x420 ? __run_timers+0xa6d/0xa90 kasan_report+0xe0/0x110 ? __run_timers+0xa6d/0xa90 __run_timers+0xa6d/0xa90 ? srso_alias_return_thunk+0x5/0xfbef5 ? __pfx___run_timers+0x10/0x10 ? __lock_acquire+0x5a3/0x2140 ? __pfx_do_raw_spin_lock+0x10/0x10 ? srso_alias_return_thunk+0x5/0xfbef5 timer_expire_remote+0xfa/0x160 ? __pfx_timer_expire_remote+0x10/0x10 ? srso_alias_return_thunk+0x5/0xfbef5 ? srso_alias_return_thunk+0x5/0xfbef5 ? trace_hardirqs_on+0x18/0x160 tmigr_handle_remote_up+0x4ba/0x9d0 ? __pfx_tmigr_handle_remote_up+0x10/0x10 ? tmigr_handle_remote+0x21a/0x340 ? srso_alias_return_thunk+0x5/0xfbef5 ? lock_release+0xc8/0x290 ? __pfx_tmigr_handle_remote_up+0x10/0x10 __walk_groups_from+0x5a/0x160 tmigr_handle_remote+0x24f/0x340 ? __pfx_tmigr_handle_remote+0x10/0x10 ? lock_acquire+0x190/0x300 ? srso_alias_return_thunk+0x5/0xfbef5 ? lock_release+0xc8/0x290 run_timer_softirq+0x222/0x270 ? __pfx_run_timer_softirq+0x10/0x10 ? srso_alias_return_thunk+0x5/0xfbef5 ? srso_alias_return_thunk+0x5/0xfbef5 ? lockdep_hardirqs_on_prepare+0xb8/0x1a0 ? srso_alias_return_thunk+0x5/0xfbef5 handle_softirqs+0x1fa/0x8d0 ? __pfx_handle_softirqs+0x10/0x10 ? srso_alias_return_thunk+0x5/0xfbef5 ? _raw_spin_unlock+0x23/0x40 ? srso_alias_return_thunk+0x5/0xfbef5 ? __hrtimer_rearm_deferred+0x1fb/0x5d0 __irq_exit_rcu+0x113/0x1e0 irq_exit_rcu+0xe/0x20 sysvec_apic_timer_interrupt+0x6c/0x80 asm_sysvec_apic_timer_interrupt+0x1a/0x20 RIP: 0010:pv_native_safe_halt+0xf/0x20 Code: fa 18 01 e9 ee 37 ff fa 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d 23 c7 14 00 fb f4 c7 37 ff fa 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90 RSP: 0018:ffffffff87c07cf8 EFLAGS: 00000206 RAX: 0000000000045d0f RBX: ffffffff87c2d4c0 RCX: ffffffff86111e95 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff815b508e RBP: fffffbfff0f85a98 R08: 0000000000000001 R09: ffffed10310c68ba R10: ffff8881886345d3 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000000 R14: 1ffffffff0f80fa4 R15: dffffc0000000000 ? ct_kernel_exit.constprop.0+0xc5/0xf0 ? do_idle+0x3ae/0x650 default_idle+0x9/0x10 default_idle_call+0x6c/0xb0 do_idle+0x3ae/0x650 ? __pfx___schedule+0x10/0x10 ? __pfx_do_idle+0x10/0x10 ? rest_init+0x1cd/0x330 ? srso_alias_return_thunk+0x5/0xfbef5 cpu_startup_entry+0x54/0x60 rest_init+0x1e1/0x330 ? __pfx_acpi_read_bit_register+0x10/0x10 ? __pfx_rest_init+0x10/0x10 ? acpi_os_write_port+0x23/0xb0 ? __pfx_kernel_init+0x10/0x10 ? srso_alias_return_thunk+0x5/0xfbef5 ? acpi_ut_status_exit+0xd6/0x180 ? srso_alias_return_thunk+0x5/0xfbef5 ? acpi_ut_status_exit+0xd6/0x180 ? srso_alias_return_thunk+0x5/0xfbef5 ? acpi_enable_subsystem+0x2b0/0x4e0 ? __pfx_x86_late_time_init+0x10/0x10 start_kernel+0x417/0x4b0 x86_64_start_reservations+0x18/0x30 x86_64_start_kernel+0x111/0x120 common_startup_64+0x13e/0x158 Allocated by task 494: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 __kasan_kmalloc+0xaa/0xb0 __kmalloc_cache_noprof+0x28d/0x610 ocfs2_initialize_super.isra.0+0xab/0x3070 ocfs2_fill_super+0x801/0x3920 get_tree_bdev_flags+0x35d/0x5f0 vfs_get_tree+0x93/0x320 fc_mount+0x1d/0x200 path_mount+0x592/0x1e00 __x64_sys_mount+0x24b/0x2d0 do_syscall_64+0x114/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 494: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 kasan_save_free_info+0x3b/0x60 __kasan_slab_free+0x5f/0x80 kfree+0x308/0x580 ocfs2_dismount_volume+0x43c/0x9b0 ocfs2_fill_super+0x258f/0x3920 get_tree_bdev_flags+0x35d/0x5f0 vfs_get_tree+0x93/0x320 fc_mount+0x1d/0x200 path_mount+0x592/0x1e00 __x64_sys_mount+0x24b/0x2d0 do_syscall_64+0x114/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff8881178a4000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 5720 bytes inside of freed 8192-byte region [ffff8881178a4000, ffff8881178a6000) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1178a0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x200000000000040(head|node=0|zone=2) page_type: f5(slab) raw: 0200000000000040 ffff888100043880 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000020002 00000000f5000000 0000000000000000 head: 0200000000000040 ffff888100043880 dead000000000122 0000000000000000 head: 0000000000000000 0000000000020002 00000000f5000000 0000000000000000 head: 0200000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881178a5500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881178a5580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881178a5600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881178a5680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881178a5700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0087-v6-78f3c3d6d70887d6e0cc@gmail.com Fixes: b9fba67b3806 ("ocfs2: fix error path kobject memory leak") Signed-off-by: Cen Zhang Signed-off-by: Andrew Morton Reviewed-by: Joseph Qi Assisted-by: LLM Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Jia-Ju Bai Cc: Cc: Signed-off-by: Sasha Levin commit 831f6f917f7e22068d850efc6443eca300a11f95 Author: Cen Zhang Date: Tue Oct 13 23:34:46 2026 +0800 ocfs2/cluster: unlink socket containers before releasing resources [ Upstream commit 0988f0c0c7c908f0ff77fd8b90ce9918a1f41479 ] A socket container's node and socket must remain alive while the container is on sock_containers. The debugfs formatter reads sc_node and sc_sock under o2net_debug_lock without taking their references, but sc_kref_release() releases both before taking that lock to unlink the container. With CONFIG_DEBUG_FS enabled, a synchronous sender can retain its last socket-container reference after o2net_disconnect_node() has detached the connection and flushed o2net_wq. The caller runs outside that workqueue. After the sender removes its configfs dependency, node removal can proceed without waiting for the sender's final sc_put(): Sender (final sc_put) Configfs rmdir Debugfs reader -------------------- -------------- -------------- o2nm_undepend_item() Drop node item refs o2nm_node_put() [node can be freed] sc_seq_show() Lock debug lock Read sc_node->nd_name Unlock debug lock sc_node = NULL o2net_debug_del_sc() The earlier socket release has a similar window. The container is still selectable while its socket has been released and sc_sock has not yet been cleared: Sender (final sc_put) Debugfs reader -------------------- -------------- sock_release(sc->sc_sock) [socket can be freed] sc_seq_show() Lock debug lock Read sc_sock->sk fields Unlock debug lock sc_sock = NULL ... o2net_debug_del_sc() Move o2net_debug_del_sc() before releasing either resource. Unlinking under the existing debug lock waits for an active formatter to finish and prevents later readers from selecting the container. This covers both socket fields and node fields, including nd_num in the stats formatter. KASAN report as below: BUG: KASAN: slab-use-after-free in string+0x42b/0x470 Read of size 1 at addr ffff88810f56fc90 by task python3/506 CPU: 0 UID: 0 PID: 506 Comm: python3 Not tainted 7.3.0-rc4-next-20260921-pmb-ocfs2-functional-v1+ #1 PREEMPT(lazy) Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0x93/0xd0 print_report+0xce/0x630 kasan_report+0xe0/0x110 string+0x42b/0x470 vsnprintf+0x330/0x1110 seq_printf+0x1a8/0x260 sc_seq_show+0x604/0x9f0 seq_read_iter+0x480/0x1110 seq_read+0x362/0x5a0 full_proxy_read+0x11f/0x180 vfs_read+0x1a0/0xc20 ksys_read+0x111/0x200 do_syscall_64+0x114/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f (User register dump omitted.) Allocated by task 497: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 __kasan_kmalloc+0xaa/0xb0 __kmalloc_cache_noprof+0x28d/0x610 o2nm_node_group_make_item+0xea/0x1a0 configfs_mkdir+0x762/0xca0 vfs_mkdir+0x399/0x7e0 filename_mkdirat+0x129/0x450 __x64_sys_mkdir+0x70/0xa0 do_syscall_64+0x114/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 505: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 kasan_save_free_info+0x3b/0x60 __kasan_slab_free+0x5f/0x80 kfree+0x308/0x580 config_item_cleanup+0x14b/0x230 config_item_put+0x79/0x90 sc_put+0x454/0x6e0 o2net_send_message_vec+0x63d/0x1560 o2net_send_message+0xa6/0xe0 validation_send_write+0x17f/0x1d0 full_proxy_write+0x11f/0x180 vfs_write+0x25a/0x1010 ksys_write+0x111/0x200 do_syscall_64+0x114/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88810f56fc00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 144 bytes inside of freed 512-byte region [ffff88810f56fc00, ffff88810f56fe00) (Page and shadow-memory dumps omitted.) Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0065-v6-3090153fd7cacb810214@gmail.com Fixes: 2309e9e040fe ("ocfs2/net: Add debug interface to o2net") Signed-off-by: Cen Zhang Signed-off-by: Andrew Morton Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Kees Cook Cc: Jakub Kicinski Cc: Sunil Mushran Cc: Jia-Ju Bai Cc: Cc: Signed-off-by: Sasha Levin commit 47997a43d33fcb3d4a87249bfd8ab07ede119fa3 Author: Cen Zhang Date: Thu Oct 29 14:57:35 2026 +0800 ocfs2: stop recovery before shutting down local allocators [ Upstream commit 126429e2f503ade63502978beb0c519066442250 ] Recovery completion needs the local allocators until it has finished reclaiming a failed node's allocation window and truncate log. During unmount, quota recovery is stopped first, but that leaves recovery_state at OCFS2_REC_QUOTA_DISABLED. New non-quota recovery can still start. ocfs2_truncate_log_shutdown() drains existing completion work and releases osb_tl_bh before ocfs2_recovery_exit() closes that publication path: Unmount Recovery ------- -------- stop quota recovery; disable quotas truncate_log_shutdown() flush existing completion work recover another failed node queue completion flush local log; release buffer complete_truncate_log_recovery() use released osb_tl_bh recovery_exit(): disable and drain An extra buffer reference alone would still let completion append new records after the final truncate-log flush. Split stopping and draining recovery from freeing its state. Stop all recovery producers and drain completion work before shutting down either local allocator. Keep recovery-state release at its existing later point, so its lifetime relative to other teardown users stays unchanged. The second stop at recovery_exit() is harmless once recovery is disabled. KASAN report as below: BUG: KASAN: slab-use-after-free in ocfs2_truncate_log_needs_flush+0x23d/0x360 Read of size 8 at addr ffff8881093711e8 by task kworker/u16:3/53 CPU: 0 UID: 0 PID: 53 Comm: kworker/u16:3 Not tainted 7.3.0-rc4-next-20260921-pmb-ocfs2-functional-v1+ #1 PREEMPT(lazy) Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Workqueue: ocfs2_wq ocfs2_complete_recovery Call Trace: dump_stack_lvl+0x93/0xd0 print_report+0xce/0x630 ? ocfs2_truncate_log_needs_flush+0x23d/0x360 ? srso_alias_return_thunk+0x5/0xfbef5 ? __virt_addr_valid+0x20e/0x420 ? ocfs2_truncate_log_needs_flush+0x23d/0x360 kasan_report+0xe0/0x110 ? ocfs2_truncate_log_needs_flush+0x23d/0x360 ocfs2_truncate_log_needs_flush+0x23d/0x360 ? __pfx_ocfs2_truncate_log_needs_flush+0x10/0x10 ? __pfx_down_write+0x10/0x10 ocfs2_complete_truncate_log_recovery+0x315/0x780 ? trace_hardirqs_on+0x18/0x160 ? __pfx_ocfs2_complete_truncate_log_recovery+0x10/0x10 ? ocfs2_complete_recovery+0x666/0x11b0 ? srso_alias_return_thunk+0x5/0xfbef5 ? kfree+0x308/0x580 ocfs2_complete_recovery+0x676/0x11b0 ? __pfx_ocfs2_complete_recovery+0x10/0x10 ? reacquire_held_locks+0xdd/0x200 ? process_one_work+0x7c8/0x1b40 ? srso_alias_return_thunk+0x5/0xfbef5 ? lock_acquire+0x190/0x300 ? __pfx_autoremove_wake_function+0x10/0x10 ? process_one_work+0x834/0x1b40 ? srso_alias_return_thunk+0x5/0xfbef5 ? lock_release+0xc8/0x290 ? srso_alias_return_thunk+0x5/0xfbef5 process_one_work+0x9a8/0x1b40 ? __pfx_process_one_work+0x10/0x10 ? lock_acquire+0x190/0x300 ? lock_is_held_type+0x8f/0x100 ? srso_alias_return_thunk+0x5/0xfbef5 worker_thread+0x65c/0xe40 ? srso_alias_return_thunk+0x5/0xfbef5 ? __kthread_parkme+0x177/0x220 ? srso_alias_return_thunk+0x5/0xfbef5 ? __pfx_worker_thread+0x10/0x10 kthread+0x351/0x460 ? srso_alias_return_thunk+0x5/0xfbef5 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x659/0x940 ? __pfx_ret_from_fork+0x10/0x10 ? srso_alias_return_thunk+0x5/0xfbef5 ? __switch_to+0x74f/0xf70 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 Allocated by task 538: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 __kasan_slab_alloc+0x89/0x90 kmem_cache_alloc_noprof+0x20b/0x5c0 alloc_buffer_head+0x26/0x120 folio_alloc_buffers+0x122/0x1d0 bdev_getblk+0x299/0x4f0 ocfs2_read_blocks_sync+0x513/0xbc0 ocfs2_iget+0x9cd/0x1a00 ocfs2_get_system_file_inode+0x25e/0x7a0 ocfs2_fill_super+0x1b05/0x3930 get_tree_bdev_flags+0x35d/0x5f0 vfs_get_tree+0x93/0x320 fc_mount+0x1d/0x200 path_mount+0x592/0x1e00 __x64_sys_mount+0x24b/0x2d0 do_syscall_64+0x114/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 553: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 kasan_save_free_info+0x3b/0x60 __kasan_slab_free+0x5f/0x80 kmem_cache_free+0x242/0x580 free_buffer_head+0x4b/0xc0 try_to_free_buffers+0x1dc/0x330 ocfs2_truncate_log_shutdown+0x789/0x1290 ocfs2_dismount_volume+0x1da/0x940 generic_shutdown_super+0x15f/0x490 kill_block_super+0x40/0xa0 deactivate_locked_super+0xae/0x120 deactivate_super+0xa2/0xc0 cleanup_mnt+0x217/0x450 task_work_run+0x144/0x230 exit_to_user_mode_loop+0x17d/0x570 do_syscall_64+0x4d1/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff8881093711c0 which belongs to the cache buffer_head of size 160 The buggy address is located 40 bytes inside of freed 160-byte region [ffff8881093711c0, ffff888109371260) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109371 flags: 0x200000000000000(node=0|zone=2) page_type: f5(slab) raw: 0200000000000000 ffff8881008883c0 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000120012 00000000f5000000 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888109371080: 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 ffff888109371100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888109371180: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ^ ffff888109371200: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888109371280: fc fc fc fc 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0019-v8-574dd69fd3f47f56348b@gmail.com Fixes: ccd979bdbce9 ("[PATCH] OCFS2: The Second Oracle Cluster Filesystem") Signed-off-by: Cen Zhang Signed-off-by: Andrew Morton Suggested-by: Joseph Qi Reviewed-by: Joseph Qi Assisted-by: LLM Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Jia-Ju Bai Cc: Cc: Signed-off-by: Sasha Levin commit 1696bbf1d6165421a4f7e15549645d96505b0977 Author: Cen Zhang Date: Tue Oct 27 18:14:49 2026 +0800 ocfs2/dlm: serialize migration MLE cleanup on failure [ Upstream commit 61469249aab03799b0d3294b7a0cd25dd303017a ] A migration MLE has a base reference for the mastering answer and an in-use reference held by dlm_migrate_lockres(). The finishing assertion consumes the base reference, but migration failure drops it again without checking whether the assertion already consumed it. The target queues its migration worker before it acknowledges the ALL_DONE packet, so its finishing assertion can be handled while the sender still waits for the status. If the connection fails before the status arrives, dlm_send_one_lockres() returns an error for a migration that the target has already completed: Old-master sender Finishing assertion ----------------- ------------------- publish MLE; take in-use reference send ALL_DONE; wait for status take lookup reference unlink MLE put lookup and base references send returns a connection error put base reference again; free MLE put in-use reference; access freed MLE dlm_assert_master_handler() holds dlm->spinlock from the MLE lookup to the final puts, and it takes dlm->master_lock around the unlink and the puts. Decide under the same locks: if the MLE is already unhashed, the assertion consumed the base reference, so drop only the sender's in-use reference. Otherwise unlink it before consuming the base reference so a later assertion no longer finds it. An assertion that got there first has also made the target the owner and cleared DLM_LOCK_RES_MIGRATING. Treating the attempt as failed at that point would leave the lockres owned by the target while this node still holds the other nodes' locks and refmap bits, so it could neither be purged nor migrated again. Finish our side as a completed migration does instead: drop those locks under res->spinlock if the target still owns the lockres, and recalculate its usage. Use the same cleanup for the pre-send failure, the send failure and the target-death failure paths. The sender's in-use reference keeps the MLE alive until its final put outside the nested locks. Successful migration retains its existing in-use-only put. A target that has died cannot assert after the sender has seen its death. The o2net node-down callback runs before the DLM one; it disconnects the node and flushes the workqueue that runs the message handlers, so an assertion already received has been handled by the time the DLM removes the node from the domain map. A node that leaves the domain cleanly sends its exit message only after its assertions have been answered. Two windows of the hand-over itself are left as they are: the handler switches the owner and the sender drops the other nodes' locks moments later, and an assertion from a live target that arrives after the sender has given up still meets the owner check in the handler. Waiting for the target before giving up would only stretch the first window into the time in which recovery of the target can observe it. KASAN report, only the relevant frames are kept: BUG: KASAN: slab-use-after-free in dlm_put_mle_inuse+0xce/0xe0 Read of size 8 at addr ffff8881190e3c20 by task umount/593 Call Trace: dlm_put_mle_inuse+0xce/0xe0 dlm_migrate_lockres+0x16af/0x20d0 dlm_empty_lockres+0x60a/0xbd0 dlm_unregister_domain+0x53b/0x11d0 o2cb_cluster_disconnect+0xa5/0x110 ocfs2_cluster_disconnect+0x73/0xc0 ocfs2_dlm_shutdown+0x311/0x440 ocfs2_dismount_volume+0x696/0x940 generic_shutdown_super+0x15f/0x490 kill_block_super+0x40/0xa0 deactivate_locked_super+0xae/0x120 deactivate_super+0xa2/0xc0 cleanup_mnt+0x217/0x450 task_work_run+0x144/0x230 Allocated by task 593: kmem_cache_alloc_noprof+0x20b/0x5c0 dlm_migrate_lockres+0x20e/0x20d0 dlm_empty_lockres+0x60a/0xbd0 dlm_unregister_domain+0x53b/0x11d0 o2cb_cluster_disconnect+0xa5/0x110 ocfs2_cluster_disconnect+0x73/0xc0 ocfs2_dlm_shutdown+0x311/0x440 ocfs2_dismount_volume+0x696/0x940 Freed by task 593: kmem_cache_free+0x242/0x580 __dlm_put_mle+0x4b2/0x660 dlm_migrate_lockres+0x1690/0x20d0 dlm_empty_lockres+0x60a/0xbd0 dlm_unregister_domain+0x53b/0x11d0 o2cb_cluster_disconnect+0xa5/0x110 ocfs2_cluster_disconnect+0x73/0xc0 ocfs2_dlm_shutdown+0x311/0x440 The buggy address belongs to the object at ffff8881190e3c00 which belongs to the cache o2dlm_mle of size 480 The buggy address is located 32 bytes inside of freed 480-byte region [ffff8881190e3c00, ffff8881190e3de0) Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0038-v9-659f247ea980d5f3fbeb@gmail.com Fixes: 6714d8e86bf4 ("[PATCH] OCFS2: The Second Oracle Cluster Filesystem") Signed-off-by: Cen Zhang Signed-off-by: Andrew Morton Reviewed-by: Joseph Qi Assisted-by: LLM Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Jia-Ju Bai Cc: Cc: Signed-off-by: Sasha Levin commit 8c3a11101a8599275e805363dc746386cc4a86f2 Author: Nickolai Zeldovich Date: Fri Oct 23 22:01:52 2026 -0400 panic: zero the dynamically allocated taint buffer [ Upstream commit 723982e7052e65c3b31e8e8c815ffaf2ecfeaa8f ] A %s read of print_tainted()'s string can run past the end of the taint buffer while another CPU rebuilds a longer string in it, reading slab memory out of bounds into the kernel log (a KASAN slab-out-of-bounds report at taint_buf + size). A warning or an unhandled-signal dump on another CPU reaches print_tainted() through dump_stack_print_info(). alloc_taint_buf() sizes the buffer for the longest taint string and allocates it with kmalloc(), so the bytes past that string are never written and the object holds no permanent NUL terminator. _print_tainted() rebuilds the string in place without locking and writes the terminator last, so a reader that overtakes a writer extending the string past the previous high-water mark finds no terminator inside the object and walks off its end. print_tainted()'s kernel-doc promises the string is "always NULL terminated", a guarantee the previous zero-filled static buffer kept. Allocate the buffer with kzalloc() so its trailing bytes stay NUL and every reader stops inside the object. Reproduced on QEMU riscv64 under KASAN by growing the taint set while processes took unhandled-signal dumps on several CPUs: the unpatched kernel reports a slab-out-of-bounds read at taint_buf + size, the patched one is clean. Link: https://lore.kernel.org/20261024020153.830459-1-nickolai@csail.mit.edu Fixes: a9dff0d0d11c ("kernel/panic: allocate taint string buffer dynamically") Signed-off-by: Nickolai Zeldovich Signed-off-by: Andrew Morton Reviewed-by: Bradley Morgan Reviewed-by: Petr Mladek Cc: Rio Cc: Signed-off-by: Sasha Levin commit c5335d7512745bfb4333de1f971d0e9d7b4b1f74 Author: Cen Zhang Date: Tue Oct 27 12:31:44 2026 +0800 ocfs2: keep locking_state within the cluster connection lifetime [ Upstream commit 5bdef466851e39ba752634cbea68e5ea24ccfb24 ] The locking_state reader calls ocfs2_dlm_lvb() through the selected cluster stack. Its debug-object reference keeps the tracking list alive, but does not keep that stack selected without a cluster connection. DLM initialization publishes the file before establishing its connection, and DLM shutdown drops the connection while the file still exists. Both the mount error unwind in ocfs2_mount_volume() and ocfs2_dismount_volume() remove the debugfs subtree only after ocfs2_dlm_shutdown() has returned. Whenever the disconnect releases the last stack reference, which is the case for a failed mount and for any unmount without a pending hangup, a concurrent reader dereferences a NULL active_stack: Mount error unwind Debugfs reader ------------------ -------------- ocfs2_mount_volume(): out_dlm ocfs2_dlm_shutdown() disconnect last cluster clear active_stack read locking_state ocfs2_dlm_seq_show() ocfs2_dlm_lvb() dereference active_stack fill_super(): out_debugfs remove debugfs subtree Publish the debug files only after the connection and the mount lock resources are initialized, so a failed DLM initialization has no debug reference to drop. Remove them again in the common DLM shutdown helper before the connection is dropped: debugfs removal waits for readers that are inside the file operations, and the parent directory is still present at that point in every caller. This covers the mount error unwind, the ocfs2_fill_super() failures after a successful mount that dismount with mnt_err set, and unmounts whose disconnect releases the stack directly. Only the relevant frames of the report are kept: Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] RIP: 0010:ocfs2_dlm_lvb+0x38/0xf0 Call Trace: ocfs2_dlm_seq_show+0x36a/0xb70 seq_read_iter+0x480/0x1110 seq_read+0x362/0x5a0 full_proxy_read+0x11f/0x180 vfs_read+0x1a0/0xc20 ksys_read+0x111/0x200 Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0011-v7-61e3ef8b1ad44ac2e817@gmail.com Fixes: 286eaa95c5c5 ("ocfs2: Break out stackglue into modules.") Signed-off-by: Cen Zhang Signed-off-by: Andrew Morton Reviewed-by: Joseph Qi Assisted-by: LLM Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Jia-Ju Bai Cc: Cc: Signed-off-by: Sasha Levin commit 17b11430aea332383626db880dd893c87f10774b Author: Cen Zhang Date: Mon Oct 26 19:04:00 2026 +0800 ocfs2: validate move extents against a stable EOF [ Upstream commit 84db6619cb702c37cf848b450c21b9c9706b0775 ] The move-extents range must be bounded by the inode size used for extent movement. ocfs2_ioctl_move_extents() checks and clamps the request before taking the local inode and cluster locks in ocfs2_move_extents(). It also uses separate i_size_read() calls for the range check and subtraction. A concurrent truncate can invalidate the first check and make the later unsigned subtraction underflow: Move-extents ioctl Truncate ------------------ -------- check me_start <= i_size take inode and cluster locks shrink EOF below me_start release locks compare me_start + me_len with EOF set me_len = EOF - me_start [unsigned underflow] acquire inode and cluster locks select extents using the bad range A truncate after clamping can also leave the range extending beyond EOF. Conversely, the cached size may be smaller than the size refreshed when the cluster inode lock is acquired. Early validation can then reject a valid start or permanently shorten the requested length and threshold. The me_start + me_len comparison can also wrap for a large input length. Validate and adjust the original request once, after inode_lock(), the exclusive rw lock and ocfs2_inode_lock() have stabilized and refreshed the size. Read EOF once, reject a start beyond it, and bound the length by EOF minus start. Normalize the threshold using the same EOF snapshot. This keeps zero as the default-threshold sentinel until validation uses the size that will govern extent movement. Move goal validation after range adjustment as well. Its allocation-group capacity check uses me_len and must see the EOF-clamped length. Both validation failures use the existing inode-lock unwind path before any extent movement or transaction starts. Range errors now reach the ioctl's normal copyout path, as goal errors already did. Unlike the old early rejection, a failed copyout can therefore override -EINVAL with -EFAULT. Link: https://lore.kernel.org/pm-ocfs2-move-extents-isize-rrw-v6-395bdee84ea81149068e@gmail.com Fixes: 53069d4e7695 ("Ocfs2/move_extents: move/defrag extents within a certain range.") Signed-off-by: Cen Zhang Signed-off-by: Andrew Morton Suggested-by: Joseph Qi Reviewed-by: Joseph Qi Assisted-by: LLM Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Jia-Ju Bai Cc: Cc: A truncate after clamping can also leave the range extending beyond EOF. Conversely, the cached size may be smaller than the size refreshed when the cluster inode lock is acquired. Early validation can then reject a valid start or permanently shorten the requested length and threshold. The me_start + me_len comparison can also wrap for a large input length. Validate and adjust the original request once, after inode_lock(), the exclusive rw lock and ocfs2_inode_lock() have stabilized and refreshed the size. Read EOF once, reject a start beyond it, and bound the length by EOF minus start. Normalize the threshold using the same EOF snapshot. Signed-off-by: Sasha Levin commit 865fda3f2acb2ed14c4923853a77aec536480041 Author: Matheus Alves de Almeida Date: Wed Oct 21 13:21:04 2026 -0300 fat: hold truncate_lock in fat_write_failed() [ Upstream commit 7b90009546f5d3f3ac9428040cd7ffbdfd60f2eb ] The current fat_write_failed() implementation calls into fat_truncate_blocks() without holding truncate_lock. A failed or short extending write racing with FIBMAP can spuriously make a FAT filesystem read-only. FIBMAP bounds its lookup by i_blocks, so it can walk allocated clusters beyond i_size while fat_write_failed() is removing them. If the chain is shortened during the walk, the mapper can report a bogus "request beyond EOF" error, triggering the default read-only error policy. Hold truncate_lock for write around the block cleanup to serialize it with _fat_bmap(). For comparison, fat_setattr() correctly holds truncate_lock during truncation: down_write(&MSDOS_I(inode)->truncate_lock); truncate_setsize(inode, attr->ia_size); fat_truncate_blocks(inode, attr->ia_size); up_write(&MSDOS_I(inode)->truncate_lock); Make it so ->truncate_lock is held exclusive while truncating. Link: https://lore.kernel.org/20261021162105.62525-1-matheus.aalmeida@inf.ufrgs.br Fixes: 16fab2015099 ("fat: permit to return phy block number by fibmap in fallocated region") Fixes: 459f6ed3b8c7 ("fat: convert to use the new truncate convention.") Signed-off-by: Matheus Alves de Almeida Signed-off-by: Andrew Morton Acked-by: OGAWA Hirofumi Cc: Pedro Falcato Cc: Signed-off-by: Sasha Levin commit 2260538525ee5f69e889d0bb1dc8146a3fce8294 Author: Joseph Qi Date: Sat Oct 24 23:10:12 2026 +0800 ocfs2: do not read the entry array of an empty xattr block [ Upstream commit cd7c3563a98fe8c984463d83772e518cb7e68356 ] ocfs2_cp_xattr_block_to_bucket() sizes the name and value area it has to carry over from the block's last entry, so an empty block makes it read xh_entries[-1]. That lands on the header, where xe_name_offset overlaps xh_name_value_len, and block storage never maintains that field, so it reads as 0 and the copy runs from the header to the end of the block. The bucket that comes out has xh_count 0 but a name_value_len of blocksize less the header, and a matching xh_free_start that claims those bytes are in use -- nearly the whole bucket with the common 4K block size -- while the last block of the bucket holds a copy of the old block's bytes. Nothing but a trace event reads xh_name_value_len, the copied bytes came from the same inode and were wiped before the entry was removed, and ocfs2_defrag_xattr_bucket() recomputes xh_free_start, so this corrupts the header rather than leaking anything. Leave the bucket empty instead, carrying over the hash the block was keyed by, since ocfs2_add_new_xattr_bucket() and ocfs2_xattr_bucket_find() both read xh_entries[0] of an empty bucket. That read is the exception ocfs2_xa_remove_entry() documents rather than a new out of bounds access. A block reaches the conversion empty when truncating an external value back fails partway through: the "reusing" and "overwriting" callers of ocfs2_xa_cleanup_value_truncate() remove the entry without setting ctxt->set_abort, so ocfs2_xattr_block_set() sees a plain -ENOSPC and converts. The "growing" caller does set it, and the block form makes a single attempt with no defragment and retry in between, so that is the only route here. Link: https://lore.kernel.org/20261024151012.1059683-7-joseph.qi@linux.alibaba.com Fixes: 012255961c9e ("ocfs2: Enable xattr set in index btree") Signed-off-by: Joseph Qi Signed-off-by: Andrew Morton Cc: Heming Zhao Cc: Mark Fasheh Cc: Joel Becker Cc: Signed-off-by: Sasha Levin commit b710975d07b049c957ba6b93985b1cf9b169ad6e Author: Joseph Qi Date: Sat Oct 24 23:10:11 2026 +0800 ocfs2: do not index before the entry array when dividing an empty bucket [ Upstream commit 7133a0d0954c109f1764ebf8ab32d7e757a6c587 ] ocfs2_divide_xattr_bucket() appends an empty bucket carrying a sentinel hash when the source bucket has no divide position, taking that hash from xh_entries[start - 1]. ocfs2_xattr_find_divide_pos() returns count when every entry shares one hash, and its loop does not run at all for count < 2, so an empty bucket comes back with start == count == 0 and the read is xh_entries[-1]. That is outside the __counted_by_le(xh_count) bounds of xh_entries[] and lands on the header, so the value picked up is xh_count | xh_free_start << 16. One above it is written into the new bucket's xh_entries[0] and committed, which leaves a bucket whose first hash does not follow the bucket before it. ocfs2_xattr_bucket_find() binary searches on xh_entries[0], so the broken key hides the range the sentinel was meant to cover: getxattr() answers -ENODATA for an attribute that is stored, and an insert can go to the wrong bucket and leave two copies of a name. The cross cluster divide hands the same value back as a tree record's e_cpos, which then claims a hash range it does not cover. Read xh_entries[0] instead. The branch is only reached when every entry shares one hash, so for a non-empty bucket it holds the same value, and for an empty one it is the slot that carries the bucket key. An empty bucket reaches the divide from ocfs2_check_xattr_bucket_collision(), which reports no collision for one, through ocfs2_add_new_xattr_bucket() and ocfs2_extend_xattr_bucket(). It does not take a failed set to get there: a divide that finds no position is itself what leaves an empty sentinel bucket behind, and a later extend can pick it as the target. Link: https://lore.kernel.org/20261024151012.1059683-6-joseph.qi@linux.alibaba.com Fixes: 80bcaf3469b8 ("ocfs2/xattr: Proper hash collision handle in bucket division") Signed-off-by: Joseph Qi Signed-off-by: Andrew Morton Cc: Heming Zhao Cc: Mark Fasheh Cc: Joel Becker Cc: Signed-off-by: Sasha Levin commit c3fd72469082ec99670d54f82f0bc6a6e80205d4 Author: Joseph Qi Date: Sat Oct 24 23:10:10 2026 +0800 ocfs2: do not read the entry array of an empty xattr bucket [ Upstream commit e8de099f2958c84aa23186c5481e69f7ffd39355 ] ocfs2_check_xattr_bucket_collision() decides whether splitting a bucket can make room by comparing the hash being inserted against the first and the last entry. xh_count comes off disk and is never checked, and a bucket is allowed to hold no entries: ocfs2_xa_remove_entry() keeps the last slot when it removes the only one, so that an empty bucket still carries the hash it is keyed by. xh_count then reads back as 0 while xh_entries[0] is still meaningful, and the second comparison indexes xh_entries[-1]. That is outside the __counted_by_le(xh_count) bounds of xh_entries[] and lands on the header. An entry is 16 bytes and xe_name_hash is its first field, so the value read is xh_count | xh_free_start << 16. It stays inside the block, but the answer is arbitrary, and for an empty bucket it says there is no collision, so a new bucket gets added on the strength of it. An empty bucket holds no entries to collide with. Return before reading the array. One way to reach the test with an empty bucket is a set that removes the bucket's only entry during cleanup and then fails for space again, since it is that second -ENOSPC which calls this. Growing a value past OCFS2_XATTR_INLINE_SIZE is the easy route: the cluster allocation fails, the "!orig_clusters" arm of ocfs2_xa_cleanup_value_truncate() removes the entry, and although the "growing" caller does set ctxt->set_abort, only ocfs2_xattr_block_set() and __ocfs2_xattr_set_handle() look at it, so ocfs2_xattr_set_entry_index_block() goes straight on to the collision check. This sits on commit a9ea8b397864 ("ocfs2: use the stored hash when checking xattr bucket collision"), which gave the collision check its two argument form and is marked for 6.2 and later. The read fixed here is present in the three argument version too, but a tree without that commit needs the hunk adapted by hand. Link: https://lore.kernel.org/20261024151012.1059683-5-joseph.qi@linux.alibaba.com Fixes: 012255961c9e ("ocfs2: Enable xattr set in index btree") Signed-off-by: Joseph Qi Signed-off-by: Andrew Morton Cc: Heming Zhao Cc: Mark Fasheh Cc: Joel Becker Cc: Signed-off-by: Sasha Levin commit 2bd2ca4f70570f08992ba38dbf2570f8def4288e Author: Joseph Qi Date: Sat Oct 24 23:10:09 2026 +0800 ocfs2: find the xattr entry again after converting a block to a bucket [ Upstream commit 9c191a7a44882487e291e09f095d2ae4d7cca146 ] ocfs2_xattr_create_index_block() turns a non-indexed xattr block into a tree by copying it into a bucket, and the copy sorts the entries: a block holds them in insertion order, a bucket by name hash. ocfs2_xattr_update_xattr_search() nevertheless relocates the caller's search by the index the entry had in the block, so unless the two orders agreed it points at an unrelated entry, and nothing between there and the write compares that entry's name with the one being set. Setting an xattr whose new value no longer fits the block arrives here with xs->not_found clear. The block gave up because ocfs2_xa_block_can_reuse() wants an exact namevalue size match, while ocfs2_xa_bucket_can_reuse() only wants an entry at least as large as the new one, so the bucket accepts a pair the block rejected and the update lands on whichever entry the sort left at that index. Equal padded name lengths get that other attribute's value replaced in place and its name left alone, so setxattr returns success while the attribute asked for keeps its old value. A longer one trips ocfs2_xa_reuse_entry()'s BUG_ON, and a shorter one is refused by the bucket as well, so ocfs2_xa_prepare_entry() wipes the entry and writes the new name over it, leaving xe_name_hash describing a name that is no longer there. Find the entry again by the name being set, matching the type as well. The copy carries every entry and every name over unchanged, and (type, name) pairs are unique within a block, so the match is exact. The type matters because the handlers strip their prefix before calling ocfs2_xattr_set(), so user.foo and trusted.foo share a stored name, a stored length and a hash, and both can sit in the same block. The name has to come from xi rather than from xs->here: a failed set can remove the entry xs->here names, and only the "growing" caller sets ctxt->set_abort, which is what stops the conversion. Scan every entry rather than narrowing on the hash the way ocfs2_find_xe_in_bucket() does, since an existing entry keeps the hash it was stored under, which a kernel that sign-extended the name bytes made different from the one computed now. An empty result means the entry did not survive the failed set and this has become an insert; leaving xs->here alone would keep it pointing into the block, which is rewritten as a tree root before the caller reads it again. Link: https://lore.kernel.org/20261024151012.1059683-4-joseph.qi@linux.alibaba.com Fixes: 012255961c9e ("ocfs2: Enable xattr set in index btree") Signed-off-by: Joseph Qi Signed-off-by: Andrew Morton Cc: Heming Zhao Cc: Mark Fasheh Cc: Joel Becker Cc: Signed-off-by: Sasha Levin commit 8c107f10fe63fdec081c2ae471fc90b4d3376db6 Author: Joseph Qi Date: Sat Oct 24 23:10:08 2026 +0800 ocfs2: find the xattr entry again after defragmenting a bucket [ Upstream commit 9a40c050f58344615a0604701b5d299519833163 ] ocfs2_xattr_set_entry_bucket() hands loc.xl_entry to ocfs2_xa_set() twice: once for the bucket as it stands, and, if that reports -ENOSPC, once more after ocfs2_defrag_xattr_bucket() has packed the name/value pairs down. Defragmenting ends by sorting the entry array on xe_name_hash. Buckets are kept sorted, so the sort only permutes entries that share a hash, but lib/sort.c is an unstable heapsort and it does permute them. loc.xl_entry is an address inside xh_entries[], so afterwards it denotes whichever entry landed in that slot rather than the one the search found. The second ocfs2_xa_set() then works on the wrong entry. Nothing on that path compares the entry's name with xi->xi_name, so what happens depends on how the two entries compare in size: ocfs2_xa_reuse_entry() trips its BUG_ON() when the padded name sizes differ, and otherwise the new value is written into the neighbouring attribute's value slot while the attribute being set is left untouched. setxattr() reports success either way. Remember the entry's hash before defragmenting and look the entry up again afterwards, the way ocfs2_xattr_bucket_find() does. An entry that cannot be found again means the bucket no longer holds what the search found, so fail with -EFSCORRUPTED rather than writing through the stale pointer. Link: https://lore.kernel.org/20261024151012.1059683-3-joseph.qi@linux.alibaba.com Fixes: 012255961c9e ("ocfs2: Enable xattr set in index btree") Signed-off-by: Joseph Qi Signed-off-by: Andrew Morton Cc: Heming Zhao Cc: Mark Fasheh Cc: Joel Becker Cc: Signed-off-by: Sasha Levin commit 5b6a77698ceaba98c28bdbf661f0990b21b25f94 Author: Andrew Morton Date: Wed Oct 28 18:24:22 2026 -0700 openrisc: export __mulsi3 for modules [ Upstream commit 8ff981aa283a0ce516c2dc65a48a185ed336c657 ] OpenRISC configurations without hardware multiplication fail to build modules which contain compiler-generated calls to __mulsi3. The failure is widespread, affecting filesystems, drivers and KUnit tests at modpost. When CONFIG_OPENRISC_HAVE_INST_MUL is disabled, the architecture Makefile passes -msoft-mul to GCC. The multiplication helper is supplied by the libgcc archive linked into vmlinux, but or32_ksyms.c does not export it. Built-in callers can therefore link while module callers cannot resolve the symbol. Export __mulsi3 alongside the other compiler-generated helpers. The omission predates 7c3f4d699f34 ("resource, kunit: stop selecting GET_FREE_REGION"), which the robot identified when reporting an additional failing module. It was already present in the initial OpenRISC export list. Fixes: 616257669e1a ("OpenRISC: Miscellaneous") Signed-off-by: Andrew Morton Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202610290106.o8Fs3NvO-lkp@intel.com/ Reviewed-by: Bradley Morgan Cc: Jonas Bonn Cc: Stefan Kristiansson Cc: Stafford Horne Cc: Arnd Bergmann Cc: Karl Mehltretter Cc: Signed-off-by: Sasha Levin commit 488ff8ec5b723fd5cfff4fdb7dd9269eaf921b5e Author: Nathan Chancellor Date: Thu Oct 8 13:08:49 2026 +0200 lib/base64: silence clang-24 -Wconstant-conversion with diag pragmas [ Upstream commit 3af83c11cf5990fda0bfe3959aa6391ff903ffdd ] After a recent change in clang to warn on signed char conversions within array initializers [1], there are several instances of this warning from base64_rev_maps in lib/base64.c, which can break the build with W=e or CONFIG_WERROR=y: lib/base64.c:58:18: error: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 131 to -125 [-Werror,-Wconstant-conversion] 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',') | ^~~~~~~~~~~~~~~~~~~~~~~~~ lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT' 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \ | ~ 49 | [0 ... 0x1f] = -1, \ 50 | INIT_32(0x20, ch_62, ch_63), \ 51 | INIT_32(0x40, ch_62, ch_63), \ 52 | INIT_32(0x60, ch_62, ch_63), \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ... lib/base64.c:34:42: note: expanded from macro 'INIT_1' 34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \ | ~~~~~~~~~~^~~~ lib/base64.c:58:18: error: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 130 to -126 [-Werror,-Wconstant-conversion] 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',') | ^~~~~~~~~~~~~~~~~~~~~~~~~ lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT' 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \ | ~ 49 | [0 ... 0x1f] = -1, \ 50 | INIT_32(0x20, ch_62, ch_63), \ 51 | INIT_32(0x40, ch_62, ch_63), \ 52 | INIT_32(0x60, ch_62, ch_63), \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ... lib/base64.c:34:42: note: expanded from macro 'INIT_1' 34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \ | ~~~~~~~~~~^~~~ ... These are false positives, as the branch where the wraparound could happen is unreachable with the values that clang reports. This is not considered a bug by some clang folks [2][3], so silence the warnings using the __diag macros the kernel has to workaround compiler warnings when necessary. Link: https://lore.kernel.org/20261008-base64-silence-clang-24-constant-conversion-v1-1-0858b60b23c8@kernel.org Link: https://github.com/llvm/llvm-project/commit/a5ef934a8d295dc03be3960f2b3744ec2e53238e [1] Link: https://github.com/llvm/llvm-project/issues/223923#issuecomment-6056856245 [2] Link: https://github.com/llvm/llvm-project/pull/226775#pullrequestreview-5454407389 [3] Fixes: c4eb7ad32eab ("lib/base64: optimize base64_decode() with reverse lookup tables") Signed-off-by: Nathan Chancellor Signed-off-by: Andrew Morton Closes: https://github.com/ClangBuiltLinux/linux/issues/2181 Acked-by: Kuan-Wei Chiu Cc: Nick Desaulniers Cc: Bill Wendling Cc: Justin Stitt Cc: Guan-Chun Wu <409411716@gms.tku.edu.tw> Cc: Signed-off-by: Sasha Levin commit b558ac673e65b4f302f105a0d9f79fb7cf012330 Author: T.J. Mercier Date: Thu Oct 29 13:18:58 2026 -0700 mm: memcontrol: fix NULL pointer deref and UAF from high_work_func() on dying memcg [ Upstream commit dd94d8c7660a60dbfcd425e0d10120de6d02a7bd ] When memory.high is exceeded in non-task context, try_charge_memcg() schedules memcg->high_work without taking a reference on the memcg, and high_work_func() invokes reclaim_high() without pinning the memcg. With obj_cgroup reparenting, introduced in commit bf4f059954dc ("mm: memcg/slab: obj_cgroup API"), objects charged to a child memcg are reparented to its parent in mem_cgroup_css_offline() instead of holding a reference on the child until uncharged. Subsequent uncharges of those objects go to the parent, which can leave the child's memory use permanently above its high limit, so any later charge on the offlined memcg in non-task context schedules high_work. This was later widened from kernel memory to LRU folios when commit f1cf8d2f36dc ("mm: memcontrol: eliminate the problem of dying memory cgroup for LRU folios") converted LRU folios to use obj_cgroup reparenting. cancel_work_sync(&memcg->high_work) only runs at the end of teardown in mem_cgroup_css_free(), so high_work_func() can start or still be running reclaim_high() after mem_cgroup_css_released() or shrink_many() has called lru_gen_release_memcg() and unhashed lruvec->lrugen.list. If reclaim tries to rotate the memcg, lru_gen_rotate_memcg() dereferences a NULL pprev pointer. This issue is specific to MGLRU and was introduced with the memcg LRU in commit e4dde56cd208 ("mm: multi-gen LRU: per-node lru_gen_folio lists"). With either traditional LRU or MGLRU, css_free_rwork_fn() calls css_rstat_exit() which frees per-CPU rstat data before calling mem_cgroup_css_free(). If reclaim_high() is still running, rstat updates via mod_lruvec_state() -> __css_rstat_updated() cause a use-after-free on the per-CPU rstat data. This was introduced when commit 5da3bfa029d6 ("cgroup: use separate rstat trees for each subsystem") moved css_rstat_exit() ahead of ss->css_free(). Fix both problems by acquiring a reference with css_tryget_online() in high_work_func() before calling reclaim_high(), and by resetting memory.high and swap.high to PAGE_COUNTER_MAX in mem_cgroup_css_offline() so that charges via references on an offlined memcg do not trigger high_work on the dead child and skip checking live ancestors in try_charge_memcg(). Acquiring the reference in high_work_func() rather than before scheduling high_work is safe because mem_cgroup_css_free() calls irq_work_sync() and cancel_work_sync() which cancels pending work and waits for an already running high_work_func() to complete before mem_cgroup_free() frees the memcg. css_tryget_online() uses percpu_ref_tryget_live() and is safe to call after percpu_ref_exit() before the cgroup is freed unlike css_tryget(). Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 1 UID: 0 PID: 27 Comm: kworker/1:0 Tainted: G B W 7.3.0-rc5-g2bba28e98578 #284 PREEMPT(full) Tainted: [B]=BAD_PAGE, [W]=WARN <-- Taint from lru_gen_rotate_memcg() VM_WARN_ON_ONCE Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-debian-1.17.0-1 04/01/2014 Workqueue: events high_work_func RIP: 0010:lru_gen_rotate_memcg+0x1a3/0xe90 Call Trace: ? read_ctrl_pos+0x22f/0x3f0 shrink_lruvec+0x16cb/0x1b80 ? ret_from_fork_asm+0x1a/0x30 ? lapic_next_event+0x15/0x20 ? clockevents_program_event+0x2bb/0x6f0 ? lapic_next_event+0x15/0x20 ? __pfx_shrink_lruvec+0x10/0x10 ? __pfx_clockevents_program_event+0x10/0x10 ? _raw_spin_lock+0x84/0xe0 ? __pfx__raw_spin_lock+0x10/0x10 ? kasan_save_stack+0x30/0x50 ? psi_group_change+0x381/0x740 ? __pfx_sched_clock_cpu+0x10/0x10 ? save_fpregs_to_fpstate+0xc4/0x2c0 ? finish_task_switch.isra.0+0x1de/0xac0 ? __schedule+0xf62/0x42c0 ? __pfx___schedule+0x10/0x10 ? __pfx___irq_work_queue_local+0x10/0x10 ? shrink_node+0x626/0x31e0 shrink_node+0x626/0x31e0 ? ring_buffer_unlock_commit+0x11d/0x5c0 ? kswapd_clear_hopeless+0xa0/0x150 ? __pfx_shrink_node+0x10/0x10 ? 0xffffffffc0000095 do_try_to_free_pages+0x255/0x13b0 ? ring_buffer_unlock_commit+0x11d/0x5c0 ? reclaim_high+0x10a/0x1b0 try_to_free_mem_cgroup_pages+0x1f9/0x5a0 ? __pfx_try_to_free_mem_cgroup_pages+0x10/0x10 ? irqentry_exit+0xc6/0x670 reclaim_high+0x10a/0x1b0 ? __pfx_reclaim_high+0x10/0x10 ? process_one_work+0x5ff/0x1030 ? __pfx_high_work_func+0x10/0x10 process_one_work+0x6e2/0x1030 ? __pfx___schedule+0x10/0x10 ? __pfx_process_one_work+0x10/0x10 worker_thread+0x422/0xbb0 ? __pfx_worker_thread+0x10/0x10 kthread+0x2cd/0x3a0 ? recalc_sigpending+0x15c/0x200 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x368/0x590 ? __pfx_ret_from_fork+0x10/0x10 ? __switch_to+0x588/0xf50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 Link: https://lore.kernel.org/20261029201858.2932905-1-tjmercier@google.com Fixes: e4dde56cd208 ("mm: multi-gen LRU: per-node lru_gen_folio lists") Fixes: 5da3bfa029d6 ("cgroup: use separate rstat trees for each subsystem") Signed-off-by: T.J. Mercier Signed-off-by: Andrew Morton Reviewed-by: Johannes Weiner Acked-by: Muchun Song Acked-by: Shakeel Butt Acked-by: Michal Hocko Cc: Michal Hocko Cc: Roman Gushchin Cc: Qi Zheng Cc: JP Kobryn Cc: Signed-off-by: Sasha Levin commit 167d6b31a447902c205b34638a6c90b55253f216 Author: Mike Rapoport (Microsoft) Date: Thu Oct 29 12:18:38 2026 +0200 mm/cma: accept memory of CMA areas reserved at a fixed address [ Upstream commit f8f9cbc34a309a388c052706f3329d1b52985aa3 ] CMA areas allocated from memblock have their memory accepted by memblock_alloc_range_nid(), but areas reserved at a fixed address with memblock_reserve() are not. If a fixed CMA area is requested by the cma=@ command line parameter, it may be in regular RAM and on TDX and SEV-SNP guests it must be accepted. Accept the memory of fixed CMA areas as well, so that all CMA areas are accepted regardless of how they were reserved. Link: https://lore.kernel.org/20261029-cma-multi-v1-2-2cbced8b5cb7@kernel.org Fixes: 75d090fd167a ("x86/tdx: Add unaccepted memory support") Signed-off-by: Mike Rapoport (Microsoft) Signed-off-by: Andrew Morton Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: Pankaj Gupta Tested-by: Pankaj Gupta Cc: David Hildenbrand Cc: Liam R. Howlett Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Signed-off-by: Sasha Levin commit 89b722ba00b0a6efd3ea14c1fc7996eb3b5a22c1 Author: Mike Rapoport (Microsoft) Date: Thu Oct 29 12:18:37 2026 +0200 mm/cma: accept memory of multi-range CMA areas [ Upstream commit 5d002001601a163b6c3500cdc098ff66c34f62d8 ] Patch series "mm/cma: accept memory of CMA areas reserved with memblock_reserve()", v1. Pages of allocated CMA areas are released to the buddy allocator with __free_pages(), which does not check for unaccepted memory. This usually works because memblock accepts the memory it allocates. However, multi-range CMA areas, used by hugetlb_cma, and fixed CMA areas requested with cma=@ are reserved with memblock_reserve() and their memory is never accepted. On TDX and SEV-SNP guests the first access to such a page is fatal. To ease the backporting, each case is addressed by a separate patch: - patch 1 accepts the memory of multi-range CMA areas - patch 2 does the same for the fixed CMA areas The second patch won't apply cleanly to 6.6 and 6.12, but I believe the stable team LLMs will take care of that :) This patch (of 2): On systems with unaccepted memory, memblock allocations accept the allocated range, but when cma_declare_contiguous_multi() uses open coded allocation of multiple ranges, it reserves them with memblock_reserve() and they are never accepted. These pages are released to the buddy allocator by cma_activate_area() with __free_pages() that does not check for unaccepted memory, so the first access to such a page in a TDX or SEV-SNP guest is fatal. Accept the memory of each range when it is reserved. Link: https://lore.kernel.org/20261029-cma-multi-v1-0-2cbced8b5cb7@kernel.org Link: https://lore.kernel.org/20261029-cma-multi-v1-1-2cbced8b5cb7@kernel.org Fixes: c009da4258f9 ("mm, cma: support multiple contiguous ranges, if requested") Signed-off-by: Mike Rapoport (Microsoft) Signed-off-by: Andrew Morton Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: Pankaj Gupta Tested-by: Pankaj Gupta Cc: David Hildenbrand Cc: Liam R. Howlett Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Signed-off-by: Sasha Levin commit 296b3ba06f29ee085bdb1616affe5edb2413886b Author: Johannes Weiner Date: Wed Oct 28 13:15:54 2026 -0400 mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES [ Upstream commit fe21f930d1e64d121191673076fc4ebe79fc82d5 ] 1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH non-blocking allocations accesses reserves") stopped handing out reserve access for ALLOC_NON_BLOCK on its own: the extra 25% below the min watermark is now only granted on top of ALLOC_MIN_RESERVE. But the flag was left in ALLOC_RESERVES, which produces something odd: With the ALLOC_RESERVES match, __zone_watermark_unusable_free() doesn't subtract the free highatomic pages for them. So in the slowpath, they get to consume regular blocks below the min watermark by the number of free highatomic pages. The highatomic reserve is capped at 1% of the zone, which on any decently sized machine is a multiple of the min watermark: GFP_NOWAIT can drain regular memory to zero. The user-visible result is brutal hiccups during bursts of GFP_NOWAIT allocations under memory pressure. This was found in review and reproduced with a synthetic burst, not observed in production, but the sequence of events is a realistic one: On a 32G box with an anonymous working set, swap, and a filled 290M highatomic reserve, a GFP_NOWAIT burst drove regular free memory in the 28G Normal zone (min=60M) to 28M, 0.8M and 0.6M in three runs. Swapout failed to allocate its swap table, reclaim scanned 13M pages to reclaim 200k, page faults stalled for tens to hundreds of milliseconds. The machine survives it, but not by design: direct reclaimers eventually fail and start unreserving highatomic blocks, until the allocation succeeds or the reserve is gone and the OOM killer runs. That reserve exists for high-order atomic allocations; here it is destroyed to bail out a GFP_NOWAIT consumer that was never entitled to the memory. Remove ALLOC_NON_BLOCK from ALLOC_RESERVES. With that, the GFP_NOWAIT burst is stopped short at the min watermark. No direct reclaim, no stalls, no failed allocations, and the highatomic reserve stays intact for the requests it exists for. __zone_watermark_ok() is unaffected, since everything it keys on ALLOC_NON_BLOCK is already nested under ALLOC_MIN_RESERVE. Update the flag comments accordingly: ALLOC_NON_BLOCK just means the caller can't block; the reserve math belongs with ALLOC_MIN_RESERVE. GFP_ATOMIC order-0 requests have a milder version of the same problem. Through ALLOC_MIN_RESERVE they also count the free highatomic pages in their watermark check, but rmqueue_buddy() serves them regular pages first and only falls back to the reserve once those are gone. They can still push regular free memory to 37.5% of min minus the free highatomic pages before the reserve is touched. Unlike GFP_NOWAIT they are entitled to the reserve, so this needs the watermark check and the freelist order reworked together, and is left to a separate patch. Link: https://lore.kernel.org/20261028171719.2043421-3-hannes@cmpxchg.org Fixes: 1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH non-blocking allocations accesses reserves") Signed-off-by: Johannes Weiner Signed-off-by: Andrew Morton Acked-by: Balbir Singh Reviewed-by: Vlastimil Babka (SUSE) Cc: Matthew Wilcox (Oracle) Cc: Salvatore Dipietro Cc: Christoph Hellwig Cc: Dave Chinner Cc: Matt Fleming Cc: Mel Gorman Cc: Michal Hocko Cc: Suren Baghdasaryan Cc: Brendan Jackman Cc: Zi Yan Cc: Signed-off-by: Sasha Levin commit fb413b6201f1c8bbd7dee8ee369d1419b4f566ee Author: Johannes Weiner Date: Wed Oct 28 13:15:53 2026 -0400 mm: page_alloc: do not give all non-blocking requests reserve access [ Upstream commit 6ee3d87b940848aaed5d4e8d005c5f674bf2637a ] Patch series "mm: page_alloc: fix reserve access for non-blocking requests", v2. Two fixes for how non-blocking allocations interact with the highatomic reserve. There are prerequisites for Salvatore's "mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations" [0]. Patch 1 narrows which requests may physically take highatomic pages, patch 2 narrows which requests may count them in their watermark check. Both are prerequisites for Salvatore's patch: it clears __GFP_DIRECT_RECLAIM for costly __GFP_NORETRY requests, which turns every large page cache folio allocation that reaches the slowpath into a non-blocking one. Without patch 1, those requests may fall back to the highatomic freelists reserved for atomic requests. Without patch 2, they count the free highatomic pages in their watermark check while being served from regular memory, so they can consume regular high-order blocks below the min watermark by the size of the reserve. GFP_NOWAIT requests hit both paths today, so these are existing problems worthy of their own stable backports; but Salvatore's patch would widen them significantly. Patch 2 reproduction: a GFP_NOWAIT burst under memory pressure can drain regular free memory to zero while the highatomic reserve sits idle. Measured on a 32G box with an anonymous working set, swap, and a full 290M reserve, three synthetic bursts drove the 28G Normal zone's regular free memory to 28M, 0.8M and 0.6M against a 60M min watermark. Swapout failed its swap table allocation inside reclaim, reclaim scanned 13M pages to free 200k, and page faults stalled for tens to hundreds of milliseconds. With the fix the burst stops at the min watermark and nothing else happens. This was found in review and reproduced synthetically; it has not been observed in production. GFP_ATOMIC order-0 requests have a milder version of the same problem: They are entitled to the reserve but are served regular memory first, so the fix there has to change the watermark check and the freelist order together. Salvatore's change doesn't interact with this, though; fixing that is left for a separate patch. This patch (of 2): 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves") accidentally gave all non-blocking allocation requests access to highatomic reserves, which includes GFP_NOWAIT and other sites clearing __GFP_DIRECT_RECLAIM. While this improved atomic request success rate, it's unintentionally broad and can actually worsen highatomic requests by squandering the reserves on requests that don't need it. There are concurrent efforts to clear __GFP_DIRECT_RECLAIM altogether for costly order __GFP_NORETRY requests, which would then also fall into this exemption and deplete reserves even faster. What GFP_ATOMIC has over the others is __GFP_HIGH, which alloc_flags_slowpath() translates to ALLOC_MIN_RESERVE. Narrow the exemption to contexts that have both ALLOC_NON_BLOCK | ALLOC_MIN_RESERVE. Link: https://lore.kernel.org/20261001082152.2879289-1-dipiets@amazon.it [0] Link: https://lore.kernel.org/linux-mm/arFBWvzXPYrKuIYi@cmpxchg.org/ [1] Link: https://lore.kernel.org/linux-mm/20261001082152.2879289-1-dipiets@amazon.it/ [2] Link: https://lore.kernel.org/20261028171719.2043421-1-hannes@cmpxchg.org Link: https://lore.kernel.org/20261028171719.2043421-2-hannes@cmpxchg.org Fixes: 281dd25c1a01 ("mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves") Signed-off-by: Johannes Weiner Signed-off-by: Andrew Morton Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260904115629.3993331-1-dipiets@amazon.it Acked-by: Balbir Singh Reviewed-by: Vlastimil Babka (SUSE) Cc: Matthew Wilcox (Oracle) Cc: Salvatore Dipietro Cc: Christoph Hellwig Cc: Dave Chinner Cc: Matt Fleming Cc: Mel Gorman Cc: Michal Hocko Cc: Suren Baghdasaryan Cc: Brendan Jackman Cc: Zi Yan Cc: regular free memory to zero while the highatomic reserve sits idle. Measured on a 32G box with an anonymous working set, swap, and a full 290M reserve, three synthetic bursts drove the 28G Normal zone's regular free memory to 28M, 0.8M and 0.6M against a 60M min watermark. Swapout failed its swap table allocation inside reclaim, reclaim scanned 13M pages to free 200k, and page faults stalled for tens to hundreds of milliseconds. Signed-off-by: Sasha Levin commit e570f2c29fc07a1040c3736bf1a1dfa8065d5099 Author: Kiryl Shutsemau (Meta) Date: Wed Oct 28 13:26:21 2026 +0000 mm/hugetlb_vmemmap: map the shared tail page writable [ Upstream commit 0120a603afadba8ab4954bb1ce60f8195f80efc8 ] page_ref_add_unless_zero() reads the refcount and then updates it with a cmpxchg. A lockless get, such as a page cache lookup or a PFN scanner, can read a non-zero refcount from a page that is then freed and reused as a hugetlb tail page. If HVO remaps its struct page to the shared tail page in between, the cmpxchg writes to read-only vmemmap: CPU0 (lockless get) CPU1 c = atomic_read(&page->_refcount) page freed page allocated as a hugetlb tail HVO remaps the struct page RO try_cmpxchg(&page->_refcount, &c, c + 1) -> write fault on read-only vmemmap The refcount is zero by then and the compare fails, but a compare-and-swap instruction needs write access whether or not it succeeds. The kernel oopses when hugetlb pages are allocated at runtime with HVO enabled while a lockless get races with it. Commit bd225530a4c7 ("mm/hugetlb_vmemmap: fix race with speculative PFN walkers") closed the window with RCU on both sides. The RCU was removed together with fake heads, on the wrong belief that it was only needed for them. Map the shared tail page writable instead of restoring the RCU. Every struct page on it is a tail with a zero refcount, so a late cmpxchg fails and leaves the page unchanged. RCU would put rcu_read_lock() back around every get and synchronize_rcu() back into hugetlb allocation and freeing. The cost is the protection against stray writes to tail struct pages. The shared page is shared by all hugetlb folios of the same order in the zone, so such a write now corrupts all of them instead of oopsing. Bootmem folios optimized when the memmap is set up keep their tails read-only. Nothing does a lockless get on them before hugetlb takes them over. Link: https://lore.kernel.org/20261028132623.2560146-1-kirill@shutemov.name Fixes: 32c440d67e6c ("mm: drop fake head checks") Fixes: 01b1d0ffb6f7 ("hugetlb: remove VMEMMAP_SYNCHRONIZE_RCU") Signed-off-by: Kiryl Shutsemau (Meta) Signed-off-by: Andrew Morton Reported-by: David Hildenbrand (Arm) Closes: https://lore.kernel.org/r/ebc7bde1-f52e-4da8-b16f-822d6c0a4d74@kernel.org Acked-by: Muchun Song Reviewed-by: Oscar Salvador Cc: Peter Zijlstra Cc: Frank van der Linden Cc: Matthew Wilcox (Oracle) Cc: Lorenzo Stoakes Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Jonathan Corbet Cc: Shuah Khan Cc: Randy Dunlap Cc: Signed-off-by: Sasha Levin commit c2c7816566288e424bb85f54c2430b227165517b Author: Lorenzo Stoakes (ARM) Date: Tue Oct 27 11:25:20 2026 +0000 mm/vma: update VMA iterator state on error in new VMA merge [ Upstream commit 168ed9c5d5ec2fd326715eba5750c2b69e559ff3 ] Commit cacded5e42b9 ("mm: avoid using vma_merge() for new VMAs") shared code between vma_merge_new_range() and vma_expand(). However in doing so, it failed to correctly restore the VMA iterator when vma_expand() errors out. This is a problem when the immediately preceding VMA is mergeable and vmg->just_expand isn't specified, at which point the VMA iterator is moved to the previous VMA. (Note that vmg->just_expand is a special case for brk(), where the iterator will already be positioned at the VMA to be expanded.) Resolve things by restoring the VMA iterator on error. Use vma_iter_next_range() to do this, so it will correctly stop on the gap after the previous VMA, rather than skip to the next VMA after it (this is a new VMA merge, so is being applied at a gap). To isolate the error handling, return early when a merge isn't possible (what the vmg->target check was doing before), then handle the merge success/failure case explicitly. While here, update vma_expand() to jump to the nomem case when dup_anon_vma() fails, so vmg->state is correctly updated. This doesn't impact anything in practice, but is the correct course and since it's part of the error path that this patch addresses, it makes sense to update it also. Users are very unlikely to have observed the issue this patch addresses in practice, as it is near-impossible to fail an allocation for an anon_vma, but a process under memory pressure that receives a fatal signal could trigger it. This issue was originally reported by Li Jinyue for which I am grateful. He indicated this was uncovered by a private syzkaller instance. Link: https://lore.kernel.org/20261027-fix-new-merge-bug-v1-1-7023a787e6b9@kernel.org Fixes: cacded5e42b9 ("mm: avoid using vma_merge() for new VMAs") Signed-off-by: Lorenzo Stoakes (ARM) Signed-off-by: Andrew Morton Reported-by: Li Jinyue Closes: https://lore.kernel.org/all/20261025093921.1011927-1-jinyue.li@linux.alibaba.com/ Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Jann Horn Cc: Pedro Falcato Cc: Signed-off-by: Sasha Levin commit 632853f04454fd1f424996070f636856796a8efb Author: Yafang Shao Date: Tue Oct 27 10:17:20 2026 +0800 mm/migrate: snapshot the source nid before the misplaced migration [ Upstream commit fe623a81ad9eddf10059b4e44bca0440d9120613 ] A successful migration frees the source folio before the promotion counter update, so the folio_nid() read there operates on a freed folio — which may already have been reallocated. It happens to work today, as Zi explained: : Strictly speaking, it can be seen as a benign UAF. It works, because : 1. folio->flags happens to be the same as page->flags, : 2. folio/page nid is stored in the ->flags and never changed. : : In memdesc world, after a folio is freed, I assume folio->flags would be : zeroed since struct folio is freed and calling folio_nid() on a freed : folio would give a bogus result (yeah, it can be mitigated by not : zeroing node field and each node has its own struct folio pool, but that : makes folio_nid() implementation dependent). and Matthew explained further: : once struct folio is separately allocated, it's a UAF. It could be : recycled to a different NID or maybe the slab containing the folio could : be freed (assuming we're not holding the RCU read lock at this point in : migration, and I don't see why we would be). A separate concern is memory hot-removal. With memory-tiering mode enabled, successful migration can release the source before the promotion-accounting folio_nid() read. If the task is preempted there, an otherwise-free source block can be offlined and removed first. On the x86 path, removal can unmap the source's vmemmap, so the later read can fault. The snapshot avoids that read. Link: https://lore.kernel.org/20261027021721.95781-1-laoar.shao@gmail.com Fixes: e39bb6be9f2b ("NUMA Balancing: add page promotion counter") Signed-off-by: Yafang Shao Signed-off-by: Andrew Morton Suggested-by: Zi Yan Suggested-by: Andrew Morton Acked-by: Zi Yan Acked-by: David Hildenbrand (Arm) Cc: Ying Huang Cc: Matthew Wilcox Cc: Matthew Brost Cc: Joshua Hahn Cc: Byungchul Park Cc: Gregory Price Cc: Alistair Popple Cc: Signed-off-by: Sasha Levin commit 5cf7267b79f276c27825a2ebb95deda788a29e77 Author: Lance Yang Date: Mon Oct 26 21:00:54 2026 +0800 mm/ksm: fix userfaultfd protection during merge and unmerge [ Upstream commit 990d6c2194a938a19a8cf94c6cfd75171345089b ] KSM loses userfaultfd protection when replace_page() builds a new PTE from vma->vm_page_prot. Dropping its uffd bit lets a subsequent write go through ordinary COW instead of userfaultfd write protection handling. For RWP, a merged page also becomes readable without faulting. Keeping the uffd bit and restoring PAGE_NONE fixes merging, but we also have to handle unmerging. An existing KSM page can be protected with RWP before MADV_UNMERGEABLE, so unmerging already needs fixing independently of preserving RWP during merging. Unsharing replaces a shared page with a private one and should leave userfaultfd protection in place, as do_wp_page() already does for write protection. Currently, an unshare fault reaches do_uffd_rwp() before it can proceed to do_wp_page(). - With synchronous RWP, handle_userfault() returns VM_FAULT_SIGBUS. break_ksm() then reports success with a KSM page still merged. - With asynchronous RWP, protection is cleared before unsharing. Preserve the uffd bit when merging, and restore PAGE_NONE for RWP. Let FAULT_FLAG_UNSHARE skip RWP fault handling and keep PAGE_NONE on each private copy as well. Unsharing can then complete with RWP still armed for a subsequent access. Link: https://lore.kernel.org/20261026130054.91461-1-lance.yang@linux.dev Link: https://lore.kernel.org/all/20261019010934.697895-1-samarth.colleges@gmail.com/ Link: https://lore.kernel.org/all/20261020055518.36087-1-lance.yang@linux.dev/ Fixes: 63b2d4174c4a ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl") Fixes: 2d427bb01639 ("mm/userfaultfd: add RWP fault delivery and expose UFFDIO_REGISTER_MODE_RWP") Signed-off-by: Samarth Narang Signed-off-by: Lance Yang Signed-off-by: Andrew Morton Co-developed-by: Samarth Narang Acked-by: Lorenzo Stoakes (ARM) Reviewed-by: Kiryl Shutsemau (Meta) Acked-by: David Hildenbrand (Arm) Cc: Mel Gorman Cc: Xu Xin " Cc: Chengming Zhou Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Jérôme Glisse Cc: Andrea Arcangeli Cc: Peter Xu Cc: Bobby Powers Cc: Brian Geffon Cc: Denis Plotnikov Cc: Doug Gilbert Cc: Hugh Dickins Cc: Johannes Weiner Cc: Martin Cracauer Cc: Marty McFadden Cc: Maya Gokhale Cc: Pavel Emelyanov Cc: Rik van Riel Cc: Shaohua Li Cc: James Houghton Cc: Jonathan Corbet Cc: Paolo Bonzini Cc: Sean Christopherson Cc: SJ Park Cc: Zi Yan Cc: Mohammed EL Kadiri Cc: Signed-off-by: Sasha Levin commit e66a0649aefceeb840e9517416b5809466297fba Author: Hungyu Lin Date: Mon Oct 26 19:53:29 2026 +0000 mm/migrate: untag addresses when querying page nodes [ Upstream commit 7d8746d7dc9cc4003661011424e5880ea7ae364b ] When move_pages() is used with nodes == NULL, do_pages_stat_array() passes each page address directly to vma_lookup(). A valid tagged address therefore fails the VMA lookup and gets -EFAULT in its status entry, instead of the node reported for the corresponding untagged address. The tagged address ABI permits these pointers, and the migration path already removes their tags. Apply the target mm's untagging rules to the query path as well, while holding its mmap read lock. Link: https://lore.kernel.org/20261026195330.46757-1-dennylin0707@gmail.com Fixes: 057d3389108e ("mm: untag user pointers passed to memory syscalls") Signed-off-by: Hungyu Lin Signed-off-by: Andrew Morton Reported-by: Sashiko Closes: https://lore.kernel.org/r/20260721183257.706661F000E9@smtp.kernel.org Acked-by: Zi Yan Acked-by: David Hildenbrand (Arm) Reviewed-by: Catalin Marinas Cc: Matthew Brost Cc: Joshua Hahn Cc: Byungchul Park Cc: Gregory Price Cc: Ying Huang Cc: Alistair Popple Cc: Andrey Konovalov Cc: Vincenzo Frascino Cc: Cc: Signed-off-by: Sasha Levin commit 56858c2ccc8faa3235932e61e8a93bcdf9d80321 Author: Chris Down Date: Mon Oct 26 22:31:03 2026 +0800 mm: make swapoff interruptible when unusing mms/shmem [ Upstream commit 740128dd1a3f2bd81a80314d079b6b03c39ba3af ] try_to_unuse() only checks for a pending signal between mms, and shmem_unuse() doesn't check at all. That means that once swapoff gets to a process or a shmem file with a lot swapped out, nothing can interrupt it until every last page of it has been read back in. Just as one example of where this can concretely show up, freezing tasks for suspend or hibernation has to wait for swapoff to notice the freezer's fake signal, and gives up after freeze_timeout_msecs (20 seconds by default). Here's a facetious example where one swaps out 2GiB of one process to a swap file on ext4, starts swapoff, and half a second later tries to freeze with pm_test=freezer. Writing to /sys/power/state then fails with EBUSY and this in dmesg: Freezing user space processes failed after 20.003 seconds (1 tasks refusing to freeze, wq_busy=0): task:swapoff state:D stack:0 pid:3175 tgid:3175 ppid:2955 task_flags:0x400100 flags:0x00000419 Call trace: [...] io_schedule+0x44/0x70 folio_wait_bit_common+0x1ec/0x3d0 __folio_lock+0x24/0x40 unuse_pte_range+0x2d0/0x348 unuse_vma+0x158/0x248 unuse_mm+0xfc/0x150 try_to_unuse+0x104/0x3f8 __do_sys_swapoff+0x220/0x5d8 [...] The same goes for anything else that wants swapoff to stop, like an admin hitting ^C in a panic, of course. Prior to commit b56a2d8af914 ("mm: rid swapoff of quadratic complexity") try_to_unuse() was driven by find_next_to_unuse() which checks for a signal before every entry, so let's restore that behaviour. Just as an example of the improvements, here's how long freezing takes in the same test while swapoff is happening on my computer: before after 400MiB anon 8.925s 0.028s 400MiB shmem 1.639s 0.003s 2GiB anon failed after 20.003s 0.011s Link: https://lore.kernel.org/at9kJwdGkHPsWwgG@chrisdown.name Fixes: b56a2d8af914 ("mm: rid swapoff of quadratic complexity") Signed-off-by: Chris Down Signed-off-by: Andrew Morton Acked-by: Vineeth Pillai (Google) Reviewed-by: Baolin Wang Reviewed-by: Kairui Song Cc: Hugh Dickins Cc: Chris Li Cc: Nhat Pham Cc: Baoquan He Cc: Barry Song Cc: Youngjun Park Cc: Ying Huang Cc: Kelley Nielsen Cc: Rafael J. Wysocki Cc: Signed-off-by: Sasha Levin commit 9216e3167ffb2871df98f1f19d1ac3f17dcea809 Author: SJ Park Date: Sun Oct 25 09:48:06 2026 -0700 mm/damon/core: move static variable rotation to damon_ctx [ Upstream commit c4ff3ea30640b394df4156d7ddf60ad8ffe765f1 ] damon_split_some_reigons() uses a static variable, rotation, to remember how many times it was called. It is again used to determine fair selection of regions to split. Since it is a static variable, it can be indeterministic and therefore less fair. The user impact is not critical. No crash, no leak. DAMON's best-effort and indeterministic monitoring accuracy could be slightly more indeterministic when multiple kdamonds are used in parallel. Fix the problem by moving the static variable into the damon_ctx struct. Link: https://lore.kernel.org/20261025164808.152048-4-sj@kernel.org Fixes: 1a582e6e0174 ("mm/damon/core: split a fraction of regions when nr_regions exceeds max/2") Signed-off-by: SJ Park Signed-off-by: Andrew Morton Closes: https://sashiko.dev/#/bug/linux-eebfcdde-2881-48ef-8df1-e2019d2a47f2 Cc: Jiayuan Chen Cc: # 7.3.x Signed-off-by: Sasha Levin commit bbbbc4c799cf7a298aab6cc71e3d8efe7ab6d99e Author: SJ Park Date: Sun Oct 25 09:48:05 2026 -0700 mm/damon/core: move static variable last_nr_regions to damon_ctx [ Upstream commit 26ae50a0901a44f7d50053f87dc38abd9f9a269c ] kdamond_split_regions() uses a static variable last_nr_regions, to infer if the region boundaries are too stable. If it looks too stable, it does a more aggressive region split because it might be a fake stability coming from non-aggressive split. Because the variable is static, the inference can be racy and wrong when multiple kdamonds are running in parallel. The user impact is not critical. No crash, no leak. DAMON's best-effort monitoring accuracy can be degraded when multiple kdamonds are used in parallel and the workload has certain access patterns. Still it is a bug that is better to fix. Move the variable into the damon_ctx struct to fix the problem. Link: https://lore.kernel.org/20261025164808.152048-3-sj@kernel.org Fixes: 75c1c2b53c78 ("mm/damon/dbgfs: support multiple contexts") Signed-off-by: SJ Park Signed-off-by: Andrew Morton Closes: https://sashiko.dev/#/bug/linux-eebfcdde-2881-48ef-8df1-e2019d2a47f2 Cc: Fernand Sieber Cc: SeongJae Park Cc: # 5.15.x Signed-off-by: Sasha Levin commit 20e654a3b0b9c67c6da0813767ea6616149c941a Author: SJ Park Date: Sun Oct 25 09:48:04 2026 -0700 mm/damon/sysfs-schemes: hold damon_sysfs_lock in target_metric_store() [ Upstream commit a76adcace3550b16e5735ba4a5e95a9c2664e113 ] Patch series "mm/damon: fix three race bugs in sysfs and core", v1. There are three race condition bugs in DAMON sysfs interface and the core layer. User impacts are not critical but better to fix sooner than later. Patch 1 fixes a toctou bug in DAMON sysfs interface that can mess up DAMOS auto-tuning. Patches 2 and 3 move static variables that can be wrongly shared with multiple kdamonds and therefore make DAMON monitoring results be a little more indeterministic. This patch (of 3): damon_sysfs_add_quota_score() reads damos_sysfs_quota_goal->metric twice, once to set damos_quota_goal->metric to the value, and once again to set the metric-dependent damos_quota_goal unions based on the value. target_metrics_score() can update damos_sysfs_quota_goal->metric between the two reads. This time-of-check to time-of-use (toctou) race can make the union fields incorrectly set. The incorrect damos_quota_goal will be passed to the core layer and make DAMOS incorrectly behave. Users could reproduce the race by writing a new value to the target_metric sysfs file while DAMON is starting, or online parameters update is ongoing. The issue will only rarely happen in the real use cases. It requires sysfs write permission. The race window is short. Sane users wouldn't do such writes while DAMON enablement and/or online parameters update is ongoing. The user impact is not very critical. The race is not easy to unintentionally trigger. No leak or crash happens. Nonetheless, DAMOS could be unexpectedly more or less aggressive and does not achieve the auto-tune goal. Because of the nature of races, investigating will be difficult. Users can control the impact from unexpected aggressiveness using additional quotas and resolve the issue in runtime by re-installing the quota goal, though. Avoid the race by protecting damos_sysfs_quota_goal->metric write in target_metric_store() with damon_sysfs_lock. Because damon_sysfs_add_quota_score() is called while holding the same lock, the race is removed. The issue was discovered as a part of a bug report [1] from Sashiko, which is partially outdated. In more detail, the Sashiko report [1] was mainly for an outdated bug [2]. But it was also mentioning the issue of this patch as a similar class bug. Link: https://lore.kernel.org/20261025164808.152048-1-sj@kernel.org Link: https://lore.kernel.org/20261025164808.152048-2-sj@kernel.org Link: https://sashiko.dev/#/bug/linux-7f814c9a-986f-4103-a55a-ef9537dcf62b [1] Link: https://lore.kernel.org/20261021005234.94107-1-sj@kernel.org [2] Fixes: 85fcf0ffc460 ("mm/damon/sysfs-schemes: connect damos_quota_goal nid with core layer") Signed-off-by: SJ Park Signed-off-by: Andrew Morton Cc: # 6.16.x Signed-off-by: Sasha Levin commit 089a4ba4d845eeac3f4c78d8126d6332f998ca68 Author: Hengyu Liang Date: Fri Oct 23 14:13:00 2026 -0400 fs/proc/task_mmu: return -ENOTTY for unknown pagemap ioctls [ Upstream commit bfc1d9724c78aa7570dbeb17207a21089f2d1b1a ] Commit 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs") made do_pagemap_cmd() the ioctl handler of /proc//pagemap. However, do_pagemap_cmd() returns -EINVAL for every command other than PAGEMAP_SCAN. Before that commit, pagemap had no ioctl handler, and the VFS returned -ENOTTY for these commands. As of now, they fail with EINVAL, so tcgetattr() and isatty() on pagemap report EINVAL instead of ENOTTY. The issue can be reproduced with a simple C program: #include #include #include int main(void) { struct termios t; int fd = open("/proc/self/pagemap", O_RDONLY); if (tcgetattr(fd, &t) < 0) perror("tcgetattr"); return 0; } Before that commit, the result is: tcgetattr: Inappropriate ioctl for device After that commit, the result is: tcgetattr: Invalid argument This patch will return -ENOIOCTLCMD for unknown commands, as procfs_procmap_ioctl() in the same file does, so that the VFS turns it into -ENOTTY. Link: https://lore.kernel.org/20261023181300.3366487-1-hengyul@cs.unc.edu Fixes: 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs") Signed-off-by: Hengyu Liang Signed-off-by: Andrew Morton Acked-by: David Hildenbrand (Arm) Reviewed-by: Pedro Falcato Reviewed-by: Lorenzo Stoakes (ARM) Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Jann Horn Cc: Muhammad Usama Anjum Cc: Andrei Vagin Cc: Michał Mirosław Cc: Arnd Bergmann Cc: Signed-off-by: Sasha Levin commit a83c89737412ecac9aedde58e06db6283da10299 Author: Samarth Narang Date: Wed Oct 21 11:21:57 2026 -0700 mm/ksm: keep soft-dirty when merging a page [ Upstream commit 2efc6332f18bfd848f74f3d5ba45b31450601faa ] replace_page() maps the KSM page with a PTE built from scratch, so the soft-dirty bit of the PTE it replaces is lost. A page written since "clear_refs 4" then no longer shows as soft-dirty once it is merged, and a soft-dirty based dumper treats it as unchanged. Copy the soft-dirty bit from the original PTE to the new PTE. Link: https://lore.kernel.org/20261021182157.1873726-1-samarth.colleges@gmail.com Fixes: 0f8975ec4db2 ("mm: soft-dirty bits for user memory changes tracking") Signed-off-by: Samarth Narang Signed-off-by: Andrew Morton Reviewed-by: Lance Yang Acked-by: David Hildenbrand (Arm) Assisted-by: LLM Cc: Xu Xin Cc: Chengming Zhou Cc: Peter Xu Cc: Kiryl Shutsemau Cc: Mike Rapoport Cc: Signed-off-by: Sasha Levin commit 2c1393ecc3dd399561557c98d7f2e5251bb5bf92 Author: David Hildenbrand (Arm) Date: Fri Oct 23 14:47:28 2026 +0100 mm/vma: write lock source VMA before duplicating it in __split_vma() [ Upstream commit 769417e410dd19b2a438c6addb61b194b7a4c387 ] __split_vma() duplicates the source VMA before taking its VMA write lock, and until the VMA is write-locked, a concurrent thread might set VMA_MAYBE_GUARD_BIT, resulting in the duplication missing the flag. If this happens, then fork may fail to duplicate guard markers and, if a file-backed mapping, THP collapse may also discard the markers. Resolve this by taking the VMA write lock before vm_area_dup() and, since all callers of vm_area_dup() now hold the VMA write lock, assert that this is the case there, and add a comment to explain why it's needed. [ljs@kernel.org: add VMA write assert in vm_area_dup(), commit message touchup] Link: https://lore.kernel.org/20261023-fix-vma-atomic-v1-2-8ff4fae1fc85@kernel.org Fixes: 2ab7f1bbafc9 ("mm/madvise: allow guard page install/remove under VMA lock") Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Lorenzo Stoakes (ARM) Signed-off-by: Andrew Morton Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Davidlohr Bueso Reviewed-by: Pedro Falcato Tested-by: Gregory Price (Meta) Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Jann Horn Cc: SJ Park Cc: Kees Cook Cc: Colin Cross Cc: Signed-off-by: Sasha Levin commit 1193e0a0ccd9bb3f32cae12b6ffa1f817985d28d Author: Zenghui Yu (Huawei) Date: Thu Oct 22 20:27:52 2026 +0800 mm/page_alloc: mark pages freed by __free_pages_core() as not tagged [ Upstream commit b6732c6d43139ea56de8bc62e87ace8543ef784f ] Onlining hotplugged memory (e.g., a dev_dax device bound to kmem) with CONFIG_MEM_ALLOC_PROFILING_DEBUG triggers: alloc_tag was not set WARNING: ./include/linux/alloc_tag.h:166 at __pgalloc_tag_sub+0x1fc/0x254 Call trace: __pgalloc_tag_sub+0x1fc/0x254 (P) __free_pages_ok+0x14c/0x6ac __free_pages_core+0xa8/0x188 generic_online_page+0x14/0x20 online_pages+0x220/0x3b0 memory_subsys_online+0xfc/0x198 device_online+0x58/0xe0 state_store+0xf0/0xf8 Pages entering the buddy through __free_pages_core() have never been allocated, so their allocation tag references are NULL. The free path, __free_pages_prepare() -> pgalloc_tag_sub(), expects a valid tag or a CODETAG_EMPTY mark and warns otherwise. Paths feeding never-allocated pages into the buddy are therefore expected to mark them with clear_page_tag_ref() first, like init_cma_reserved_pageblock() and free_reserved_pages() do; of __free_pages_core()'s callers only memblock_free_pages() clears the tag ref itself, and the hotplug onlining path was missed. Since all __free_pages_core() callers free never-allocated pages, mark the head page as not tagged in __free_pages_core() itself instead of relying on each caller, and drop the now-redundant clearing from memblock_free_pages(). Link: https://lore.kernel.org/20261022122752.74774-1-zenghui.yu@linux.dev Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging") Signed-off-by: Zenghui Yu (Huawei) Signed-off-by: Andrew Morton Reviewed-by: Johannes Weiner Cc: Mike Rapoport Cc: Vlastimil Babka Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Brendan Jackman Cc: Zi Yan Cc: Signed-off-by: Sasha Levin commit 71568db3f9d90c373881c6d438db9afc47a1755b Author: Li Zhe Date: Thu Oct 22 11:45:43 2026 +0800 mm/hugetlb: fix mremap deadlock when PMD sharing is possible [ Upstream commit 92daa8652f88c8cfc05f4899a8408a04b02f211e ] move_hugetlb_page_tables() holds the mapping's i_mmap_rwsem for write while moving hugetlb PTEs. This prevents races with truncation and protects huge_pmd_unshare(), but the move loop must not call helpers that can acquire the same rwsem for read. huge_pte_alloc() can do that when the destination can use PMD sharing: it may call huge_pmd_share(), which takes i_mmap_rwsem for read while searching for a shareable PMD table. Calling it while the move path already holds i_mmap_rwsem for write can deadlock. Avoid that path for PMD-sized hugetlb mappings that can use PMD sharing. Instead of allocating or sharing the destination page table while moving, zap the source range and let the destination fault path populate or share the PMD lazily. Reuse the hugetlb unmap logic for the source-side zap by splitting the core loop out of __unmap_hugepage_range(). The wrapper keeps the existing tlb_start_vma(), tlb_end_vma() and huge_pmd_unshare_flush() behavior, while move_hugetlb_page_tables() can reuse the unmap loop with its existing mmu_gather. Link: https://lore.kernel.org/20261022034543.51226-4-lizhe.67@bytedance.com Fixes: 550a7d60bd5e ("mm, hugepages: add mremap() support for hugepage backed vma") Signed-off-by: Li Zhe Co-developed-by: David Hildenbrand (Arm) Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Andrew Morton Cc: Muchun Song Cc: Oscar Salvador Cc: Peter Xu Cc: Mike Rapoport Cc: Jose A. Perez de Azpillaga Cc: Signed-off-by: Sasha Levin commit ad5590d6982216a8a7f099ff24d9d4196a321cf6 Author: Li Zhe Date: Thu Oct 22 11:45:41 2026 +0800 mm/hugetlb: fix mremap move length truncation [ Upstream commit dfb190302d2b4af86c6ae48af0d3b09f28b35460 ] Patch series "mm/hugetlb: fix mremap bugs", v3. This series fixes a few hugetlb mremap bugs. Patch 1 fixes the return type of move_hugetlb_page_tables(), so large hugetlb moves cannot be truncated when reported back to the generic mremap code. Patch 2 disables hugetlb PMD sharing for UFFD missing mode, so UFFDIO_POISON markers cannot become visible through shared PMD page tables. Patch 3 fixes the recursive i_mmap_rwsem deadlock in the hugetlb mremap path by avoiding the destination PMD sharing allocation path while the mapping lock is already held for write. This patch (of 3): move_hugetlb_page_tables() returns the number of bytes moved, but its return type is int while the generic move_page_tables() path uses unsigned long lengths. A hugetlb mremap() move length above INT_MAX can therefore be misreported to copy_vma_and_data(). The out-of-range conversion to int is implementation-defined; on common 64-bit builds, for example, a 4 GiB move can be reported as zero, making the caller treat the move as a failure and use the wrong length for rollback. Return unsigned long from move_hugetlb_page_tables(), matching move_page_tables() and preserving the full byte count. Link: https://lore.kernel.org/20261022034543.51226-1-lizhe.67@bytedance.com Link: https://lore.kernel.org/20261022034543.51226-2-lizhe.67@bytedance.com Fixes: 550a7d60bd5e ("mm, hugepages: add mremap() support for hugepage backed vma") Signed-off-by: Li Zhe Signed-off-by: Andrew Morton Acked-by: David Hildenbrand (Arm) Cc: Muchun Song Cc: Oscar Salvador Cc: Peter Xu Cc: Mike Rapoport Cc: Jose A. Perez de Azpillaga Cc: Signed-off-by: Sasha Levin commit 64f823ba99afdbca9b631d49d21b3c45c773b7c1 Author: Gregory Price (Meta) Date: Mon Oct 19 14:48:50 2026 -0400 mm/page_alloc: let the highest memory node recover from hopeless state [ Upstream commit 83367658a01087375ede31ae343c99da03f72ac8 ] free_frozen_page_commit() clears a hopeless node's kswapd failures once its zone recovers above the high watermark, but only if another memory node exists for allocations to fall back to. The test `next_memory_node(nid) < MAX_NUMNODES` finds only memory nodes with a higher id. The highest-numbered memory node therefore never recovers on this path, and its kswapd stays disabled until reclaim on that node makes progress and balances it, or demotion is re-enabled. In many cases, direct reclaim many never fully run against a lower node (CXL/kmem), and that means its kswapd can end up full disabled in rare situations. To reproduce, fill the highest memory node with bound, non-THP anonymous memory and no swap until kswapd gives up, then free it: /proc/zoneinfo keeps showing node_unreclaimable 1 for that node. A lower node recovers. Count the memory nodes instead. Adding first_memory_node != nid to the existing test would also work, but a count says directly what the check means: some other memory node exists. Link: https://lore.kernel.org/20261019184850.3427905-1-gourry@gourry.net Fixes: e7a5f249e6db ("mm: re-enable kswapd when memory pressure subsides or demotion is toggled") Signed-off-by: Gregory Price (Meta) Signed-off-by: Andrew Morton Acked-by: Zi Yan Acked-by: Vlastimil Babka (SUSE) Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Brendan Jackman Cc: Johannes Weiner Cc: Chanwon Park Cc: Signed-off-by: Sasha Levin commit d342881c5bb75460ae28cfd2006e21dbf9aec443 Author: Hungyu Lin Date: Wed Oct 21 06:06:54 2026 +0000 mm/page-writeback: avoid 32-bit overflow in dirty threshold shares [ Upstream commit 9597c2056e05bd79df9d343a9b42e84a54de1c52 ] The ratios used by __wb_calc_thresh() are scaled to parts per million, but the threshold and ratio operands are unsigned long. On 32-bit kernels, their multiplication can wrap before the result is assigned to u64. For example, with a threshold of 25600 pages and the default maximum ratio of 1000000, wb_max_thresh becomes 4125 pages instead of 25600. The shared threshold and minimum share calculations can overflow in the same way, producing incorrect per-writeback dirty limits. Use a u64 threshold for the three ratio multiplications and div_u64() to retain the existing division order and rounding. Link: https://lore.kernel.org/20261021060654.27855-1-dennylin0707@gmail.com Fixes: ae82291e9ca4 ("mm: use part per 1000000 for bdi ratios") Signed-off-by: Hungyu Lin Signed-off-by: Andrew Morton Reviewed-by: Jan Kara Reviewed-by: Gregory Price (Meta) Cc: Matthew Wilcox (Oracle) Cc: Stefan Roesch Cc: Signed-off-by: Sasha Levin commit b57cfd4da476a4636bf1ed69dee176cc266e5a06 Author: Baolin Wang Date: Wed Oct 28 08:52:57 2026 +0800 mm: memory: fix truncation removing mapped folios [ Upstream commit 243cf1f67b365668389832463fc31cbb9fec47af ] Ayush reported an issue that shmem/tmpfs folios are still mapped when truncating them on production: " BUG: Bad page cache in process ... pfn:... page dumped because: still mapped when deleted " I reproduced the issue with Ayush's reproducer [1] with the latest mm-unstable branch, and I got the following crash info. From the dump message, we can see that truncate_inode_folio() is really trying to remove mapped folios, which is incorrect. " [ 189.171977] page: refcount:3 mapcount:1 mapping:00000000fe168ee1 index:0x3880 pfn:0x191647 [ 189.171995] memcg:ffff0000cc073d40 [ 189.171997] aops:shmem_aops ino:3c01 dentry name(?):"memfd:runsc-memory" [ 189.172006] flags: 0x17fffef0002022d(locked|referenced|uptodate|lru| workingset|swapbacked|node=0|zone=2|lastcpupid=0x3ffff) ....... [ 189.172017] page dumped because: VM_BUG_ON_FOLIO(folio_mapped(folio)) [ 189.172026] ------------[ cut here ]------------ [ 189.172027] kernel BUG at mm/filemap.c:155! [ 189.172057] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP ....... [ 189.177721] CPU: 3 UID: 0 PID: 5521 Comm: repro Kdump: loaded Tainted: 7.3.0-rc4+ #277 PREEMPT(lazy) ....... [ 189.183986] Call trace: [ 189.184124] filemap_unaccount_folio+0xf0/0x1e8 (P) [ 189.184391] __filemap_remove_folio+0x34/0x160 [ 189.184633] filemap_remove_folio+0x4c/0xb0 [ 189.184859] truncate_inode_folio+0x34/0x58 [ 189.185087] shmem_undo_range+0x220/0x658 [ 189.185308] shmem_fallocate+0x2f0/0x470 [ 189.185527] vfs_fallocate+0x128/0x328 ...... [ 189.187078] el0t_64_sync+0x184/0x188 " After analysis, I believe the race exists between truncation and MADV_DONTNEED, and shmem's ->map_pages() merely makes the issue easier to reproduce. Since MADV_DONTNEED synchronously releases the pagetable page before calling tlb_flush_rmaps(), this could cause another thread's truncation to skip zap_pte_range() (due to pmd is none) but still observe the folio's mapcount as non-zero. A possible race scenario is as follows: CPU 0 CPU 1 shmem_fallocate madvise_dontneed_single_vma unmap_mapping_range ....... ...... (filemap_map_pages() remap folios) zap_pte_range truncate_inode_folio zap_empty_pte_table(pmd clear) unmap_mapping_folio ...... zap_pmd_range (saw pmd none, skip) filemap_remove_folio BUG_ON(folio_mapped) tlb_flush_rmaps(remove rmaps) To fix this issue, we should move the pmd clear operation (via zap_empty_pte_table()) to after tlb_flush_rmaps() and use sync_with_folio_pmd_zap() to sync with concurrent zapping, so that when we find a pmd_none() while unmapping a folio without holding the PTL, the folio's mappings are guaranteed to have been removed via tlb_flush_rmaps(). Meanwhile move the second pmd_none() check to where it belongs: if splitting zapped the PMD. Link: https://lore.kernel.org/14ebbd556cc4941f0ebc43da59fa6a2fdca25dc8.1793148609.git.baolin.wang@linux.alibaba.com Link: https://lore.kernel.org/all/20260925065013.3682431-1-ayushr@modal.com/ [1] Fixes: 6375e95f381e ("mm: pgtable: reclaim empty PTE page in madvise(MADV_DONTNEED)") Signed-off-by: Baolin Wang Signed-off-by: Andrew Morton Reported-by: Ayush Ranjan Closes: https://lore.kernel.org/all/20260924061708.1645968-1-ayushr@modal.com/ Acked-by: Qi Zheng Reviewed-by: Pedro Falcato Reviewed-by: Lorenzo Stoakes (ARM) Acked-by: David Hildenbrand (Arm) Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Jan Kara Cc: Signed-off-by: Sasha Levin commit f6c17bda9b304795a2c284fb6c8a8eaac6248b80 Author: David Hildenbrand (Arm) Date: Wed Oct 14 20:34:28 2026 +0200 mm: fix address wraparound when scanning large folio PTEs [ Upstream commit f681d4580d5c3c749f623cda722a21aefd3147b3 ] numa_rebuild_large_mapping() and do_swap_page() can be tricked into generating an address wraparound, crashing the kernel. All that's required is to map a tail page of a large folio close enough to the start/end of the address space to e.g., make unsigned long addr_start = addr - (nr << PAGE_SHIFT); to wrap around. Let's fix it by providing a better helper, folio_scan_range(), that takes care of staying within VMA and page table boundaries while handling possible wraparounds. There are some nasty details, like not being able to use pmd_addr_end() in this context. Add some helpful comments for these cases. Link: https://lore.kernel.org/20261014-folio_pte_scan_range-v2-1-00cf9bbaa364@kernel.org Fixes: d2136d749d76 ("mm: support multi-size THP numa balancing") Fixes: 508758960b8d ("mm: swap: entirely map large folios found in swapcache") Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Andrew Morton Reported-by: Kyle Zeng Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: Baolin Wang Reviewed-by: Lance Yang Reviewed-by: Barry Song Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Ying Huang Cc: Ryan Roberts Cc: Chuanhua Han Cc: Signed-off-by: Sasha Levin commit 8c4adb787f77318df3b478f928f271e26d557208 Author: Kyle Zeng Date: Tue Oct 6 21:10:01 2026 -0700 mm/khugepaged: flush deferred unmaps before dropping a failed folio [ Upstream commit 854e5ff8b3ce2a776586cabebaeae645c992345b ] collapse_file() can fail its reference-count or dirty-folio check after unmapping with TTU_BATCH_FLUSH. Both paths put back the isolated folio, then unlock it and drop the lookup reference before reaching the common try_to_unmap_flush(). The page-cache reference does not keep the folio stable once the lock is released. Another collapse can replace and free it. With its PTEs already gone, that collapse cannot flush the first task's per-task TLB batch, and retract_page_tables() skips short or unaligned VMAs. A CPU can therefore retain a user translation to the freed folio. This has been reproduced with unprivileged MADV_COLLAPSE on a memfd. Flush at out_unlock while the lookup reference and folio lock are still held. The common flush continues to cover the accumulated pagelist on both success and rollback, preserving batching on successful collapses. Link: https://lore.kernel.org/20261007041001.43181-1-kylebot@openai.com Fixes: 6d9df8a5889c ("mm/thp: collapse_file() do try_to_unmap(TTU_BATCH_FLUSH)") Signed-off-by: Kyle Zeng Signed-off-by: Andrew Morton Acked-by: David Hildenbrand (Arm) Reviewed-by: Zi Yan Reviewed-by: Baolin Wang Acked-by: Hugh Dickins Assisted-by: LLM Cc: Barry Song Cc: Dev Jain Cc: Kiryl Shutsemau Cc: Lance Yang Cc: "Liam R. Howlett" Cc: Nico Pache Cc: Ryan Roberts Cc: Usama Arif Cc: Matthew Wilcox (Oracle) Cc: Signed-off-by: Sasha Levin commit 5283e160d7301eb81507e69a0180a9630f654282 Author: Babu Moger Date: Fri Oct 30 15:28:48 2026 -0500 x86,fs/resctrl: Keep mbm_assign_mode in default mode at boot [ Upstream commit 7782a6a8dfc05f5622fdf616e5cf3df7d16eaef5 ] The mbm_event mode assigns hardware MBM counters to RMID/event pairs. It is intended for deployments that need to manage counter assignment on platforms where the number of monitoring groups exceeds the available hardware counters. Hardware counters are scarce on these platforms, so mbm_event mode suits workflows that monitor a subset of groups at a time and rotate assignments as needed. x86 resctrl enables the mbm_event mode by default on hardware that supports it. This breaks the pqos tool¹, which assumes the historical default mode. It creates 16 or more monitoring groups and uses two counters per group. On a platform with 32 counters per domain, that exhausts the mbm_event counters pool, causing additional groups to read "Unassigned". pqos interprets a non-numeric event read as zero bandwidth and reports 0 MB/s for those groups: $ sudo pqos -m all:0-4 CORE IPC MISSES LLC[KB] MBL[MB/s] MBR[MB/s] 0 0.69 16k 192.0 0.0 0.0 1 0.40 3k 0.0 0.0 0.0 2 0.44 1k 64.0 0.0 0.0 3 0.39 1k 64.0 0.0 0.0 4 0.43 1k 0.0 0.0 0.0 Leave mbm_assign_mode in default mode during initialization as decided in the thread at the Link tag. Default mode uses one counter per monitoring group. On existing AMD platforms, the default active counters pool is 64 and may be larger on newer hardware. The active counters pool is the number of counters that the hardware can actively track in default mode. Deployments within the active counters pool receive accurate bandwidth measurements in the default mode. Users can create more monitoring groups (for example, 4096 on current hardware) than there are active counters in the pool. Beyond that pool, readings may be misleading or report as "Unavailable", with no user-visible indication. Default mode is still limited once the number of monitoring groups exceeds that active counters pool. After hardware re-allocates a counter, a read may return "Unavailable". pqos still treats "Unavailable" as zero. Successive reads can be a count, "Unavailable", then another count. pqos treats those jumps as wraparound and can report an inconsistent rate: $ sudo pqos -m all:0-4 CORE IPC MISSES LLC[KB] MBL[MB/s] MBR[MB/s] 0 0.76 60k 32.0 0.0 0.0 1 0.45 1k 32.0 0.0 0.0 2 1.57 107k 64.0 0.0 17592186044184.9 3 1.62 276k 4928.0 3.2 0.5 Users that need stable measurements beyond the active counters pool should use mbm_event mode and rotate assignments as needed. Enable it with: # echo mbm_event > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode ¹https://github.com/intel/intel-cmt-cat [ bp: Massage commit message. ] Fixes: 0f1576e43adc ("x86/resctrl: Configure mbm_event mode if supported") Closes: https://github.com/intel/intel-cmt-cat/issues/311 Signed-off-by: Babu Moger Signed-off-by: Borislav Petkov (AMD) Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20260804191608.GDanI6eK2Q07w6pNcb@fat_crate.local Signed-off-by: Sasha Levin commit 07f1afd5ea45d0e991e203025045f40fbfca2852 Author: Babu Moger Date: Fri Oct 30 15:28:47 2026 -0500 x86/resctrl: Correct ABMC counter ID field width [ Upstream commit 84b4b620af7d24916add5d45104023bc5d804f53 ] AMD's Assignable Bandwidth Monitoring Counters (ABMC) are configured via MSR_IA32_L3_QOS_ABMC_CFG. The cntr_id field selects the counter the configuration applies to. The number of counters a platform supports (the number of possible values written into that field) is enumerated separately via CPUID. On platforms that enumerate more than 32 counters, the current 5-bit encoding truncates the counter ID and misprograms ABMC. The section "Assignable Bandwidth Monitoring (ABMC)" in the APM has been updated to widen MSR_IA32_L3_QOS_ABMC_CFG.cntr_id from 5 bits to 12 bits. The CPUID enumeration reports the maximum counter ID in a 16-bit field and may therefore report more counters than a 12-bit MSR_IA32_L3_QOS_ABMC_CFG.cntr_id can address. Widen MSR_IA32_L3_QOS_ABMC_CFG.cntr_id to 12 bits to match the architecture. Cap the enumerated counter count at BIT(12) so every counter ID used by resctrl can be written to MSR_IA32_L3_QOS_ABMC_CFG.cntr_id without truncation. [ bp: Massage and simplify commit message. ] Fixes: 84ecefb76674 ("x86/resctrl: Add data structures and definitions for ABMC assignment") Signed-off-by: Babu Moger Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Reinette Chatre Cc: stable@vger.kernel.org Link: https://patch.msgid.link/3a5e99300f1309ae279beb058ef0438516b2bdcd.1793392128.git.babu.moger@amd.com Signed-off-by: Sasha Levin commit 91b5278622fd85a0998a22db7a803312c9dd5589 Author: Mohit Sharma Date: Thu Oct 22 20:11:29 2026 +0530 ASoC: qcom: q6apm: Guard callbacks until probe data is ready [ Upstream commit ef7062864c0511bba52775d0eb3aa72d886b5f3a ] The GPR bus needs to make response callbacks available before invoking a client probe because clients can issue synchronous commands from probe. This creates a short interval where a callback can run before the client has published its private data. Make q6apm publish its driver data only after all callback-visible state has been initialized. Have the q6apm and q6prm callbacks ignore packets received before driver data is available. Fixes: ec1471a898cc ("soc: qcom: apr: Add GPR support") Cc: stable@vger.kernel.org Co-developed-by: Ajay Kumar Nandam Signed-off-by: Ajay Kumar Nandam Signed-off-by: Mohit Sharma Link: https://patch.msgid.link/20261022144130.2443667-2-mohit.sharma@oss.qualcomm.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin commit d360db9ddb9aa6043eda33382430d8eb5c4384bb Author: Michael McAllister Date: Wed Oct 21 20:51:12 2026 +0100 Bluetooth: qca: Fix the WCN3950 NVM baud rate offset [ Upstream commit 5b7d0386a4e75c85479da0fbd9fd66a3e9201375 ] WCN3950 uses the HCI transport tag layout that stores the UART baud rate at byte 1, like WCN3991. However, QCA_WCN3950 precedes QCA_WCN3991 in qca_btsoc_type, so qca_tlv_check_data() writes the baud rate to byte 2 instead. On a Motorola Moto G10 with WCN3950 and cmnv12.bin, configuring a 3 Mbps UART therefore leaves the NVM baud rate at its default 3.2 Mbps and overwrites the following byte. Firmware download completes, but the subsequent HCI_RESET times out and Bluetooth initialization fails. Include WCN3950 in the byte-1 case so the NVM baud rate matches the host UART without altering the following transport parameter. Fixes: d5712c511cb3 ("Bluetooth: qca: add WCN3950 support") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Michael McAllister Reviewed-by: Bartosz Golaszewski Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin commit cffa43a254df157522c63957fa450d4dab9de8be Author: Valentin Kindschi Date: Tue Oct 20 12:51:50 2026 +0200 Bluetooth: hci_sync: pause advertising for the scan address update [ Upstream commit 56ed6b127a27c418dc2daa3fd076539d8fe69c4c ] hci_active_scan_sync() programs a non-resolvable private address with LE Set Random Address on every active scan start. BLUETOOTH CORE SPECIFICATION Vol 4, Part E, 7.8.4 says the controller shall return Command Disallowed (0x0C) for that command while legacy advertising or scanning is enabled. hci_pause_addr_resolution(), called just above, only stops advertising when LL privacy is in use, so on a controller without it the command is issued while advertising is still on: Bluetooth: hci0: Opcode 0x2005 failed: -16 It does not converge either. hdev->random_addr is only set on a successful command complete, so it stays BDADDR_ANY, and the deferral added by commit c2994b008492 ("Bluetooth: hci_sync: Fix not setting Random Address when required") requires it to be set. Unlike the resolvable address a few lines above, which is reused while rpa_valid(), the non-resolvable one is regenerated and rewritten on every call, so a controller that refuses the write is asked again at the scan restart period of about 10 s, for as long as discovery keeps restarting. Observed on a BCM43455, which has no LL privacy and no extended advertising, 190 rejections in one capture, every one retrying the same address: < LE Set Random Address Address: 02:16:91:90:F1:D4 (Non-Resolvable) > Command Complete LE Set Random Address, Command Disallowed < LE Set Random Address Address: 26:90:57:96:9A:3E (Non-Resolvable) > Command Complete LE Set Random Address, Command Disallowed Pause advertising for the address update, and resume it once the update is done and before the scan is started. The pause does not outlive the function: it is taken only when nothing else holds it, and every exit resumes advertising, which also releases the pause taken by hci_pause_addr_resolution(). A failed pause returns before marking anything paused, so the error path is a no-op. The resume in the error path is no longer guarded by ll_privacy_capable(). That guard matched a pause taken only under LL privacy; the pause added here is unconditional, and hci_resume_advertising_sync() returns early when nothing was paused. One caveat this widens, raised on the previous posting. When HCI_ADVERTISING is set, hci_pause_advertising_sync() also clears HCI_DISCOVERABLE and HCI_LIMITED_DISCOVERABLE and zeroes discov_timeout, and hci_resume_advertising_sync() restores only HCI_ADVERTISING, so the discoverable state is lost. It reproduces today on an LL privacy controller through hci_pause_addr_resolution(); the unconditional pause makes it reachable without LL privacy as well. hci_suspend_sync() also pauses unconditionally, so a device that suspends loses the same state on any controller today. That asymmetry is pre-existing and is left alone here rather than folded into a scan path fix. Legacy controllers have one random address register, shared by the scanner and the advertiser. Restoring the advertiser here can reprogram it when the advertiser is non-connectable, so the scan then uses that address rather than the one generated for it. Both are non-resolvable and neither is linkable to the identity address. With privacy enabled both roles already share one resolvable address the same way. With the patch, on the same hardware: < LE Set Advertising Enable Enable: 0x00 Success < LE Set Random Address Success < LE Set Advertising Parameters Success < LE Set Advertising Enable Enable: 0x01 Success < LE Set Scan Parameters Success < LE Set Scan Enable Enable: 0x01 Success The address write is accepted, and advertising is restored before the scan is started. Over 119369 btmon records and about 12 minutes of the normal workload of that device, alternating active and passive scanning with ten outgoing connection attempts, every LE Set Random Address succeeded and there were no Command Disallowed responses of any opcode, against one per scan restart before. Patch 1 is required: without it the resume added here returns -EPERM on the controllers this fixes and leaves advertising disabled. Fixes: 3c44a431d62b ("Bluetooth: hci_sync: Resume adv with no RPA when active scan") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5.5 btmon Signed-off-by: Valentin Kindschi Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin commit 483c0d7e245b1ce42d914757e71487814219f8f5 Author: Valentin Kindschi Date: Tue Oct 20 12:51:49 2026 +0200 Bluetooth: hci_sync: re-enable legacy advertising on resume [ Upstream commit 737139f4157d302292a6b937d96922879ecabfa3 ] hci_resume_advertising_sync() never re-enables advertising on a controller without extended advertising. It restores HCI_ADVERTISING from advertising_old_state, then calls hci_schedule_adv_instance_sync(), which starts with: if (hci_dev_test_flag(hdev, HCI_ADVERTISING) && !ext_adv_capable(hdev)) return -EPERM; The flag it tests was set a few lines earlier by the resume itself, so the call returns -EPERM without sending anything. The return value is discarded by every caller, so the failure is silent: advertising_paused is cleared, HCI_ADVERTISING is set, and the controller is not advertising. Observed on a BCM43455 (no extended advertising) after an active scan: btmon shows the pause disabling advertising and no re-enable in the ten seconds that follow, the device does not appear in another controller's scan, and btmgmt info still reports "advertising" in current settings. Enable instance 0x00 directly in that case, the way reenable_adv_sync() already does for the same situation. Instances continue to go through hci_schedule_adv_instance_sync() so the software rotation loop is rearmed. This affects every caller of hci_resume_advertising_sync(), not only the scan path: address resolution changes, accept list updates, discovery stop, suspend/resume and the end of an LE connection attempt all leave advertising disabled on such a controller today. The resume does nothing when the controller is already advertising, as it is after directed advertising was started for a peripheral connection, so it does not replace that advertising. err is initialised because the extended branch leaves it unset when adv_instances is empty and HCI_LE_ADV_0 is clear. Fixes: ad383c2c65a5 ("Bluetooth: hci_sync: Enable advertising when LL privacy is enabled") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5.5 btmon Signed-off-by: Valentin Kindschi Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin commit a87438fb31e1e8d749ca9ef147ca38e017c4ef8b Author: Zack Rusin Date: Thu Sep 3 12:07:20 2026 -0400 x86/vmware: Fix i386 high-bandwidth hypercall arguments [ Upstream commit e0e022004bbedc7caf1c18770980eb5372019189 ] The high-bandwidth hypercall helpers push %ebp before loading the in6 operand into it. On i386 without frame pointers, both GCC and Clang can address the memory-constrained operand relative to %esp. The push then moves the stack and the helpers load the wrong value. Typical i386 configurations use the frame-pointer unwinder and happen to address the operand through %ebp. However, UNWINDER_GUESS is available with EXPERT and permits the affected frame-pointer-disabled configuration. vmwgfx is also available on i386 and calls both helpers. Stage in6 through %eax before changing either stack register, then save %ebp and copy the staged value into it. Load the VMware magic immediately before the string I/O instruction. Mark %eax early-clobber so it cannot also provide in6 or an address register for it. Use the same sequence on x86-64, where the full-width register preserves in6. Fixes: 34bf25e820ae ("x86/vmware: Introduce VMware hypercall API") Signed-off-by: Zack Rusin Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Maaz Mombasawala Cc: stable@vger.kernel.org # 6.11+ Link: https://patch.msgid.link/4ab10678a8f50053934b62b56af81f881c1d3798.1788414669.git.zack.rusin@broadcom.com Signed-off-by: Sasha Levin commit 6bbce146f893ab8b335e9eb82f4293bc94f3a4bf Author: Yingjie Wang <1075151112@qq.com> Date: Fri Oct 30 15:30:56 2026 +0800 ipv6: reject wrapped temporary address preferred lifetimes [ Upstream commit c3e67bd82b9b9b1a5118f09a429ccefe2aab0741 ] ipv6_create_tempaddr() raises a temporary address's preferred lifetime to regen_advance + age + 1 when the configured lifetime is too short. The result is stored in a u32, while regen_advance and age are unsigned long. If the sum wraps or is truncated, the stored lifetime can still be less than or equal to regen_advance + age. addrconf_verify_rtnl() then sees the new address as due for regeneration and creates another one. Temporary addresses are not limited by max_addresses since commit 4b08a8f1bd8c ("ipv6: remove max_addresses check from ipv6_create_tempaddr"), so this can cause unbounded address growth. With dad_transmits set to -1, a baseline kernel reached 2859 loopback addresses in two seconds. After storing the adjusted lifetime, verify that it is still greater than regen_advance + age. Reject the new address if the check fails. On an x86-64 KASAN kernel, the normal configuration created three IPv6 addresses. The negative dad_transmits, positive multiplication overflow, and large retransmission-time cases each left only the loopback and public addresses. An i386 defconfig and an x86-64 allmodconfig both built addrconf.o with W=1. Fixes: f4bcbf360ac8 ("net: ipv6/addrconf: clamp preferred_lft to the minimum required") Cc: stable@vger.kernel.org Suggested-by: Ido Schimmel Link: https://lore.kernel.org/netdev/20261029175827.GA1411453@shredder/ Signed-off-by: Yingjie Wang <1075151112@qq.com> Reviewed-by: Ido Schimmel Reviewed-by: Alex Henrie Link: https://patch.msgid.link/tencent_7A270291DDE5CD89DAFFE8A745D094D5BD06@qq.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit b7f84486c44c2ce03dffe5f09a42a38acbaa1551 Author: Eric Dumazet Date: Fri Oct 30 09:12:25 2026 +0100 inet: frags: limit the truesize of a reassembly queue [ Upstream commit 3ae20e4697eb969104fe4b1e98a675f0100382b6 ] The truesize of fragments in a reassembly queue is only bounded by the per netns ipfrag_high_thresh sysctl, which has no upper limit. inet_frag_reasm_finish() sums the truesize of all fragments in an int. If this sum reaches 2^32, it wraps, and the final sk_wmem_alloc adjustment of the socket owning the reassembled skb can cancel its own reference, leading to a use-after-free of this socket. This can be triggered from an unprivileged user/network namespace, raising ipfrag_high_thresh and using padded TUN packets, which keep a large truesize after being trimmed by ip_rcv_core(). Track the sum of the truesize of fragments in each queue, and refuse a fragment that would make it bigger than INT_MAX / 2. Callers kill the queue on this error. This bound is far above the needs of legitimate traffic. Fixes: 18685451fc4e ("inet: inet_defrag: prevent sk release while still in use") Cc: stable@vger.kernel.org Reported-by: Kyle Zeng Cc: Florian Westphal Signed-off-by: Eric Dumazet Reviewed-by: Ido Schimmel Reviewed-by: Jiayuan Chen Tested-by: Wang Zhan Link: https://patch.msgid.link/20261030081225.2575462-1-edumazet@kernel.org Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 154a240dc195014b95066b434b47c4e08d30541e Author: James Calligeros Date: Sun Oct 25 13:22:18 2026 +1000 ASoC: tas2770: Fix error detection in tas2770_set_dai_tdm_idle [ Upstream commit f65f866dacbb10a37e4fae4076627c767afd3cbb ] snd_soc_component_update_bits returns 1 on a successful update, and we were returning from tas2770_set_dai_tdm_idle early on any nonzero return code. Change this so that only negative return codes are treated as errors. Fixes: af176d0787d2 ("ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle") Cc: stable@vger.kernel.org Signed-off-by: James Calligeros Link: https://patch.msgid.link/20261025-tas2770-idle-fix-v2-1-6c8096a87f44@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin commit d47bae9eb33b3ca0843a0954b7d0cafb354c99b0 Author: Sean Christopherson Date: Wed Oct 21 18:54:06 2026 -0700 KVM: x86: Unconditionally reset MMU context when emulating INIT [ Upstream commit c7c288d178cb0b78d3464a616b16b1aa0b316049 ] Force an MMU reset when emulating an INIT even if paging was already disabled, as the MMU page role includes guest_mode (L2), i.e. an INIT while L2 is running with CR0.PG=0 will result in KVM running L1 with a stale MMU context. Alternatively, the reset could be scoped strictly to paging being enabled or L2 being active, but SMM is also encoded in the page role. Even though it _should_ be impossible for the vCPU to be INIT'd while SMM is active, there's zero value in not handling SMM. At that point, the only scenario where KVM _doesn't_ need to reset the MMU context is on an INIT with the vCPU running in Real Mode or Unpaged Protect Mode, and while INIT in those modes is somewhat common, it's far from a hot path and re-initializing the MMU is not expensive, especially when the role isn't changing (KVM elides most of the re-configuration in that case). Note, like the Fixes commit, this bug only affects nested SVM as INIT is an unconditional intercept on VMX, i.e. it's impossible to emulate INIT while L2 is active. Temporarily keep the guest TLB flush when CR0.PG is being cleared even though it is fully redundant with the flush that is emitted on all INIT events (KVM itself only does RESET when a vCPU is being created, i.e. when CR0.PG must be '0'). Fixes: ed129ec9057f ("KVM: x86: forcibly leave nested mode on vCPU reset") Reported-by: Stefan Teodorescu Reported-by: Oren Yomtov Reported-by: Chris Mason Cc: stable@vger.kernel.org Cc: Yosry Ahmed Signed-off-by: Sean Christopherson Message-ID: <20261022015407.279870-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin commit 72238066aacc400df69cef4b602f083ae4737762 Author: Sean Christopherson Date: Tue Oct 27 10:15:18 2026 -0700 KVM: x86/mmu: Cap number of parent PTEs per SP at 1000 (the arbitrary rmap limit) [ Upstream commit e4558c3d7198ed9a0adc3304681f561f4e4d80e1 ] When potentially reusing a shadow page, zap the shadow page if its number of parent PTEs exceeds KVM's (mostly) arbitrary rmap recycling threshold. Letting the guest create a (mostly) unbounded number of parent PTEs allows the guest to coerce KVM into creating lists containing millions of PTEs, effectively bounded only by the maximum number of shadow pages. Because PTE lists are simple singly linked lists, removal is O(n). Even worse, if a list is constructed just so, teardown can be O(n^2), e.g. if SPTEs are built such that zapping child SPTEs always zaps the last entry in the list. To cap things off, all paths that walk PTE lists do so while holding mmu_lock, without conditionally rescheduling. Using a doubly linked list would not address the issue, as removal would remain O(n) since KVM still wouldn't know where in the list to remove from. Removal could be made O(1) by storing a per-SPTE pointer, but that would largely defeat the purpose of reusing SPs, and would penalize well-behaved guests, especially for nested TDP where aliasing page tables is uncommon. So, cap the maximum number of parent PTEs at the rmap limit. In practice, well-behaved guests will likely never run afoul of the limit. E.g. when running Linux as L1 with TDP, the number of parent PTEs for a single SP tops out at under 200 (though undoubtedly obscure workloads can push it higher). Deliberately use a "greater than or equal" as opposed to rmap's strictly "greater than", as the rmap code checks the threshold immediately *after* inserting into the list, i.e. the limit is 1000 for rmaps, KVM just very briefly blows past it. Apply the check to both indirect and direct SPs, because while a fully direct MMU naturally limits the number of parent PTEs to '1', direct SPs in indirect MMUs have no such constraint. E.g. if the guest maps a huge PTE into many locations in its page tables, and KVM is backing the hugepage with a direct SP, i.e. with a series of smaller pages, then KVM could end up with a direct SP with many parents. Note, shadow_mmu_try_split_huge_pages() always restarts the rmap walk or bails entirely if it gets to the point where it tries to grab a SP, i.e. there is *no* pre-existing bug that would be tripped by zapping a SP and thus rmaps when getting a SP. Cc: Jim Mattson Cc: James Houghton Cc: Yosry Ahmed Cc: David Woodhouse Cc: stable@vger.kernel.org Reported-by: Stefan Teodorescu Signed-off-by: Sean Christopherson Message-ID: <20261027171518.1432557-1-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin commit 6a4697ec81693f8db41a1c3ba81f3b9b2510879f Author: Sean Christopherson Date: Tue Oct 27 11:59:17 2026 -0700 KVM: nVMX: Process each host MSR entry at most once when unwinding failed VM-Entry [ Upstream commit c33ef9d334059f7cb167569ed7b4779752fe4425 ] Add a missing "break" in the inner for-loop of the open coded mess that unwinds MSRs back to the pre-VM-Enter state when VMLAUNCH/VMRESUME VM-Fails due to a consistency check that is caught by hardware but missed by KVM. I.e. move on to the next MSR in the VM-Entry load list after performing a write using a value found in the VM-Exit load list. Processing *every* matching entry in the VM-Exit load list makes the processing quadratic, which is problematic if the load lists are full of MSRs that are expensive to emulate. E.g. writing APIC_BASE triggers kvm_recalculate_apic_map() and a whole pile of unnecessary work. Functionally, arbitrarily restoring the value of the first matching entry is "fine", because none of this is architecturally correct: the load lists are never supposed to have been used in the first place. In practice, it's likely a moot point as no well-behaved VMM will have multiple, diverging entries in the load lists. Fixes: bd18bffca353 ("KVM: nVMX: restore host state in nested_vmx_vmexit for VMFail") Cc: stable@vger.kernel.org Cc: David Woodhouse Reported-by: Stefan Teodorescu Suggested-by: Stefan Teodorescu Signed-off-by: Sean Christopherson Message-ID: <20261027185917.1478906-1-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin commit 5a5f9853a78c45927cd0814ae67c5ad8b5021bcc Author: Sean Christopherson Date: Wed Oct 28 10:36:38 2026 -0700 KVM: x86: Conditionally resched when restarting REP string emulation [ Upstream commit ae85ac25eb671d174811cc3101549448671fd505 ] When restarting emulation, e.g. of a REP-prefixed string instruction, conditionally reschedule as emulating guest writes can be deceptively slow and expensive, e.g. when shadow paging is in use and each write can trigger write tracking. In a perfect world, restarting emulation (or not) would be less arbitrary, e.g. would honor not only host events (NEED_RESCHED, signals, etc.) but also guest events (e.g. by checking kvm_vcpu_has_events()). Unfortunately, as pointed out by Sashiko, pio_in_emulated()'s read-ahead logic is baked into the restart logic, as KVM relies on restarting emulation to drain the cache and avoid duplicate reads from the I/O port. I.e. re-entering the guest on kvm_vcpu_has_events() or __xfer_to_guest_mode_work_pending() would introduce architecturally-incorrect, guest-visible changes. Fixes: 5cd21917da24 ("KVM: x86 emulator: restart string instruction without going back to a guest.") Cc: stable@vger.kernel.org Cc: David Woodhouse Reported-by: Stefan Teodorescu Suggested-by: Stefan Teodorescu Signed-off-by: Sean Christopherson Message-ID: <20261028173638.1765329-1-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin commit 193bfab2791eedc1dbe2d61755211a2973d79138 Author: Sean Christopherson Date: Wed Oct 21 18:59:03 2026 -0700 KVM: x86/mmu: Conditionally resched when retrying gPTE walk on A/D update failure [ Upstream commit b2691b3a6cd230209736c89684dab90d939aa56b ] Conditionally reschedule when retrying a guest PTE walk because the CMPXCHG to update A/D bits failed, e.g. because a different task/vCPU modified the relevant gPTEs. On kernels without involuntary preemption of some kind, a misbehaving guest can "capture" a pCPU effectively indefinitely and trigger soft lockups by continuously modifying its gPTEs such that the result of the walk is remains valid. Fixes: b3e4e63fd9ee ("KVM: MMU: Use cmpxchg for pte updates on walk_addr()") Cc: stable@vger.kernel.org Reported-by: Stefan Teodorescu Signed-off-by: Sean Christopherson Message-ID: <20261022015903.282261-1-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin commit 45d0c2d7d338ae1606984ed92d254ca0efcef921 Author: Yuqiang Sun Date: Mon Nov 2 17:50:15 2026 +0800 nvme: Do not drop the cdev reference twice when cdev_device_add() fails [ Upstream commit 7dfe79db5615df8d37ae7de6d3ec099b71bf3e03 ] Since commit 9952f3882ecb ("nvme: fix cdev lifetime"), nvme_add_ns_cdev() and nvme_add_ns_head_cdev() take a reference to the namespace (or namespace head) before calling nvme_cdev_add(), to be dropped by the char device's release, nvme_cdev_rel(), and drop it themselves when nvme_cdev_add() fails. But when cdev_device_add() fails, nvme_cdev_add() has already put the device, and nvme_cdev_rel() has already dropped that reference: the caller drops it a second time. With one allocation failure injected into cdev_device_add() for a namespace on an NVMe over loop controller, deleting the controller gives, with native multipath: BUG: KASAN: slab-use-after-free in nvme_put_ns_head+0x21/0x140 Write of size 4 at addr ff1100000a4ea078 by task init/1 nvme_put_ns_head nvme_put_ns nvme_remove_namespaces nvme_do_delete_ctrl nvme_delete_ctrl_sync nvme_sysfs_delete Freed by task 1: kfree nvme_ns_remove nvme_remove_namespaces refcount_t: underflow; use-after-free. Take the reference in nvme_cdev_add() instead, right before cdev_device_add(), and let the callers neither take nor drop it. Add nvme_is_ns_cdev() for the check that nvme_cdev_rel() and nvme_cdev_add() now share. Fixes: 9952f3882ecb ("nvme: fix cdev lifetime") Cc: stable@vger.kernel.org Reviewed-by: John Garry Signed-off-by: Yuqiang Sun Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit b21f08772603a56d112835350852910b8470b512 Author: Daejun Park Date: Thu Oct 29 09:51:24 2026 +0900 nvme: unregister when pr_register() is given a zero new key [ Upstream commit a9d431124fb2e58215daf0299d6fcf47bbc2d6b1 ] The block layer PR API defines a zero new_key in pr_register() as unregistering old_key. nvme_pr_register() sends Replace Reservation Key with a zero NRKEY instead. The host stays registered with key 0, and its next registration with another key fails with Reservation Conflict. The pNFS SCSI layout client unregisters this way at umount. A later mount cannot register and sends all I/O through the metadata server. Send Unregister Reservation Key when new_key is zero. Fixes: 1d277a637a71 ("NVMe: Add persistent reservation ops") Cc: stable@vger.kernel.org Reviewed-by: Christoph Hellwig Signed-off-by: Daejun Park Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit ed9e1f64bc79c92340b3d57c7294542ed13eb280 Author: Christian Aurich Zanettini Martins Date: Thu Oct 29 11:19:57 2026 -0300 nvme-rdma: fix NULL queue->ctrl dereference on reconnect [ Upstream commit 3ee50a2d76f278ea0ced45716a62730059283787 ] Since commit 2a8513091d2f ("nvme-rdma: parallelize I/O queue allocation and startup"), a reconnect that gets more I/O queues than before grows the tag set before the new queues are set up. queue->ctrl is only set by nvme_rdma_setup_io_queues(), so I/O submitted in between reaches nvme_rdma_queue_rq() on a queue that was never allocated and dereferences a NULL queue->ctrl: BUG: kernel NULL pointer dereference, address: 000000000000034c RIP: 0010:nvme_rdma_queue_rq+0x52/0xb90 Set queue->ctrl for every queue when allocating the controller. Such requests are then requeued like on any other queue that is not live. Fixes: 2a8513091d2f ("nvme-rdma: parallelize I/O queue allocation and startup") Cc: stable@vger.kernel.org Reviewed-by: Nilay Shroff Signed-off-by: Christian Aurich Zanettini Martins Signed-off-by: Keith Busch Signed-off-by: Sasha Levin commit 66cab935270da3002638205488a6f3210779a9a0 Author: Joonhoe Kim <26rote@gmail.com> Date: Thu Oct 29 19:51:42 2026 +0900 net: qrtr: announce local services again once our HELLO is sent [ Upstream commit 743b5c86276b1c3241e6f0f395b55f98f0756ef0 ] Since commit 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register"), qrtr_node_enqueue() drops every packet but HELLO with -EAGAIN until our HELLO has gone out to the node. When the remote's HELLO arrives first, the NEW_SERVER replies from the name service are dropped, and so are the broadcasts for services registered before our HELLO goes out. Nothing announces these services again, so the remote never learns about them. On Kaanapali the modem sends its HELLO before it accepts ours. With rmtfs started first, the modem never learns about rmtfs and its watchdog resets the SoC about 40 s later. Remember that the remote has sent a HELLO. Once our HELLO has been sent to such a node, pass a HELLO from it to the local name service again, so that it announces the services it has at that point. Retry the replay if it cannot be queued, and queue it under ep_lock only while the endpoint is registered, so that it cannot follow the BYE from qrtr_endpoint_unregister(). The flag is not cleared when qrtr_endpoint_hello() restarts the handshake on resume, so a HELLO that the remote sent before then is not lost. The cost is that the remote gets the same NEW_SERVER announcements twice when its HELLO arrives before ours goes out but the name service handles it after, and on every resume. Fixes: 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register") Cc: stable@vger.kernel.org Tested-by: Filippo Falezza # Motorola Moto G 5G Plus nairo (SM7250) Signed-off-by: Joonhoe Kim <26rote@gmail.com> Link: https://patch.msgid.link/20261029105142.2503-1-26rote@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit e81b4cb6176e7d12461b1179cd546004bacfa898 Author: Vas Zayarskiy Date: Sun Sep 27 22:13:12 2026 +0300 hwmon: (aquacomputer_d5next) Avoid truncating scaled sensor readings [ Upstream commit c221091f7e30c64280e4cbfa27dc4c05edc96d0c ] High Flow Next power is reported in watts. Multiplying the 16-bit value by one million can overflow both the signed intermediate and the u32 cache. Store power in long, perform the conversion in u64, and clamp to LONG_MAX. The other existing power conversions fit in a signed 32-bit value. Return -ENODATA for unavailable power instead of exposing the stored error as a reading. The power cache is updated by HID reports without the hwmon read mutex. Read it once with READ_ONCE() and use that snapshot for both the availability check and the returned value. Mark the corresponding updates with WRITE_ONCE() so that the shared accesses are explicit. Widen the shared current cache to u32. The Aquastream XT conversion to milliamperes can exceed 65535 mA; clamp its negative conversion results to zero before assigning to the unsigned cache. This also permits devices with scaled aggregate currents to store milliamperes directly. Fixes: aed80bb91de8 ("hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow Next") Cc: stable@vger.kernel.org Signed-off-by: Vas Zayarskiy Link: https://patch.msgid.link/20260927191316.4137752-2-contact@vasily.cc [groeck: Dropped obsolete 'Assisted-by: tag] Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 5fe9bc7335e05db30fb6e258df49cbc373ebddd6 Author: Guenter Roeck Date: Sat Oct 31 18:42:37 2026 -0700 hwmon: (sht4x) Convert update_interval to jiffies in pending data check [ Upstream commit 1a30ea0be623b7443edb6adc79e07632418cefdc ] In sht4x_read_values(), the check for whether a pending post-heater measurement is still fresh compares get_jiffies_64() against data->heating_complete + data->update_interval. However, data->heating_complete is stored in jiffies whereas data->update_interval is stored in milliseconds. Whenever HZ != 1000, adding data->update_interval directly without msecs_to_jiffies() mixes incompatible time units. For example, with the default 2000 ms update_interval, the validity window is inflated to 8 seconds at HZ=250 and 20 seconds at HZ=100 instead of 2 seconds. A read within that extended window skips triggering a fresh measurement and instead returns and caches the stale post-heating measurement left in the sensor's output buffer. Convert data->update_interval to jiffies using msecs_to_jiffies() when computing the pending measurement expiration deadline, matching the next_update calculation right below it. Reported-by: Sashiko Fixes: 0eed6fc3d2b9 ("hwmon: (sht4x): add heater support") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 2fb99a03cb8c4a5907c55968d1aa8df6c885e347 Author: Guenter Roeck Date: Sat Oct 31 03:08:32 2026 +0000 hwmon: (coretemp) Set nr_cores only after core_data allocation succeeds [ Upstream commit 95638f1f05ced75a82e83f610cd01b636d2a21b1 ] In init_temp_data(), pdata->nr_cores is populated from topology_num_cores_per_package() before allocating pdata->core_data. If that allocation fails, init_temp_data() returns NULL with pdata->core_data still NULL and pdata->nr_cores set to a positive value. coretemp_add_core() logs the error without failing coretemp_cpu_online(), so the CPU still comes online with pdata->hwmon_dev registered. When the CPU is later taken offline (or the module is unloaded), coretemp_cpu_offline() calls get_temp_data(pd, cpu), which loops up to pdata->nr_cores and dereferences the NULL pdata->core_data pointer. Store the core count in a local variable and assign pdata->nr_cores only after pdata->core_data is allocated, preserving the invariant that pdata->nr_cores is zero whenever pdata->core_data is NULL. Reported-by: Sashiko Fixes: 1a793caf6f69 ("hwmon: (coretemp) Use dynamic allocated memory for core temp_data") Cc: stable@vger.kernel.org Tested-by: Asaf Nuri Bertizlioğlu Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 71cf157b7bc5796223f631023d67385e59785fb2 Author: Guenter Roeck Date: Sat Oct 31 03:08:08 2026 +0000 hwmon: (coretemp) Check for NULL platform device in hotplug callbacks [ Upstream commit 0f9c7ed3b5009a037e5533eac03a0d4d45ecf1f0 ] coretemp_get_pdev() returns NULL when topology_logical_die_id(cpu) is negative (such as -ENODEV or -ERANGE from topology_get_logical_id() on a firmware/hardware APIC ID mismatch) or exceeds max_zones (for example, under asymmetric or anomalous ACPI die topologies where topology_max_packages() * topology_max_dies_per_package() is smaller than the logical die count). Commit 6d03bbff456b ("hwmon: (coretemp) Simplify platform device handling") pre-allocated zone_devices[0 .. max_zones - 1] during module init and dropped the NULL checks on pdev in coretemp_cpu_online() and coretemp_cpu_offline(), passing pdev unconditionally to platform_get_drvdata(). When coretemp_get_pdev() returns NULL, platform_get_drvdata(pdev) dereferences &pdev->dev and triggers a kernel NULL pointer dereference. Check for a NULL pdev and return 0 in both coretemp_cpu_online() and coretemp_cpu_offline() before calling platform_get_drvdata(). Returning 0 in coretemp_cpu_online() ignores the unmapped CPU without blocking CPU bringup or tearing down valid thermal zones on other dies. Reported-by: Sashiko Fixes: 6d03bbff456b ("hwmon: (coretemp) Simplify platform device handling") Cc: stable@vger.kernel.org Tested-by: Asaf Nuri Bertizlioğlu Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 4da2dd15ae764a455d40f7d434ac69cc4a501d6b Author: Baek Kyu, Kim Date: Sat Oct 31 18:50:39 2026 +0900 hwmon: (gpio-fan) Update the speed cache before dropping the PM reference [ Upstream commit f324179e6ccd05dfdc8e98fba2e9d50aea8e7ea2 ] set_fan_speed() writes the GPIO control value before dropping the runtime PM reference when stopping the fan. pm_runtime_put_sync() decrements the usage count even when suspending the device fails, but the error return currently leaves speed_index at the previous running speed. A request for that same running speed then returns success without changing the GPIOs or taking a runtime PM reference. Retrying the stop instead drops a reference the driver no longer owns and can trigger a runtime PM usage count underflow warning. Update speed_index after writing the GPIOs and before dropping the PM reference. The initial same-speed check already excludes a stopped fan, so a zero target is sufficient to identify the transition that needs a PM put. Preserve the PM error return and the CONFIG_PM=n exception. This keeps the cached control state and PM reference ownership consistent without restoring running GPIOs after a possibly partial supply failure. It does not clear persistent runtime PM errors or claim that a failing regulator has successfully powered off. Fixes: 0d01110e6356 ("hwmon: (gpio-fan) Add regulator support") Cc: stable@vger.kernel.org Signed-off-by: Baek Kyu, Kim Link: https://patch.msgid.link/20261031095039.11683-1-pocj8ur4in@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit db2bac372311c55b0f50d773082074a233323e9b Author: Guenter Roeck Date: Fri Oct 30 20:02:08 2026 -0700 hwmon: (tmp108) Fix initial conversion delay and wait until ready [ Upstream commit 7cd60538073e465310c94b2a2f0ea8d2f03768ef ] In tmp108_common_probe(), the driver only adds the 30 ms conversion delay (TMP108_CONVERSION_TIME_MS) to ready_time if the sensor was previously in TMP108_MODE_SHUTDOWN. However, the TMP108 hardware defaults to continuous conversion mode (TMP108_MODE_CONTINUOUS) upon power-on reset, including immediately after enabling the vcc supply regulator during probe, while the temperature register retains its power-on reset value of 0x0000 (0°C) until the first conversion completes. Because the initial mode is not shutdown, the delay is bypassed and early reads via thermal zone registration or sysfs before the first conversion finishes return an uninitialized 0°C reading. In addition, returning -EAGAIN from tmp108_read() while waiting for a conversion to complete after probe or resume can trigger an unnecessary tight retry loop in callers or fail initial reads. Unconditionally set ready_time to TMP108_CONVERSION_TIME_MS ahead in tmp108_common_probe(), track ready_time as ktime_t, and wait for the remaining conversion time in tmp108_read() using usleep_range() instead of returning -EAGAIN. Reported-by: Sashiko Fixes: 66e1c9171339 ("hwmon: Add Texas Instruments TMP108 temperature sensor driver.") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 0e9d84ad45ad64e9a19664538de6a96062d93765 Author: Guenter Roeck Date: Fri Oct 30 18:59:26 2026 -0700 hwmon: (lm75) Fix setting polarity mask for chips with 16-bit config register [ Upstream commit 3897309ede38d7f3ff34c4c4583b1dd345666988 ] When probing a 16-bit compatible temperature sensor configured with the "ti,alert-polarity-active-high" device property, lm75_generic_probe() writes to a reserved bit instead of the alert polarity bit due to an incorrect bit shift in the 16-bit polarity mask. On 16-bit sensors, the polarity bit is physically located at bit 2 of the MSByte. When accessed via i2c_smbus_read_word_data() or i2c_smbus_write_word_data(), the SMBus protocol maps the first received byte (the physical MSByte) to the lower 8 bits of the integer representation. Consequently, the polarity bit is consistently mapped to bit 2, identically to 8-bit sensors. However, the LM75_ALERT_POLARITY_HIGH_16_BIT macro applies an 8-bit left shift, erroneously targeting bit 10. This causes the driver to silently corrupt a reserved bit in the configuration register while leaving the active-high alert polarity unconfigured, breaking the polarity feature. Use BIT(2) as polarity mask in the configuration register for all chips to fix the problem. Reported-by: Sashiko Fixes: 1be4001d9b9b ("hwmon: (lm75) Support active-high alert polarity") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit da730a05cbdb2495f7f5c79ab15e6fddf8ac8644 Author: Guenter Roeck Date: Fri Oct 30 09:22:52 2026 -0700 hwmon: (pmbus) Fix return value check from thermal zone registration [ Upstream commit 4fc79634af8cdf734e0a633923ba4817e30d29ad ] The PMBus core used to call devm_thermal_zone_of_sensor_register() to register thermal zones. Commit 613ed3f676092 ("hwmon: pm_bus: core: Switch to new of thermal API") changed this to call devm_thermal_of_zone_register() instead. The code subsequently checks if the call failed because the thermal subsystem is not configured. devm_thermal_zone_of_sensor_register() used to return -ENODEV in this case. devm_thermal_of_zone_register() returns -ENOTSUPP. The code currently still checks for -ENOVEV. This results in driver instantiation failures if the thermal subsystem is disabled. Check for -ENOTSUPP to fix the problem. Keep checking for -ENODEV because this indicates that no thermal zone is configured for the sensor, which is acceptable for the driver and must not cause a registration failure. Fixes: 613ed3f676092 ("hwmon: pm_bus: core: Switch to new of thermal API") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 80d8cf0238f3be56270b999167d2759f8725647d Author: Guenter Roeck Date: Fri Oct 30 07:34:41 2026 -0700 hwmon: (pmbus) Release devres allocated memory after devm_thermal_of_zone_register error [ Upstream commit 9aa6cc563e881c3cad96ea36926cadceee151f32 ] In pmbus_thermal_add_sensor(), a devres memory leak occurs when a PMBus temperature sensor is initialized but no thermal zone is configured for it. The function allocates a pmbus_thermal_data structure using devm_kzalloc(). It then attempts to register the sensor with the thermal subsystem via devm_thermal_of_zone_register(). If this registration returns -ENODEV (e.g., when no thermal zone is mapped in the Device Tree or CONFIG_THERMAL_OF is disabled), the function intentionally catches the error and returns 0 to allow device probing to continue. Because devm_kfree() is not called on the -ENODEV path, the unused tdata structure remains allocated on the device's managed resource list. Since most PMBus temperature sensors are not attached to thermal zones, this results in an accumulation of unused objects that needlessly consume kernel memory for the lifetime of the PMBus device. Add the missing call to devm_kfree() to fix the problem. Fixes: 3aa74796cfd0 ("hwmon: (pmbus) Register with thermal for PSC_TEMPERATURE") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit f73bdcbbfc9620ddc321804491216440a18840dc Author: Guenter Roeck Date: Thu Oct 29 23:34:04 2026 -0700 hwmon: (pmbus) Check return value from pmbus_thermal_add_sensor() [ Upstream commit 11dfbd835b17b75f7cc7a4a969f33ff702b1b081 ] During PMBus device probe, if registering a temperature sensor with the thermal subsystem fails, pmbus_add_sensor() silently ignores the error and returns success. When a valid temperature sensor is detected (class PSC_TEMPERATURE and type "input"), pmbus_add_sensor() invokes pmbus_thermal_add_sensor() to hook it into the kernel's thermal framework. However, the return value of this call is completely discarded. If thermal registration fails, such as from an -ENOMEM allocation failure or an invalid device tree configuration like a malformed #thermal-sensor-cells property, no error is propagated. Because the hardware monitor probe falsely succeeds despite the failure to register the thermal zone, the system is left without thermal mitigation for the affected PMBus device. This silently blinds the system to actual PMIC temperatures, preventing the execution of necessary cooling mechanisms or emergency shutdowns and risking localized overheating. Pass the return value from pmbus_thermal_add_sensor() to the calling code to fix the problem. To enable passing the actual error, change the error return from pmbus_add_sensor() from NULL to ERR_PTR() and extract the error from in the calling code. Fixes: 3aa74796cfd0 ("hwmon: (pmbus) Register with thermal for PSC_TEMPERATURE") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 73b425e6df23db056873eecce70c3f06db06ca16 Author: Guenter Roeck Date: Thu Oct 29 23:23:58 2026 -0700 hwmon: (pmbus/q54sj108a2) Add missing NULL pointer check [ Upstream commit a5802c587da97a4ff85c04aad6043fa26640fc9b ] When CONFIG_DEBUG_FS is enabled and per-client PMBus debugfs directory creation fails during pmbus_do_probe(), q54sj108a2_probe() passes the NULL pointer returned by pmbus_get_debugfs_dir() to debugfs_create_dir() without validation, creating its debugfs directory at the debugfs root instead of under the client directory. If pmbus_init_debugfs() fails to create the client directory, data->debugfs is left as NULL or an ERR_PTR, which pmbus_get_debugfs_dir() converts to NULL. Passing a NULL parent to debugfs_create_dir() places q54sj108a2_dir in the root of the debugfs filesystem and populates it with attribute files whose private data pointers reference psu->debugfs_entries. Because this root-level directory is outside the client debugfs hierarchy, PMBus core cleanup does not remove it on device unbind, leaking the debugfs entries and causing a use-after-free of the devm-allocated struct q54sj108a2_data if the orphaned files are accessed via q54sj108a2_debugfs_read() or q54sj108a2_debugfs_write() after device removal. Fix the problem by adding the missing NULL pointer check. Fixes: d014538aa385 ("hwmon: (pmbus) Driver for Delta power supplies Q54SJ108A2") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 3f6bd7aeea5c3bd5ced9e23184155065f551ea96 Author: Guenter Roeck Date: Fri Oct 30 11:22:58 2026 -0700 hwmon: (peci/dimmtemp) Fix devres leak and UAF on concurrent unbind [ Upstream commit 61bc4514b8e99e9733c04de028885f6fc906d628 ] When a peci_dimmtemp device is unbound concurrently with its delayed initialization work (detect_work), newly allocated devm resources and the hwmon device are leaked, leading to a use-after-free when reading the lingering hwmon sysfs attributes. In peci_dimmtemp_probe(), detect_work is registered for cancellation via devm_delayed_work_autocancel(). During driver detach, devres_release_all() first moves all existing entries from dev->devres_head onto a local todo list before invoking their release callbacks in reverse order. If create_dimm_temp_info_delayed() is already running when devm_delayed_work_drop() calls cancel_delayed_work_sync(), create_dimm_temp_info() can allocate dimmtemp_label strings via devm_kzalloc()/devm_kasprintf() and register the hwmon device via devm_hwmon_device_register_with_info(), appending new devres entries to the now-empty dev->devres_head. Once the work finishes, devres_release_all() frees priv and priv->name from the local todo list without re-evaluating dev->devres_head, leaving the late devres allocations and registered hwmon device behind with a dangling priv pointer. Cancel detect_work synchronously in a driver .remove() callback instead of relying on devm_delayed_work_autocancel() so that the work is fully drained before devres_release_all() detaches dev->devres_head, allowing any devm resources registered by the delayed work to be released in proper reverse order. Also only schedule detect_work when check_populated_dimms() returns -EAGAIN so that probe failure paths do not leave delayed work pending. Fixes: 73bc1b885dae ("hwmon: peci: Add dimmtemp driver") Cc: stable@vger.kernel.org Cc: Iwona Winiarska Reviewed-by: Iwona Winiarska Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 819b42b6a2533c5134afdaf7fb32856f6f9c37d9 Author: Guenter Roeck Date: Fri Oct 30 07:44:57 2026 -0700 hwmon: (nct6683) Fix incorrect struct cast in show_pwm() and store_pwm() [ Upstream commit c4a01c2a80b203ab5f80885f6994346fe217f19c ] On big-endian architectures, reading or writing the pwm[1-8] sysfs attributes in the nct6683 hardware monitoring driver always redirects to channel 0 due to an incorrect struct downcast in show_pwm() and store_pwm(). The driver defines the PWM sysfs attributes using SENSOR_TEMPLATE(), which initializes them as struct sensor_device_attribute (where the index is a 32-bit int). However, the sysfs callbacks show_pwm() and store_pwm() incorrectly downcast the attribute to a struct sensor_device_attribute_2 (where the index is an 8-bit u8). Because both structs start with struct device_attribute, container_of() resolves to the same base address. On big-endian architectures, reading the 8-bit index field from the memory layout of a 32-bit int fetches the most significant byte (which is 0), rather than the intended channel number. This type mismatch causes all PWM reads to return data for channel 0, and any writes intended to configure other channels will silently overwrite the duty cycle of PWM channel 0 instead. Fix the type casts in show_pwm() and store_pwm() to solve the problem. Fixes: 41082d66bfd6 ("hwmon: Driver for NCT6683D") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 8f5888c37a1a8f5462fdf72fb07d55f23fee5005 Author: Guenter Roeck Date: Fri Oct 30 10:40:36 2026 -0700 hwmon: (lm87) Fix drvdata type confusion in vrm_show() and vrm_store() [ Upstream commit 5b51ff0887b9f88d042b92dd07fcdda4132f0ebc ] When an LM87 or ADM1024 device is probed with VID support enabled, reading from or writing to the vrm sysfs attribute triggers a driver data type confusion in vrm_show() and vrm_store() in drivers/hwmon/lm87.c. In lm87_probe(), the driver stores the struct lm87_data pointer on the I2C client via i2c_set_clientdata() and passes the struct i2c_client pointer as the drvdata argument to devm_hwmon_device_register_with_groups(), which attaches the attribute groups to the registered hwmon device with client as its driver_data. Unlike the other sysfs callbacks that retrieve client via dev_get_drvdata() and then obtain data via i2c_get_clientdata(), vrm_show() and vrm_store() assign dev_get_drvdata(dev) directly to struct lm87_data *. Dereferencing data->vrm therefore accesses the struct i2c_client instance at offsetof(struct lm87_data, vrm), causing vrm_show() to leak an unrelated byte from struct i2c_client to userspace and vrm_store() to corrupt a byte within struct i2c_client while failing to update the actual VRM value. Fix the problem by assigning the return value from dev_get_drvdata(dev) to struct i2c_client *client and using i2c_get_clientdata() to get the actual client data. Fixes: 00a0c905ab4b ("hwmon: (lm87) Use hwmon to create the sysfs groups") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 12ff6e134badee0d053b63328987d80c43384d62 Author: Guenter Roeck Date: Fri Oct 30 10:31:20 2026 -0700 hwmon: (hp-wmi-sensors) Fix unbounded loops in scale_numeric_sensor() [ Upstream commit 185039b1c0389b70ec52a6d3e3c1494e2d0e23da ] In scale_numeric_sensor() in the hp-wmi-sensors hwmon driver, an unbounded loop occurs if the ACPI WMI implementation provides a highly anomalous or malformed UnitModifier value for a numeric sensor. The UnitModifier property is extracted from a WMI ACPI object without bounds checking and cast to a signed 32-bit integer. This value directly controls the iteration count of two scaling loops. If the provided unit_modifier is extremely negative (e.g., INT_MIN), the first loop executes billions of times before reaching target_modifier. Conversely, if unit_modifier is extremely large (e.g., INT_MAX) and the current sensor reading (val) is exactly 0, the second loop's overflow safeguard (val > LONG_MAX / 10) never evaluates to true, resulting in billions of unnecessary iterations. This prolonged execution causes severe CPU stalls and thread soft lockups during driver initialization or whenever a user-space process reads the sensor attribute via sysfs, resulting in a denial of service on the affected CPU core. Fix the problem in the first loop by exiting it as soon as val is zero. Fix the problem with the second loop by only entering it if val is not zero. Also add a check for val < LONG_MIN / 10 and exit the loop if that is the case. Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver") Cc: stable@vger.kernel.org Cc: James Seo Acked-by: James Seo Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 17265d7161a7288df3486419c451ea46939b9e26 Author: Guenter Roeck Date: Fri Oct 30 08:41:11 2026 -0700 hwmon: (hp-wmi-sensors) Avoid global struct mutation [ Upstream commit dc992efeace99e479aec7a8f0c49a9493c729606 ] In the HP WMI sensors driver, make_chip_info() assigns a device-managed memory allocation to a static global structure, resulting in a use-after-free when the device unbinds. During hp_wmi_sensors_probe(), make_chip_info() dynamically allocates a hwmon_channel_info array using devm_kcalloc() and assigns it to the static global hp_wmi_chip_info.info pointer. If multiple instances probe sequentially or concurrently, the shared global pointer is overwritten by each new device. When any device unbinds, its devm-managed memory is automatically freed, leaving the global hp_wmi_chip_info struct and any other active device instances with a dangling pointer. Subsequent accesses by the hwmon core (such as thermal zone reads) will dereference this freed memory, causing a use-after-free. While this is not supposed to happen in the real world (there should only be one instance of the driver in any system), modifying global structures is undesirable and should be avoided whenever possible. Allocate struct hwmon_chip_info as part of struct hp_wmi_sensors instead and initialize it in make_chip_info() to avoid mutating the global structure. Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver") Cc: stable@vger.kernel.org Cc: James Seo Acked-by: James Seo Signed-off-by: Sasha Levin commit c9c3da05135ed106c3cb938568fe2e151bf6ef67 Author: Guenter Roeck Date: Thu Oct 29 23:49:04 2026 -0700 hwmon: (asus_wmi_sensors) Avoid global struct mutation [ Upstream commit 59d586c9e47d1205563bc9b5a5d443adc3ba5bc5 ] In the asus_wmi_sensors driver, device-managed memory allocated in asus_wmi_configure_sensor_setup() is assigned to a global static structure, leading to a potential use-after-free when the device is unbound. The driver defines a single global asus_wmi_chip_info structure to register with the hwmon core. During probe, it dynamically allocates the .info channel array using devm_kcalloc() and assigns it directly to this global structure. When a device is unbound, its device-managed memory is automatically freed, leaving asus_wmi_chip_info.info as a dangling pointer. Furthermore, if multiple WMI devices are probed sequentially, each probe overwrites the same global pointer, forcing all registered hwmon instances to reference the channel information of the most recently probed device. While it is unlikely if not impossible that multiple WMI devices of the same kind exist, modifying a global static data structure is undesirable. Remove the static data structure and allocate it as part of struct asus_wmi_sensors to avoid the potential problem. Fixes: 548820e21ce1 ("hwmon: (asus_wmi_sensors) Support X370 Asus WMI.") Cc: stable@vger.kernel.org Cc: Ed Brindley Cc: Denis Pauk Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit e0f4a2fb3a5e3a8c375613192bb503b559b474e1 Author: Guenter Roeck Date: Thu Oct 29 23:57:16 2026 -0700 hwmon: (aquacomputer_d5next) Check maxcollection when probing AQUAERO devices [ Upstream commit b7743c6dbe3ab94045164ef298f65cfb9b0b450a ] When a USB HID device matching USB_PRODUCT_ID_AQUAERO presents a malformed report descriptor, an out-of-bounds array access occurs in aqc_probe() due to an unchecked index into the parsed collections array. During device initialization, the driver distinguishes between the multiple logical interfaces exposed by the Aquaero device by evaluating the type of the second element in the collection array. The driver unconditionally accesses hdev->collection[1] without verifying that hdev->maxcollection is greater than 1. Because the collection array is dynamically allocated by the HID core based on the number of collections found in the report descriptor, a crafted device exposing fewer than two collections causes an immediate heap out-of-bounds read or NULL pointer dereference. This leads to a kernel panic during the device probe phase. Add the missing check to fix the problem. Fixes: 2c55211104b4 ("hwmon: (aquacomputer_d5next) Support sensors for Aquacomputer Aquaero") Cc: stable@vger.kernel.org Cc: Aleksa Savic Cc: Jack Doan Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 47dfe6b2db550e4c93fda66e8f219b0e1e5100ec Author: Javier Carrasco Date: Wed Oct 14 19:34:10 2026 +0200 hwmon: chipcap2: synchronize ready IRQ state [ Upstream commit 8c02722be2caa6604a837b81faeaba78250eda4a ] The ready IRQ handler can race with reinit_completion() in the enable path. In particular, a handler from an earlier operation can complete the completion after it is reset for a new operation. Use irq_lock to serialize access to the completion and process_irqs. Disable IRQ processing and synchronize any running handler before resetting the completion for a new operation. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-11-27ebfc2c5b9e@gmail.com [groeck: Dropped obsolete 'Assisted-by: tag] Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 66f9d8f5c8583e39859947904b847014e7ead226 Author: Javier Carrasco Date: Wed Oct 14 19:34:09 2026 +0200 hwmon: chipcap2: serialize access to the alarm indicators [ Upstream commit bed5f0c075eb99442fca6a61c009a32752eceda2 ] low_alarm and high_alarm are accessed from the threaded interrupt handlers and from sysfs without any locking, which can lead to lost alarms. Add a mutex to serialize the access to the alarm indicators and to process_irqs, which the handlers use to decide whether an interrupt belongs to an ongoing operation. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-10-27ebfc2c5b9e@gmail.com [groeck: Dropped obsolete 'Assisted-by: tag] Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit ff621650e749abd0ddc4cb616d501bf1d567e28a Author: Javier Carrasco Date: Wed Oct 14 19:34:08 2026 +0200 hwmon: chipcap2: do not discard pending alarms on disable [ Upstream commit 22aecf164e1c0c849808c342c65322d14f45176f ] cc2_disable() stops processing interrupts before the device is powered down to ignore the alarms caused by voltage toggling. The handler of an alarm raised by the last measurement might not have run at that point, and the alarm is discarded when it finally does. The sysfs read that triggered the measurement can then report no alarm although the device raised one. Wait for the alarm handlers that have already been raised before the interrupt processing is stopped. This covers the case where the handler thread has not been scheduled yet; an alarm that has not reached the interrupt core at that point is discarded. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-9-27ebfc2c5b9e@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 4c20d0f8e6302f123095479bde6f5235f5327098 Author: Javier Carrasco Date: Wed Oct 14 19:34:07 2026 +0200 hwmon: chipcap2: balance regulator state [ Upstream commit 378add65fd7d352de9fe440d167fde5bf511b090 ] The current implementation does not guarantee that the calls to regulator_enable() and regulator_disable() are balanced. regulator_is_enabled() might return a negative value, and an always-on attribute in the DT might break the symmetry anyway. Add a regulator_enabled flag to keep balance within this regulator consumer. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-8-27ebfc2c5b9e@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 8dbcc5e568544bd81628dd198eade1c3fac86997 Author: Javier Carrasco Date: Wed Oct 14 19:34:06 2026 +0200 hwmon: chipcap2: enable IRQ processing when regulator is already enabled [ Upstream commit d1ce827a9cc11ffdfec77b7fec9b73a8020a308d ] cc2_enable() returns early when the regulator is already enabled. This can happen if a previous regulator_disable() failed or if the regulator was configured as always-on. In this case, process_irqs remains false, causing the ready interrupt to be ignored. Subsequent operations waiting for the ready completion then time out. Set process_irqs before returning when the regulator is already enabled, so that the driver continues to process ready interrupts. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-7-27ebfc2c5b9e@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 8e0858d118e8ce136fa02390987fade2cc5b8b61 Author: Javier Carrasco Date: Wed Oct 14 19:34:05 2026 +0200 hwmon: chipcap2: disable device after hwmon teardown [ Upstream commit 4724ac5556ce63f01a3f5d61fc7fcc20f4ddef3f ] cc2_remove() disables the device while the device-managed hwmon device is still registered. A concurrent sysfs callback can then enable the device after it has been disabled during removal. Register a device-managed disable action before registering the hwmon device, so devres unregisters the hwmon device before disabling the physical device. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-6-27ebfc2c5b9e@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit a205f2113200c6357e0526c94caaa4c2aceb2fc7 Author: Javier Carrasco Date: Wed Oct 14 19:34:04 2026 +0200 hwmon: chipcap2: fix IRQ teardown ordering [ Upstream commit d2a66c515d7730fd453485ffb306c412f1f46d72 ] The threaded IRQs are currently requested before the hwmon device is registered. Since devres releases resources in reverse order, the hwmon device is unregistered before the IRQs are freed during driver teardown. An IRQ may therefore still run after the hwmon device has been released and access the stale data->hwmon pointer. Separate IRQ discovery from IRQ registration so that the IRQ numbers and alarm visibility flags are initialized before registering the hwmon device while the IRQs are released before the hwmon device during devres cleanup. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-5-27ebfc2c5b9e@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit b4a58557f293cd0e7f6d6e86871acb17e39af3b2 Author: Javier Carrasco Date: Wed Oct 14 19:34:03 2026 +0200 hwmon: chipcap2: defer probe when IRQs are unavailable [ Upstream commit b5a1412618f93b594f924cf4f3b4bb6b5dc49d41 ] This device can work with or without interrupts, but if they are provided and still not available, but if -EPROBE_DEFER is read, its value must be propagated to enable probe retries. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-4-27ebfc2c5b9e@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit a35345c8eef3cc5803a678755d1df7bb4acc2e7b Author: Javier Carrasco Date: Wed Oct 14 19:34:02 2026 +0200 hwmon: chipcap2: fix be16 handling [ Upstream commit 36b07ddfe20b0fe06a8bc32c5e09974876fb5e42 ] The driver currently only works correctly on little-endian architectures when writing 16-bit register values. Use i2c_smbus_write_word_swapped() for writes and get_unaligned_be16() for reads to correctly handle the ChipCap 2's big-endian data format on all architectures. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-3-27ebfc2c5b9e@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 66872eb365a40977f4490799b427d7c1e69a4832 Author: Javier Carrasco Date: Wed Oct 14 19:34:01 2026 +0200 hwmon: chipcap2: fix off-by-one in command mode retry loop [ Upstream commit 4c0e65a4ed665c416ccb1524c58a646a580e491f ] i == CC2_CM_RETRIES can never be true inside the loop, since it only runs while i < CC2_CM_RETRIES. Use CC2_CM_RETRIES - 1 so the last failed retry breaks out immediately instead of doing a useless disable + 80 ms power-cycle delay before the loop condition ends it anyway. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-2-27ebfc2c5b9e@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 824671eae6f9352f6f31ad6ecf5926a92eed685b Author: Javier Carrasco Date: Wed Oct 14 19:34:00 2026 +0200 hwmon: chipcap2: fix command error diagnostics [ Upstream commit d0a03e1a2d9bd53b94fe6dff7a1a8058d25be82d ] The command response field only contains bits 1:0, while the error flags are stored in bits 2:5. The existing diagnostic checks test the extracted response field, so they can never report an error flag. Test the full status byte for the error flags, and check the configuration-load flag instead of RAM parity for the last diagnostic. Fixes: 3af350929e75 ("hwmon: Add support for Amphenol ChipCap 2") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20261014-chipcap2_locks-v3-1-27ebfc2c5b9e@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 98a7b7730257f49a5d0c89dbc462ce9e92294736 Author: Alexei Solcanu Date: Sat Sep 26 16:11:20 2026 -0400 hwmon: (gpd-fan) Reset both fans to automatic on duo boards [ Upstream commit d1f60971fbf85c243ab6c78f6535fbc88fa640ce ] On boards using gpd_duo_drvdata (GPD Duo, GPD Win 5), writing pwm1_enable=2 only returns the first fan to EC control. The second fan keeps its last manual duty cycle, e.g. full speed after pwm1=255, so a fan control tool that exits leaves it running at that speed. gpd_duo_write_pwm() writes both fan registers (pwm_write and pwm_write + 1), but switching to automatic only clears pwm_write. Also clear pwm_write + 1, so both fans return to EC control. Tested on a GPD Win 5 (G1618-05). Not tested on the GPD Duo. Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver") Cc: stable@vger.kernel.org Signed-off-by: Alexei Solcanu Reviewed-by: Antheas Kapenekakis Link: https://patch.msgid.link/20260926-gpd-fan-duo-auto-v2-1-0a2ea41ee3b5@pm.me [groeck: Dropped obsolete 'Assisted-by: tag] Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 5f21000d1f239fea6db3c7384f2573125983f5e2 Author: Zac Lanzon Date: Mon Sep 28 07:41:05 2026 -0400 hwmon: (asus_rog_ryujin) Fix pump control source on the Ryujin III [ Upstream commit 743b4481b6112d8ac11c165628daa8e0f0ecf78c ] The RYUJIN III pump has a 4-pin cable for a motherboard fan header in addition to USB. Byte 2 of the set cooler duty command selects the pump control source: 0 hands the pump to its internal controller, which follows the PWM of the header its 4-pin cable is plugged into, and 1 makes it follow the pump duty in byte 3. Byte 3 of the cooler duty report returns the current source. The driver fills byte 2 with duty_channel, which is 1 for the RYUJIN III, and a pwm2 write re-sends the reported pump duty with the new fan duty. So writing only the internal fan duty takes the pump away from its internal controller. Measured on a RYUJIN III 360 (firmware AURJ2-S750-0108) with the pump cable on AIO_PUMP and the header PWM set through nct6775, after loading the driver with the pump on its internal controller (pump rpm): header 50% header 80% source no write yet 2160 3090 0 pwm2 = 40%, before this patch 1740 1740 1 pwm2 = 40%, with this patch 2130 3090 0 Send the reported source with pwm2 writes. The fan duty applies with either source (40%: 1545 to 1590 rpm, 30%: 870 rpm). A pwm2 write sent right after a pwm1 write that took the pump over, before the report could show the change, left the pump on USB and applied its fan duty (2 of 2 trials, and 7 of 7 with raw commands up to 0.9 s after). pwm1 writes keep selecting source 1. The cooler reports the pump duty of the last write, whichever source it selected, and 40% after power-on. Byte 9 of the status report follows the duty the pump runs at. Measured from power-on (PSU switched off) once per driver, with the header at 100%: before this patch with this patch source duty rpm source duty rpm no write yet 0 100 3570 0 100 3570 pwm2 = 40% 1 100 3570 0 100 3570 pwm1 = 40%, the reported duty 1 100 3570 1 40 1710 pwm1 = 60% 1 60 2430 pwm1 = 40% 1 40 1725 So a pwm1 write of the reported duty did not reach the pump, while other duties applied in one write, also when taking the pump from its internal controller (60%: 2460 rpm). When a pwm1 write requests the reported duty, write a duty 1% away first (below at 100%), then the requested one. Sent back to back, the two writes left the pump at the requested duty in all 19 trials, 9 with raw commands and 10 through this driver. Tested on the RYUJIN III 360 only. The EXTREME, EVA and WHITE EDITION use the same rog_ryujin_iii_info and send the same command, and Edward Blair's analysis of the WHITE EDITION firmware shows the same pump control source. The RYUJIN II, whose duty_channel is 0, is unchanged. Fixes: cd258aca0dc4 ("hwmon: (asus_rog_ryujin) Add ROG Ryujin III support") Closes: https://github.com/aleksamagicka/asus_rog_ryujin-hwmon/issues/12 Suggested-by: Edward Blair Cc: stable@vger.kernel.org Signed-off-by: Zac Lanzon Link: https://patch.msgid.link/7ca8fe6cd6b4125813613bd4187ff6cdda72e4b6.1790512964.git.lanzonza@gmail.com [groeck: Dropped obsolete 'Assisted-by: tag] Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 25dcc6ab1c4c2b55625334b95fecc1acc8203c47 Author: Jiale Yao Date: Wed Oct 21 20:04:07 2026 +0800 hwmon: (aquacomputer_d5next) reject short status reports [ Upstream commit cf8f81babd2e96087dedbb74985bc1781c98f73d ] The HID raw_event callback runs before HID core validates the received report length. aqc_raw_event() reads device-specific status fields at fixed offsets, including multi-byte values, without first ensuring that the received buffer contains every field. A truncated report can therefore cause out-of-bounds reads and update hwmon state with unrelated data. The required length differs between supported devices and cannot be derived from the HID report descriptor. Define the minimum length needed by each asynchronous status format, select it while configuring the device, and reject reports that do not contain the last field accessed by that format. Keep the published length zero until probe configuration is complete, which also excludes legacy devices whose status is retrieved through feature reports. Suggested-by: Guenter Roeck Fixes: 0e35f63f7f4e ("hwmon: add driver for Aquacomputer D5 Next") Fixes: 19692f17cd13 ("hwmon: (aquacomputer_d5next) Add support for Aquacomputer Aquastream XT") Cc: stable@vger.kernel.org Signed-off-by: Jiale Yao Link: https://patch.msgid.link/20261021120408.48495-1-yaojiale02@163.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit a90e1fdfd784b21c0e0a49d5059e2b74b630813a Author: Baek Kyu, Kim Date: Wed Oct 21 01:09:41 2026 +0900 hwmon: (corsair-cpro) Cache fan target only after a successful command [ Upstream commit e2c26431b4e47892378582a414b4bbaa9edf1798 ] set_target() updates the cached fan target before sending the command. If the command fails, subsequent fanN_target reads report the failed request instead of the previous value. For example, after successfully setting 1200 RPM, a rejected request for 1800 RPM returns an error but leaves fanN_target reporting 1800. A failed request also replaces -ENODATA when no target has been successfully set. Update the target cache under the existing mutex only after send_usb_cmd() succeeds, as set_pwm() already does when invalidating the target. Preserve the previous cached value and return the original error on failure. Fixes: 40c3a4454225 ("hwmon: add Corsair Commander Pro driver") Cc: stable@vger.kernel.org Signed-off-by: Baek Kyu, Kim Link: https://patch.msgid.link/20261020160941.36787-1-pocj8ur4in@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 00eac810baa70d1980bb4242990cc558b4461a72 Author: Myeonghun Pak Date: Fri Oct 23 21:40:44 2026 -0400 hwmon: (sht15) Stop deferred work before releasing its resources [ Upstream commit 5eab1e7f7ed12893f3864fe46ffcd5a41a752d6a ] The IRQ handler and regulator notifier can leave work pending after a measurement or notification completes. Neither work item is drained before its resources are released on removal or probe failure. Disable read_work before freeing the IRQ, since the worker can re-enable it. Use request_irq()/free_irq() for explicit teardown. Unregister the regulator notifier before cancelling update_supply_work and disabling the regulator. Apply the same ordering to probe failures. Fixes: 251eb40f5ccd ("hwmon: sht15 humidity sensor driver") Cc: stable@vger.kernel.org Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak Link: https://patch.msgid.link/20261024014044.27853-1-mhun512@gmail.com [groeck: Dropped obsolete 'Assisted-by: tag] Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin commit 534daf11eedf253395b336cfdd250b45b4e86429 Author: Xia Yan Date: Thu Oct 29 10:42:58 2026 +0800 veth: keep carrier off when resizing channels with a down peer [ Upstream commit 2d02191779345b13de91048db441191b20264d16 ] veth_set_channels() temporarily turns carrier off while reconfiguring a running interface. It then turns carrier on for both ends without checking whether the peer is administratively up. If only one end is up, changing its channel counts therefore reports LOWER_UP even though the peer remains down. For example, after creating a pair with two RX and TX queues per end: ip link set vca up ethtool -L vca rx 1 tx 1 vca incorrectly reports LOWER_UP while vcb is still down. Only restore carrier when the peer has IFF_UP, matching veth_open(). The local interface is already known to be running at this point. Found during LLM-assisted source review and reproduced with a veth pair in network namespaces, without kernel instrumentation or error injection. The companion veth.sh test reproduces the two mixed up/down failures before the fix and passes after it. Fixes: 4752eeb3d891 ("veth: implement support for set_channel ethtool op") Cc: stable@vger.kernel.org Reviewed-by: Hangbin Liu Signed-off-by: Xia Yan Reviewed-by: Jiayuan Chen Link: https://patch.msgid.link/20261029024259.3700-1-yana06070@163.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin commit 4a7fbfa4c3d175d1198cc47193bc159f3461c9f1 Author: Fang Xieyan Date: Sun Sep 27 00:07:55 2026 +0800 vringh: reject empty / undersized indirect descriptor tables [ Upstream commit 60a792b97933a686316737838cd007d27963011e ] move_to_indirect() validates an indirect descriptor table only with "len % sizeof(struct vring_desc)". A descriptor flagged VRING_DESC_F_INDIRECT with len == 0 passes that test, so *desc_max is set to 0 while *descs points at the empty table. __vringh_iov() then copies one struct vring_desc from descs[0] -- 16 bytes past the end of the table -- before the "indirect_count > desc_max" loop detection aborts the walk. The over-read value is discarded when the walk aborts and is never used to map anything, but the access itself is out of bounds. Reject any len smaller than one descriptor, alongside the existing stride check, so an empty table is refused with -EINVAL and no descriptor is ever fetched from it. Fixes: f87d0fbb5798 ("vringh: host-side implementation of virtio rings.") Cc: stable@vger.kernel.org Assisted-by: Hawkeye:GLM-5.3-flash Assisted-by: Qoder:Qwen3.8-Max Signed-off-by: Fang Xieyan Message-ID: <20260926160755.21485-1-fangxy@xiaopeng.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin commit f6b933a9a1ebf67ae5474bfb8824500457dfbb68 Author: Fang Xieyan Date: Tue Sep 22 20:29:54 2026 +0800 vringh: bound top-level re-entry into indirect tables [ Upstream commit f898439ace7f89922e853b43bcbfcd26ea2e0a98 ] In __vringh_iov(), the F_INDIRECT branch descends into the indirect table and continues before the descriptor accounting runs. A top-level indirect descriptor is therefore never charged to count. If such a descriptor sets NEXT to point back at itself, returning from the indirect table resumes at the same top-level descriptor, which is again not counted, so the walk never makes forward progress. Because count stays flat and indirect_count is reset to 0 on every return to the top-level table, neither bound in the loop check trips. A guest can spin the vringh worker at 100% CPU inside __vringh_iov(), an uninterruptible host DoS. Move the descriptor accounting above the indirect switch so that a top-level indirect descriptor is charged one top-level traversal step before the walk descends into its table, bringing this re-entry under the existing vrh->vring.num bound. Each top-level descriptor is still charged at most one step and indirect_count still bounds a single table, so legitimate chains (including the multiple-indirect case in tools/virtio/vringh_test.c) stay within vring.num, while a cyclic indirect descriptor is now rejected with -ELOOP. Fixes: dbd29e075228 ("vringh: Fix loop descriptors check in the indirect cases") Cc: Xie Yongji Cc: stable@vger.kernel.org Assisted-by: Hawkeye:GLM-5.3-flash Assisted-by: Qoder:Qwen3.8-Max Signed-off-by: Fang Xieyan Signed-off-by: Michael S. Tsirkin Message-ID: <20260922122955.69433-2-fangxy@xiaopeng.com> Signed-off-by: Sasha Levin commit 5b9af57dba47a1750be4831da1f1f34c99c50caa Author: Tal Zussman Date: Sat Oct 31 13:45:34 2026 -0400 vhost-vdpa: fix pinned page leak in vhost_vdpa_pa_map() error path [ Upstream commit fd1462c96bafe2cb14e88c837b270f8990b717b5 ] When pin_user_pages() or vhost_vdpa_map() fails, vhost_vdpa_pa_map() is supposed to unpin the pages pinned after the last successfully mapped chunk, i.e. the range [map_pfn, last_pfn]. The unpin is guarded by nchunks, but nchunks is reset to 0 every time a chunk is mapped from inside the current page list, so a failure after any such boundary leaves that pending range pinned forever. With physically scattered memory nearly every page list contains a boundary, so the leak happens on practically every failed IOTLB update. The pending range is non-empty exactly when a page has been pinned, which last_pfn already tells us, so drop nchunks and test last_pfn. Fixes: ad89653f79f1 ("vhost-vdpa: fix page pinning leakage in error path (rework)") Cc: stable@vger.kernel.org Signed-off-by: Tal Zussman Reported-by: Linfeng Sun Signed-off-by: Michael S. Tsirkin Message-ID: <20261031-vhost-vdpa-unpin-v1-1-94ffc9683256@columbia.edu> Signed-off-by: Sasha Levin commit df35f062d4f24e4c9d9711d6af24916d3784871c Author: Zhan Xusheng Date: Mon Nov 2 17:35:43 2026 +0800 ntfs: don't allow compression on volumes with clusters larger than 4K [ Upstream commit c77ab4eeeb3ed471bcc99a94673f0e0142c4b84a ] On a volume made with "mkntfs -c 8192", a user can set FILE_ATTR_COMPRESSED on an empty file through system.ntfs_attrib. Writing to the file and reading it back after dropping the page cache then crashes: BUG: KASAN: slab-out-of-bounds in ntfs_read_compressed_block+0xa2c/0x2040 Read of size 8192 at addr ffff88804355a000 by task dd/106 The read path only handles clusters up to 4K. It copies each cluster out of a single page, and a compression block of 16 8K clusters does not fit in the 64K ntfs_compression_buffer. Loading an inode already rejects compressed data on such volumes. Reject the flag change the same way. Fixes: fc053f05ca28 ("ntfs: add reparse and ea operations") Cc: stable@vger.kernel.org Signed-off-by: Zhan Xusheng Reviewed-by: Baolin Liu Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin commit 0d9a6f9778ccd4401ded4ec9faf750b7b4a14ce7 Author: Qihang Date: Thu Oct 29 11:39:42 2026 +0800 cipso: fix optlen corruption in cipso_v4_delopt() [ Upstream commit 1f1f8e8c5176234fa31858cd25f2e9b88aac0a45 ] cipso_v4_delopt() recomputes the option length by walking the option buffer after the CIPSO option has been moved out. The walk then reads the stale bytes at the tail of the buffer as option data, and a crafted setsockopt(IP_OPTIONS) buffer can make it treat one of them as an option length, increasing opt->opt.optlen beyond the valid option data. The corrupted length stays on the socket and is later used as the copy length by getsockopt(IP_OPTIONS) and by the udp/raw/ping sendmsg paths, where it exceeds the size of the buffers they copy into. Compute the new length from the intact options before the move and subtract the CIPSO length, and fill the padding with IPOPT_END. Assisted-by: LLM Fixes: 014ab19a69c32 ("selinux: Set socket NetLabel based on connection endpoint") Cc: stable@vger.kernel.org Signed-off-by: Qihang Acked-by: Paul Moore Signed-off-by: Dave Miller Signed-off-by: Sasha Levin commit 1b48fe8b323103e278fbc5145231b763577e2487 Author: Maíra Canal Date: Tue Jul 7 17:05:48 2026 -0300 drm/v3d: Widen cache_clean_lock over the whole L2TCACTL sequence [ Upstream commit 994ba6e5c87d6a3d471ea987fe8622168f092334 ] v3d_clean_caches() and v3d_flush_l2t() both write the single L2TCACTL register and poll its status bits. The mutex cache_clean_lock exists to serialize them, but v3d_clean_caches() only took the lock around its final FLM_CLEAN write. These functions run concurrently: v3d_flush_l2t() is issued from the BIN/RENDER/CSD invalidate path while v3d_clean_caches() runs from the CACHE_CLEAN queue, and each queue's scheduler uses its own ordered workqueue, so their run_job callbacks execute in parallel. Because clean locked only its final write, a concurrent flush can write L2TCACTL during clean's unlocked phase. Both use non read-modify-write writes to the one register, so whichever lands last wins: clean's TMUWCF write can land on the flush's in-flight L2TFLS invalidate, triggering the GFXH-1897 hazard of writing L2TCACTL while a flush is pending. Hold cache_clean_lock across the entire L2TCACTL access sequence so it is fully mutually exclusive with v3d_flush_l2t(), which already takes the lock around its own write. Cc: stable@vger.kernel.org Fixes: abf888b03a98 ("drm/v3d: Wait for pending L2T flush before cleaning caches") Reviewed-by: Iago Toral Quiroga Reviewed-by: Jose Maria Casanova Crespo Link: https://patch.msgid.link/20260707200738.659002-2-mcanal@igalia.com Signed-off-by: Maíra Canal Signed-off-by: Sasha Levin commit 87164583794183d16c6de291ef2aaa7d96f46743 Author: Jose Maria Casanova Crespo Date: Sun Nov 1 09:53:57 2026 -0300 drm/v3d: Initialize timedout_batches when running a CSD job [ Upstream commit 0afdbdd5b1af729108de8f893d179c3b99eac29d ] v3d_csd_job_timedout() decides whether a compute job made progress by comparing CSD_CURRENT_CFG4, the number of batches the dispatcher still has to start, against the value saved at the previous timeout. That saved value is never initialized, so it is zero on the first timeout. On V3D 7.1.6 and later, CFG4 counts down to zero once the dispatcher has started the last batch, but the dispatch keeps running until the batches in flight complete. If the first timeout fires in that window, the handler sees no change and resets the GPU while the job is about to complete. For example, this happens with long dispatches that only keep a single supergroup in flight. Initialize timedout_batches to the value programmed in CFG4 when the job is started. The register does not return to it once a batch has started: it counts down to zero on V3D 7.1.6 and later (CFG4 holds the number of batches), and to 0xffffffff on V3D 4.2 (CFG4 holds the number of batches minus one). Cc: stable@vger.kernel.org Fixes: d223f98f0209 ("drm/v3d: Add support for compute shader dispatch.") Signed-off-by: Jose Maria Casanova Crespo Reviewed-by: Iago Toral Quiroga Link: https://patch.msgid.link/20261101125619.2465064-1-mcanal@igalia.com Signed-off-by: Maíra Canal Signed-off-by: Sasha Levin commit 068bc59fb853b9306013e840cdc0bb93ed70530e Author: Daejun Park Date: Mon Oct 26 10:54:06 2026 +0900 xfs: don't skip free extents of the longest length in a whole-AG FITRIM [ Upstream commit 5745f4f10a1a16aa5bb020acc38afa33f2d5ff99 ] Since commit a66d636385d6 ("xfs: fix fstrim offset calculations"), the by-length walk of an AG in FITRIM starts with xfs_alloc_lookup_ge(cur, 0, pagf_longest) and walks down. The lookup lands on the longest free extent with the lowest block number. The other free extents of that length sort after it and are never discarded. Start every by-length batch with xfs_alloc_lookup_le() at restart_bno. Suggested-by: Dave Chinner Link: https://lore.kernel.org/r/ZgiJWxVcVwag0fIP@dread.disaster.area Cc: stable@vger.kernel.org Fixes: a66d636385d6 ("xfs: fix fstrim offset calculations") Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit c786fc3b8b599e99c0296dcdc07b3c57b4c8c353 Author: Daejun Park Date: Mon Oct 26 10:54:05 2026 +0900 xfs: don't skip free extents in later batches of a whole-AG FITRIM [ Upstream commit 595e67d7261673d03c96950ffbb2e545c00376ed ] A whole-device FITRIM walks every AG but the last by length, in batches. xfs_trim_gather_extents() saves the record to restart from in tcur->start. But tcur->start is also the start of the range to trim. Later batches therefore never discard the free extents below that block. Save the restart record in a new restart_bno field. Cc: stable@vger.kernel.org # v6.10 Fixes: b0ffe661fab4 ("xfs: fix performance problems when fstrimming a subset of a fragmented AG") Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 0e1b79ead64edbb6b1a575099dea2495294f44c3 Author: Binbin Deng <18983559317@163.com> Date: Thu Oct 15 16:02:25 2026 +0800 xfs: set healthmon mount cookie before publishing it [ Upstream commit 0344a9492efac4c79202a07cf284a382f7054170 ] xfs_ioc_health_monitor() allocates the healthmon object with kzalloc(), so mount_cookie starts as zero. zero is also DETACHED_MOUNT_COOKIE, but xfs_healthmon_attach() publishes hm through mp->m_healthmon before storing the mount cookie. A concurrent reporter can therefore acquire hm from xfs_healthmon_get(), see the detached cookie in xfs_healthmon_push(), and drop the event even though the monitor is being attached. This is reachable by racing XFS_IOC_HEALTH_MONITOR with an operation that reports a health event, such as a filesystem shutdown. Initialize the mount cookie before making hm visible through the RCU pointer so reporters always observe an attached monitor. Found during a static-analysis-assisted audit: candidate sites were surfaced by a Coccinelle rule, and the reader/writer paths were confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was not observed at runtime; it is identified by code inspection only. Fixes: a48373e7d35a ("xfs: start creating infrastructure for health monitoring") Cc: stable@vger.kernel.org Signed-off-by: Binbin Deng <18983559317@163.com> Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 2abb4af94f20bda924d4de15b21da11df433604e Author: Hungyu Lin Date: Mon Nov 2 06:15:55 2026 +0000 ext2: preserve completed DIO bytes when buffered fallback fails [ Upstream commit cbf04dde8b3c5a7e043e91cefad68b8980ea0d18 ] ext2_dio_write_iter() can complete part of a direct write before falling back to buffered I/O for a hole inside i_size. If generic_perform_write() then fails, its error overwrites the completed direct-I/O byte count. For example, on a full filesystem, an 8 KiB write to a file with an allocated 4 KiB prefix and a 4 KiB hole overwrites the prefix but returns ENOSPC and leaves the file position unchanged. GNU dd with oflag=direct consequently reports zero bytes written. Preserve a positive direct-I/O result and return the buffered error when no bytes were direct-written. This restores the fallback policy of generic_file_write_iter(), which ext2 used before its iomap conversion. Fixes: fb5de4358e1a ("ext2: Move direct-io to use iomap") Cc: stable@vger.kernel.org Signed-off-by: Hungyu Lin Link: https://patch.msgid.link/20261102061555.55183-1-dennylin0707@gmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin commit e8ebc5a46795cd1fb4333df81f19bbf458467cce Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:40 2026 +0100 mm/huge_memory: properly handle refcounted PUD mappings on fork [ Upstream commit d90bdc02e36ec08d8248ebc6cdc52e12043eb28c ] copy_huge_pud() copies device-DAX entries without taking a folio reference or updating mapcounts and the child's RSS. For example, MADV_GUARD_INSTALL sets VM_MAYBE_GUARD on a device-DAX VMA, forcing copy_page_range() to traverse the whole VMA on fork. Any remaining huge PUDs are then copied without accounting for the new mappings. Unmapping them in the child decrements accounting that was never added. Use vm_normal_page_pud() to identify refcounted mappings. Take a folio reference and add the child's PUD rmap and RSS accounting before installing the copied entry. Pass src and dst VMAs consistently instead of src and dst MM. Move the TODO. Fixes: aed877c2b4257 ("device/dax: properly refcount device dax pages when mapping") Cc: stable@vger.kernel.org Reviewed-by: Zi Yan Reviewed-by: Pedro Falcato Reviewed-by: Lance Yang Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-11-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 877a9fbabf760714f510f36b310a986c4be2c2d8 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:39 2026 +0100 mm/huge_memory: fix list corruption when deferred_split_scan() races with deferred_split_folio() [ Upstream commit f09171b67ea06a7fe425db33e8b74a92de1426b9 ] Since the deferred split queue became a list_lru, the isolate callback moves the folios it took a reference on to an on-stack list, linked through folio->_deferred_list, and deferred_split_scan() takes them off that list with list_del_init() without holding the list_lru lock. deferred_split_folio() does not know about the on-stack list. It only holds the list_lru lock when it looks at the same list_head, and it can run for such a folio: a THP is queued when it is mapped, as a candidate for the underused check, and is queued "again" when a part of it gets unmapped: CPU0 deferred_split_scan() CPU1 deferred_split_folio() list_del_init(&folio->_deferred_list) next->prev = prev prev->next = next entry->next = entry list_lru_lock_irqsave() folio_set_partially_mapped() __list_lru_add() list_empty(item) -> true list_add_tail(item, &l->list) item->next = &l->list item->prev = tail entry->prev = entry The folio now sits on the list_lru with ->prev pointing to itself. The next removal leaves the neighbours pointing to it, and they still do so after the folio has been freed. With CONFIG_DEBUG_LIST: list_del corruption. prev->next should be ffd4000000270090, but was ffd4000000278090. (prev=ffd4000000270090) Fix it by grabbing the lock around list_del_init() so deferred_split_folio() cannot race with it. Fixes: fafaeceb89a5 ("mm: switch deferred split shrinker to list_lru") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Reviewed-by: Johannes Weiner Reviewed-by: Mani Tofigh Tested-by: Mani Tofigh Reviewed-by: Lance Yang Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-10-d6437171ecc3@kernel.org Reviewed-by: Baolin Wang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 9075e5fbad71e00a73cddef901a2a08ad7b51af5 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:38 2026 +0100 mm/rmap: handle device-exclusive entries in folio_referenced_one() [ Upstream commit f3c493d2f42b5f44a5c134d8d7ea7f960caf5e2c ] page_vma_mapped_walk() can return non-present device-exclusive entries, but folio_referenced_one() passes them to PTE young-bit accessors that require present PTEs. We must neither call clear_flush_young_ptes_notify() nor folio_pte_batch() with non-present entries. For example, clearing the young bit on non-present PTEs can corrupt the entry: on arm64 PTE_AF overlaps the swap type, so clearing it turns a device-exclusive entry into an ordinary swap entry. folio_pte_batch() will VM_WARN_ON_FOLIO. Apply the same approach as the previous fixes to e.g., damon_ptep_mkold(): treat these entries as old from the CPU's perspective and obtain their young state through the MMU notifier. Skip PTE batching and MGLRU look-around for non-present entries, and don't modify non-present PTEs. Fixes: b756a3b5e7ea ("mm: device exclusive memory access") Reviewed-by: Lorenzo Stoakes (ARM) Cc: stable@vger.kernel.org Reported-by: Josef Bacik Reviewed-by: Harry Yoo (Meta) Reviewed-by: Barry Song Reviewed-by: Dev Jain Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-9-d6437171ecc3@kernel.org Reviewed-by: Baolin Wang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 8500faaa6ef7b4489294f2bf98c9017ee009986c Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:37 2026 +0100 mm/filemap: finish fault cleanup before dropping the fault lock [ Upstream commit 97156a6c355c21f7122421915f05461bd11699a4 ] On a retried fault, a fatal signal interrupting the folio lock wait makes lock_folio_maybe_drop_mmap() drop the fault lock without pinning the file. However, filemap_fault() may still need to release mapping->invalidate_lock. A concurrent munmap() can release the last file reference and free the mapping before that unlock. Defer dropping the fault lock to filemap_fault()'s retry cleanup, after releasing invalidate_lock. If the fault lock was already dropped for I/O, release the existing file reference instead. Keep the fault lock held for FAULT_FLAG_RETRY_NOWAIT as before. Fixes: 730633f0b7f9 ("mm: Protect operations adding pages to page cache with invalidate_lock") Cc: stable@vger.kernel.org Reported-by: Chris Mason Reviewed-by: Thadeu Lima de Souza Cascardo Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-8-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 31cb998f208c078a6e9656b971bb311ea490ff1e Author: Josef Bacik Date: Sat Oct 31 10:39:36 2026 +0100 mm/filemap: don't lose a folio lock wakeup to a signal [ Upstream commit 8ccb6ded6a47b59b4907ed4f8c293cf8122de889 ] An exclusive waiter in folio_wait_bit_common() can leave the wait loop because of a fatal signal, then be woken by folio_unlock() before finish_wait(). If the waker did not hand over the lock, the waiter returns -EINTR without trying to acquire it. folio_wake_bit() stops after waking the first exclusive waiter, so this loses the wakeup and can leave other waiters asleep indefinitely on an unlocked folio. After finish_wait(), let a waiter woken without a lock handoff try once more to acquire the lock. If successful, return success so the caller's eventual unlock wakes the next waiter. Otherwise, the current lock owner will do so. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: 5ef64cc8987a ("mm: allow a controlled amount of unfairness in the page lock") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik [ david: clarify and simplify comment + description ] Reviewed-by: Rik van Riel Acked-by: Pedro Falcato Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-7-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 842bfdb63ff2f9fcc3edc7ae6a33dfae3747a56e Author: Josef Bacik Date: Sat Oct 31 10:39:35 2026 +0100 mm/filemap: read mapping->a_ops->free_folio under i_lock [ Upstream commit dc24e273244e9d712257d5a6c20a32c7f5ca84e6 ] memory_failure() -> ... -> filemap_remove_folio() can read mapping->a_ops after the inode has been freed. Once the folio is deleted from the pagecache it no longer pins the mapping, so after i_lock is dropped e.g., a concurrent final iput() can evict and free the inode before filemap_free_folio() looks up mapping->a_ops->free_folio. Most callers hold a reference on the inode, but not all. Documentation/filesystems/vfs.rst explicitly states that ->free_folio() must not assume the original address_space mapping still exists. Fix it by loading ->free_folio while i_lock is still held, similar to what folio_unmap_invalidate() does. Inline filemap_free_folio() into its remaining caller such that delete_from_page_cache_batch() also just loads the callback before dropping the i_lock. The bug was found by code inspection and has not been reproduced. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: 59c66c5f8c4f ("mm: factor out page cache page freeing into a separate function") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik [ david: get rid of filemap_free_folio() entirely; improve patch description ] Reviewed-by: Rik van Riel Tested-by: Muhammad Usama Anjum Reviewed-by: Zi Yan Link: https://patch.msgid.link/20261031-fixes_core-v3-6-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit f17044fee422605d19e07c4c9f5dc2be7abd7086 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:34 2026 +0100 mm/truncate: look again if a folio left the mapping [ Upstream commit 9cf632e139737314afa889ca18122bc3fddb9120 ] invalidate_inode_pages2_range() skips a folio which no longer belongs to the mapping by the time it has got the folio lock, on the assumption that somebody else has removed it from the page cache. But the folio may have been replaced, and then there is a new folio with the same data at that index. For most cases, like folio migration, that is impossible. However, collapse_file() only checks the refcount of the old folios, under the i_pages lock, and relies on their folio locks from there on. That works for users which repeat the lookup when they find folio->mapping changed. The following scenario is, however, possible: CPU0 pwrite(O_DIRECT) CPU1 collapse_file() kiocb_invalidate_pages() read the folio (old data), lock it refcount check the write completes copy to new_folio kiocb_invalidate_post_direct_write() find_get_entries() -> old folio xas_store(new_folio) folio->mapping = NULL folio_unlock(folio) folio_lock() folio->mapping != mapping -> continue In that scenario, the collapsed folio with the data from before the write stays in the page cache after the write has returned. This used to be impossible, as khugepaged only collapsed files that nobody had open for writing. Restart the lookup at that index, like shmem_undo_range() does. The same problem seems to exist in truncate_inode_pages_range() as well when truncate_inode_folio() fails, so handle it there as well, but slightly differently: simply check once more through find_get_entries(). Fixes: 1b6444331beb ("mm/khugepaged: enable clean pagecache folio collapse for writable files") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Reviewed-by: Rik van Riel Tested-by: Muhammad Usama Anjum Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: Zi Yan Link: https://patch.msgid.link/20261031-fixes_core-v3-5-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit af0a5ea4dfd255361637f360550d71e5d8b45b14 Author: Josef Bacik Date: Sat Oct 31 10:39:33 2026 +0100 mm/memfd: make f_pos accesses atomic [ Upstream commit 5426cd43a4d28f1041c9ca45955121b921f29548 ] Commit 9c225f2655e3 ("vfs: atomic f_pos accesses as per POSIX") made read(), write() and lseek() on a shared open file description of a regular file serialize on ->f_pos_lock. The flag that asks for it, FMODE_ATOMIC_POS, is set in do_dentry_open(). A memfd is a regular file too, but its struct file comes from alloc_file_pseudo() and never passes through do_dentry_open(), so it does not get the flag: CPU0 CPU1 write(memfd, "a", 1) write(memfd, "b", 1) pos = file->f_pos (= 0) pos = file->f_pos (= 0) vfs_write(..., &pos) vfs_write(..., &pos) file->f_pos = pos (= 1) file->f_pos = pos (= 1) One of the two bytes is overwritten. Two threads writing 100000 bytes each, one at a time, to a memfd end up with a file that is far shorter than 200000 bytes, while the same program on a tmpfs file never loses a byte. Set the flag when the memfd is created. As for any other regular file the lock is only taken if the file is reachable in more than one way, and nothing a memfd does in read or write waits for another operation on the same file. This cannot be done for all alloc_file_pseudo() files: anon inode files such as eventfd are S_IFREG as well, and a blocked read holding ->f_pos_lock would lock out the write that is supposed to wake it. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: 9183df25fe7b ("shm: add memfd_create() syscall") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik [ david: minor description tweaks ] Reviewed-by: Rik van Riel Reviewed-by: Gregory Price (Meta) Tested-by: Gregory Price (Meta) Signed-off-by: Gregory Price (Meta) Reviewed-by: Mike Rapoport (Microsoft) Acked-by: Lorenzo Stoakes (ARM) Reviewed-by: Pedro Falcato Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: Pasha Tatashin Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-4-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit ea5cc241113f7820ce037dbcf8b7eb959fbf1c0d Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:32 2026 +0100 mm/shmem: make shmem_file() check the file's inode [ Upstream commit d3710111839d11339e414b1bb3fea3d05ab83f6e ] shmem_file() only checks if file->f_mapping is a shmem mapping. This mapping can belong to another file, however, as with a Coda file backed by a tmpfs container after mmap(). So it does not guarantee that the file inode is an actual shmem inode. Seal handling and memfd preservation use this check before accessing shmem inode state, so they can access an inode of the wrong type. Let's make shmem_file() check the inode's file operations instead, to identify shmem inodes reliably. This will identify regular shmem inodes, including memfds and ordinary tmpfs files, independently of wrapper file operations. Use shmem_mapping() in collapse_file() instead to not change the behavior of collapse_file(): it operates on the page cache and uses mapping->host for shmem inode operations. Focusing on the file does not seem relevant. Fixes: c49fcfcda8b5 ("mm/shmem: update file sealing comments and file checking") Fixes: b3749f174d68 ("mm: memfd_luo: allow preserving memfd") Cc: stable@vger.kernel.org Reported-by: Chris Mason Suggested-by: Pratyush Yadav Reviewed-by: Pratyush Yadav (Google) Link: https://patch.msgid.link/20261031-fixes_core-v3-3-d6437171ecc3@kernel.org Reviewed-by: Baolin Wang Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 83984e2eab37442e8ea05f745d9039f15b134830 Author: David Hildenbrand (Arm) Date: Sat Oct 31 10:39:31 2026 +0100 fork: take mmap_lock before copying mm_struct [ Upstream commit ef694e2d210111cc08c52fd25da9ab130170bfa3 ] dup_mm() copies the parent's mm_struct before dup_mmap() takes the mmap_lock. A concurrent brk() can leave the child with a stale mm->brk and newer heap mappings, causing later brk() requests to fail. Other operations (e.g., PR_SET_MM) on the parent's mm_struct can similarly cause inconsistencies. As a simple and robust fix, grab the parent's mmap_lock earlier. This way we don't need to update individual mm fields in dup_mmap() and keep missing ones. Stop updating the 4 existing members (total_vm, data_vm, exec_vm, stack_vm), as that is now no longer required. Keep releasing the parent's mmap_lock in dup_mmap(), before userfaultfd completion, to avoid moving the userfaultfd handling into the caller. This should get cleaned up later. Move uprobe_start_dup_mmap() to preserve the lock ordering. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Rik van Riel Reviewed-by: Vlastimil Babka (SUSE) Reviewed-by: Barry Song Reviewed-by: Pedro Falcato Reviewed-by: Harry Yoo (Meta) Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: SJ Park Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-2-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 4e5eb180d37cb222ed3c9b6772c6044e16c2a1c3 Author: Josef Bacik Date: Sat Oct 31 10:39:30 2026 +0100 mm/mglru: don't use stack pointers when walking PUD and PMD tables [ Upstream commit 65a9bf08a3e4d6e58df211ed900c16bafb79b267 ] MGLRU passes stack copies of page-table entries in walk_pud_range() and walk_pmd_range() when walking to the next level. These copies can become stale when khugepaged or MADV_DONTNEED (CONFIG_PT_RECLAIM) removes a PTE table concurrently. This pattern dates back to commit bd74fdaea146 ("mm: multi-gen LRU: support page table walks"). Likely, earlier locking masked the latent bug. Later changes exposed it: commit 1d65b771bc08 ("mm/khugepaged: retract_page_tables() without mmap or vma lock") allowed concurrent retraction, and commit cf4a65539c13 ("memcg-v1: no need for memcg locking for MGLRU") dropped the walker's outer RCU protection. The fix is simple, so just fix the original commit so we don't have to speculate. To fix it, pass the actual PMD/PUD pointers. This restores the RCU-protected lookup and validation against the live PMD. Note that the PUD handling is required as well to handle folded page tables correctly in all cases. Fix generated by an LLM and sent by Josef Bacik in private. [ david: handle walk_pud_range() as well, clarify+simplify description, adjust Fixes: ] Fixes: bd74fdaea146 ("mm: multi-gen LRU: support page table walks") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik Reviewed-by: Rik van Riel Reviewed-by: Qi Zheng Reviewed-by: Dev Jain Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Kairui Song Tested-by: Muhammad Usama Anjum Reviewed-by: Harry Yoo (Meta) Reviewed-by: Barry Song Reviewed-by: Baolin Wang Reviewed-by: Pedro Falcato Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: SJ Park Link: https://patch.msgid.link/20261031-fixes_core-v3-1-d6437171ecc3@kernel.org Reviewed-by: Baoquan He Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 75b0d28ab216bae671fa7c84860c6086137af3f3 Author: David Hildenbrand (Arm) Date: Thu Oct 29 11:43:36 2026 +0100 mm/shmem: fix truncation of files containing only swapin-error markers [ Upstream commit 59511d630a6942356ac4b6984797998a8f3a9017 ] It might not be very common, but we can end up with shmem files that are composed only of swapin-error/poison markers. Such markers are not counted in info->alloced. Consequently, shmem_setattr() can skip shmem_truncate_range(), leaving the markers behind. Truncating the file to zero and growing it again will result in reads failing with -EIO instead of returning zeroes. Check whether the mapping contains entries, in addition to info->alloced, before skipping the truncation. Keep the info->alloced check so that shmem_recalc_inode(), called at the end of shmem_undo_range(), can fix up accounting after reclaim has emptied the mapping. Fixes: 6cec2b95dadf ("mm/shmem: fix infinite loop when swap in shmem error at swapoff time") Cc: stable@vger.kernel.org Tested-by: Gregory Price (Meta) Reviewed-by: Baolin Wang Link: https://patch.msgid.link/20261029-fixes_shmem-v4-15-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit d4bc03eaeef281c460370dfd57e1a671b787edd4 Author: David Hildenbrand (Arm) Date: Thu Oct 29 11:43:35 2026 +0100 mm/shmem: fix accounting of swapin-error markers [ Upstream commit 66ce68a249f4ac56cd6968aa6d8ded20fb4b7d09 ] A failed swap read replaces the swap entry with a swapin-error marker in the page-cache and subtracts its pages from "alloced" and "swapped"; however, it leaves their block charge in place. Removing the marker during truncate then subtracts from "swapped" again. This can underflow the counters or make swapped reach zero while other pages remain swapped out, causing swapoff to loop without finding them. When installing the marker, subtract only from "swapped" and let shmem_recalc_inode() reduce "alloced" and release the block charge. Make shmem_free_swap() report successful removal separately from the number of swap pages freed, so removing a swapin-error marker does not subtract from "swapped" again. It's a bit confusing, but replacing a swapped out page by a swapin-error marker in shmem_set_folio_swapin_error() behaves as follows: Initially: alloced=1, swapped=1, nrpages=0 Calling shmem_recalc_inode(inode, 0, -1) -> swapped = 0 -> freed = 1 - 0 - 0 = 1 -> alloced -= freed -> alloced=0, swapped=0, block charge released Fixes: 6cec2b95dadf ("mm/shmem: fix infinite loop when swap in shmem error at swapoff time") Cc: stable@vger.kernel.org Tested-by: Gregory Price (Meta) Reviewed-by: Baolin Wang Link: https://patch.msgid.link/20261029-fixes_shmem-v4-14-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit e6e9ba49679e5f33f62615fb57ec103045fbc8f9 Author: David Hildenbrand (Arm) Date: Thu Oct 29 11:43:34 2026 +0100 mm/shmem: fix truncate loop after boundary swapin failure [ Upstream commit 5f1ec2cf92a7d655a8eb39711987822f9b1f9d67 ] If swapping in a large entry at the new EOF fails, shmem_undo_range() leaves the entry in place. Its final scan skips the entry, then restarts from the same start index and finds it again. Truncation can loop forever while holding i_rwsem. Advance start past the skipped entry so that a restarted scan can finish, as we already do for folios that cannot be split. Note that this does not fix the missing zeroing when boundary swapin fails, it merely prevents the endless loop. Fixes: 8a1968bd997f ("mm/shmem, swap: fix race of truncate and swap entry split") Cc: stable@vger.kernel.org Acked-by: Kiryl Shutsemau (Meta) Tested-by: Gregory Price (Meta) Reviewed-by: Baolin Wang Reviewed-by: Nhat Pham Link: https://patch.msgid.link/20261029-fixes_shmem-v4-13-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 680afc486db200e7b08307cb28be4f90766afcff Author: David Hildenbrand (Arm) Date: Thu Oct 29 11:43:33 2026 +0100 mm/shmem: preserve allocation errors when swapping in large entries [ Upstream commit f4ce23b1feef16d435aa1188b6c2a637a5373ed5 ] shmem_swapin_folio() adjusts swap to the requested slot within a large swap entry before allocating a folio. If allocation or charging fails, the error path compares this adjusted value with the original entry still stored in the XArray in shmem_confirm_swap(). Unless the index is at the start of the entry, this turns -ENOMEM into -EEXIST even though nothing changed. The caller retries -EEXIST, so persistent allocation failures can leave the task spinning instead of returning the error. Restore swap to index_entry on allocation failure so the existing error path checks the original entry. This preserves the allocation error if the entry is unchanged and still retries if it changed concurrently. Fixes: 91ab656ece13 ("mm/shmem, swap: tidy up swap entry splitting") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Acked-by: Kiryl Shutsemau (Meta) Reviewed-by: Baolin Wang Tested-by: Gregory Price (Meta) Link: https://patch.msgid.link/20261029-fixes_shmem-v4-12-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit ef6daf302dc569a67fe50968f9b6085f111b8560 Author: David Hildenbrand (Arm) Date: Thu Oct 29 11:43:32 2026 +0100 mm/shmem: fix truncate hang in large swap entry [ Upstream commit fa213b08f37f9dff78ce240a87579dc264fc7a5d ] Truncating a tmpfs file or memfd to a page-aligned size inside a large swap entry can loop indefinitely in shmem_undo_range(). The task holds the inode lock and cannot be killed. A large swap entry represents a whole swapped-out folio. For example, truncate a file whose pages 0-7 share one swap entry to four pages: [ 0 1 2 3 | 4 5 6 7 ] keep | discard ^ new EOF, start = 4 i_size has already been updated when boundary handling asks shmem_get_partial_folio() for page 4. Since it is swapped out, the helper calls shmem_get_folio() with SGP_READ. That rejects page 4 with -EINVAL because its starting offset equals i_size. Nothing is read back. The final scan cannot free the entry without losing pages 0-3. It skips it, restarts from start = 4, and finds it again indefinitely. An unaligned truncate avoids this particular failure because the requested page starts below i_size. Folios already in the page-cache cannot trigger it as the direct lookup will return them beyond EOF. Fix it by letting shmem_get_partial_folio() call shmem_swapin_folio() directly for swap entries. This bypasses the read path's i_size check, allowing the existing boundary handling to zero and split the folio. If swap-in returns a smaller folio, it also splits the swap entry so the final scan can free the entries beyond EOF. Retry the lookup if the entry changes during swap-in. Handling swap-in allocation failures remains broken and is unchanged by this commit. Even when shmem_swapin_folio() correctly returns -ENOMEM instead of -EEXIST, shmem_get_partial_folio() returns NULL and shmem_undo_range() skips boundary handling. If the large swap entry remains intact, truncation can still loop in the final scan, while hole punching can return without zeroing the boundary. This may read an entire large folio back from swap while holding i_rwsem, only to discard part of it. Avoiding that I/O would require splitting both the swap entry and any large folio still in the swap cache. That, however, is much bigger work. Fixes: 8a1968bd997f ("mm/shmem, swap: fix race of truncate and swap entry split") Cc: stable@vger.kernel.org Reported-by: Chris Mason Acked-by: Kiryl Shutsemau (Meta) Reviewed-by: Baolin Wang Tested-by: Gregory Price (Meta) Link: https://patch.msgid.link/20261029-fixes_shmem-v4-11-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 1a3d10917191f3987bb8cd78c56c4c37e5db1d4a Author: David Hildenbrand (Arm) Date: Thu Oct 29 11:43:31 2026 +0100 mm/shmem: rescan after nonuniform folio splitting [ Upstream commit f0d67b3d0a464847337d5063766d55e16041323e ] The final scan in shmem_undo_range() restarts after a successful split only if the original folio is no longer large. A nonuniform split can leave that folio large, so the scan skips the newly created folios. Hole punching then leaves pages within the hole allocated even though they could be discarded. For example, a fault below the hole can allocate a 2 MiB folio after boundary handling. Punching a 1 MiB hole at offset 64 KiB splits the folio successfully but leaves the original folio at order 4. The scan continues past all 512 pages, leaving 2 MiB allocated instead of 1 MiB. The hole reads as zero, but the pages and their block charges remain. Fixes: 7460b470a131 ("mm/truncate: use folio_split() in truncate operation") Cc: stable@vger.kernel.org Reviewed-by: Baolin Wang Acked-by: Kiryl Shutsemau (Meta) Tested-by: Gregory Price (Meta) Reviewed-by: Zi Yan Link: https://patch.msgid.link/20261029-fixes_shmem-v4-10-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 0c6689eb3b2044043e7eee7891e16d7cc041784b Author: David Hildenbrand (Arm) Date: Thu Oct 29 11:43:30 2026 +0100 mm/shmem: discard whole new large folios on fallocate rollback [ Upstream commit 23f2a880c0b9518fcb7e7e2ad54a29c0a2c4fba0 ] When undoing a failed fallocate(), shmem_undo_range() must discard each newly allocated folio. Its second scan instead passes large folios to truncate_inode_partial_folio(), which does not necessarily discard the entire large folio, but instead tries splitting it to discard only the requested range. For example, with huge=always, a failed allocation starting at offset 4 KiB can leave page 0 allocated in an otherwise empty file. Discard the whole folio when unfalloc is set. Note that we enter this path only for folios that are not uptodate, and can consequently be dropped without losing any data. Fixes: 55ac8bbe358b ("mm/shmem: fix race in shmem_undo_range w/THP") Cc: stable@vger.kernel.org Reviewed-by: Zi Yan Acked-by: Kiryl Shutsemau (Meta) Reviewed-by: Baolin Wang Tested-by: Gregory Price (Meta) Link: https://patch.msgid.link/20261029-fixes_shmem-v4-9-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 2bf87189d216e2aed488b8dae233ff8d69253d01 Author: Chris Mason Date: Thu Oct 29 11:43:29 2026 +0100 mm/shmem: preserve data in clean folios when splitting fails [ Upstream commit 0c800435394a172f33bf4df4a5a04e187546cc9b ] A shared writable mapping can have dirty PTEs while its shmem folio is still clean. A read fault can install a writable PTE, and a later store sets the PTE's dirty bit without marking the folio dirty. After shmem_undo_range() has handled the boundary folios, a concurrent read fault into a hole below the new EOF can allocate a large folio. For example, on a tmpfs mount with huge=always, the fault's offset must be within the file, but the allocated folio can extend beyond i_size. The final scan then finds this folio and calls truncate_inode_partial_folio() without marking it dirty. Splitting normally collects the PTE dirty bits when unmapping the folio. An extra reference, for example from vmsplice(), can make it fail before that step. The fallback unmapping on split failure excludes shmem, so the helper still sees a clean folio and drops it, losing data outside the range. CPU0: ftruncate(fd, 3M) CPU1: MAP_SHARED, tmpfs huge=always ───────────────────────────────────── ────────────────────────────────── i_size = 3M shmem_undo_range(3M, -1) first pass: hole, nothing to do boundary folio at 3M: hole, none read fault at 2M+x (below EOF) PMD folio [2M,4M), crosses EOF writable PTE, folio clean store to 2M+x PTE dirty, folio still clean vmsplice(2M+x) extra folio reference whole_folios: finds [2M,4M) folio truncate_inode_partial_folio() zero [3M,4M) folio_split() unmap_folio(): extra ref → -EAGAIN, PTE dirty bit never reaches the folio folio clean → truncate_inode_folio(whole) [2M,3M) dropped read 2M+x → refault → zeroes Mark large folios dirty before partial truncation in the final scan, as the boundary handling already does. Exclude failed-fallocate rollback, which must discard the folios it added. Fix generated by an LLM and sent by Chris Mason in private. Fixes: b9a8a4195c7d ("truncate,shmem: Handle truncates that split large folios") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Acked-by: Kiryl Shutsemau (Meta) Reviewed-by: Baolin Wang Reviewed-by: Zi Yan Tested-by: Gregory Price (Meta) [ david: simplify descriptions, adjust comments ] Link: https://patch.msgid.link/20261029-fixes_shmem-v4-8-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit b3239a5a37bba078d83cfb864d47a0cc122f17cd Author: Chris Mason Date: Thu Oct 29 11:43:28 2026 +0100 mm/shmem: stop retrying folios that cannot be split [ Upstream commit a842a1f947da8a7020e72f885ffbf2ce6a93685f ] A fault or collapse can insert a large folio crossing EOF after shmem_undo_range() has handled the boundary folios. If splitting that folio fails, truncate_inode_partial_folio() retains it when it is dirty. The final scan then repeatedly finds it because it restarts from an unchanged start. Truncation keeps the inode lock and ignores fatal signals while looping. A concurrent unlink() can then block other directory operations while holding the directory lock and waiting for the file's lock. Advance start past the retained folio, whose truncated part has already been zeroed. Do not move start backwards if the failed split has shrunk the folio. Fix generated by an LLM and sent by Chris Mason in private. Fixes: 55ac8bbe358b ("mm/shmem: fix race in shmem_undo_range w/THP") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Tested-by: Gregory Price (Meta) [ david: split fixes, simplify descriptions, adjust comments ] Reviewed-by: Zi Yan Reviewed-by: Balbir Singh Link: https://patch.msgid.link/20261029-fixes_shmem-v4-7-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit c22e1baef7f21b8db9a0fb851043d5023f3b8ff9 Author: Josef Bacik Date: Thu Oct 29 11:43:24 2026 +0100 tmpfs: preserve explicitly disabled quota limits [ Upstream commit d5d861ee303da01e59fdf8e8b2f7096c76e7efd5 ] An administrator’s decision to disable a user’s or group’s quota limits can be silently lost when tmpfs restores the mount defaults after releasing and reacquiring the quota record. This can cause later file creation or writes to fail with EDQUOT, even though the administrator has explicitly disabled quota limits for the user or group. do_set_dqblk() sets DQ_FAKE_B when all block and inode limits are zero. This means quota enforcement is disabled for that user or group. shmem_is_empty_dquot() treats the flag as a reason to discard the entry from the mount's quota tree. The next shmem_acquire_dquot() finds no saved entry and recreates it with the mount's default hard limits. If the cached dquot is reused, DQ_FAKE_B remains set: Q_GETQUOTA reports the restored defaults, but enforcement is still disabled. Once that dquot has been reclaimed, a new dquot enforces the restored defaults. Remove the DQ_FAKE_B test. Only discard entries with zero usage, zero soft limits and hard limits equal to the mount defaults. Explicitly disabled limits are then preserved whenever the mount defaults are nonzero. Explicitly disabled limits now retain a quota-tree entry, just like other limits that differ from the mount defaults. Rename shmem_is_empty_dquot() to shmem_is_default_dquot() to describe the check for default values. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: de4c0e7ca8b5 ("shmem: Add default quota limit mount options") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik Reviewed-by: Jan Kara Tested-by: Gregory Price (Meta) [ david: code cleanups; rewrite description ] Link: https://patch.msgid.link/20261029-fixes_shmem-v4-3-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 3aa51c92711896c86da9fcef01b1155e8caa7e74 Author: Josef Bacik Date: Thu Oct 29 11:43:23 2026 +0100 tmpfs: keep the quota soft limits of an unused id [ Upstream commit 968d73463059156e1b89bfa6b189acd7d27197b2 ] When the last reference to a dquot goes away, shmem_release_dquot() stores its limits in the rb tree of the mount, unless shmem_is_empty_dquot() says that there is nothing worth storing. That function looks at the usage and at the two hard limits only. So if the administrator sets nothing but soft limits for an id that owns no file yet, the entry is thrown away as soon as the dquot that Q_SETQUOTA used is released, and the id never gets to see a limit. To fix it, compare the soft limits as well: an entry can be empty only if both soft limits are zero as well, which is exactly what shmem_acquire_dquot() sets for a new entry. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: de4c0e7ca8b5 ("shmem: Add default quota limit mount options") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik Reviewed-by: Jan Kara Tested-by: Gregory Price (Meta) [ david: slightly adjusted description ] Link: https://patch.msgid.link/20261029-fixes_shmem-v4-2-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 0109fa404651e20493ca35a9a7d4f87861148064 Author: Chris Mason Date: Thu Oct 29 11:43:22 2026 +0100 mm/mempolicy: charge shared policy nodes [ Upstream commit 68b2aa37afa390f08de13bc0bac61a9ded3318bc ] Any local user can bypass memory.max with mbind() on a tmpfs file, and allocate unbounded kernel memory. mbind() sets a NUMA memory policy for a range of a mapping. If the mapping is of a shmem and friends, the kernel also stores the policy on the inode, in a tree with one entry per range of the file. Each mbind() on a single page of a mapping can add one shared policy node (struct sp_node) and one struct mempolicy to that tree. They outlive the mapping and stay around until the inode is destroyed. The tree is not bounded by the file size, so the file can be empty. Memory that user space can allocate must be charged to a memory cgroup. A slab cache does that for all of its objects if it is created with SLAB_ACCOUNT. numa_policy_init() creates the slab caches for both structs without SLAB_ACCOUNT, so they are not charged to any cgroup. Reproduced with mbind() on single pages of an empty tmpfs file, from a cgroup with memory.max=8M: the global OOM killer killed tasks owned by root, and the machine panicked. Fix this by creating both caches with SLAB_ACCOUNT. This change implies that mbind() can now fail when running into memcg limits. Further, the policy_cache also serves task and VMA policies, so they are similarly accounted now. Note that per-file limits are not really helpful, as the user could simply use many files; having limits per user is tricky as well. Fix generated by an LLM and submitted by Chris Mason in private. Fixes: 5d097056c9a0 ("kmemcg: account certain kmem allocations to memcg") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Acked-by: Pedro Falcato Acked-by: Kiryl Shutsemau (Meta) Acked-by: Zi Yan Reviewed-by: Baolin Wang Tested-by: Gregory Price (Meta) [ david: smaller description tweaks ] Reviewed-by: Balbir Singh Link: https://patch.msgid.link/20261029-fixes_shmem-v4-1-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin commit 347cccd34fc91cc92cf3d3b3143136d0aa20574d Author: Ian Bridges Date: Mon Nov 2 00:15:36 2026 -0600 ksmbd: let the owner read and change the DACL when no ACE names it [ Upstream commit ffc855fe16afe02b22305111aa68cd8d07360941 ] smb_check_perm_dacl() refuses the owner when neither its DACL lookup nor the POSIX ACL fallback matches. The owner then cannot read or replace the DACL over SMB. MS-DTYP 2.5.3.2 grants the owner READ_CONTROL and WRITE_DAC unless an OWNER RIGHTS ACE applies. An empty DACL allows the owner's explicit requests for these rights but refuses MAXIMUM_ALLOWED. smb2_open() uses that check for the maximal access reply (MS-SMB2 3.3.5.9.5), so even a READ_CONTROL open fails when it asks for that reply. Grant the owner's implicit rights on both paths, for explicit requests and MAXIMUM_ALLOWED, unless an OWNER RIGHTS ACE applies. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Signed-off-by: Ian Bridges Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin commit 92b4dc36ccab59999857a4181284859e5e3fb67b Author: Ian Bridges Date: Sun Nov 1 23:14:28 2026 -0600 ksmbd: grant a POSIX ACL group entry only to the group's members [ Upstream commit c00ec7ad449b68c291a4986e481941302ed399c5 ] When no ACE of the DACL matches the caller, Everyone or Authenticated Users, smb_check_perm_dacl() falls back to the file's POSIX ACL. It takes the first ACL_USER or ACL_GROUP entry whose id equals the caller's uid. For ACL_GROUP, this compares a gid with the caller's uid. A numerical match grants the group's permissions even when the caller is not a member. Match a group entry only when the caller is also in the group. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Reported-by: Namjae Jeon Closes: https://lore.kernel.org/linux-cifs/CAKYAXd93czbFD=znZUq_pJLXzDR5N3zc_auvAGWT7pzKR1f9Ag@mail.gmail.com/ Cc: stable@vger.kernel.org Signed-off-by: Ian Bridges Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin commit 8f3be5f54a9447ec10346e28835e7368e40b5e9d Author: Ian Bridges Date: Sun Nov 1 23:09:15 2026 -0600 ksmbd: do not read past the DACL in the access denied debug message [ Upstream commit 8296a64df5448548f410fb246c1d88a93609602b ] When smb_check_perm_dacl() falls back to the POSIX ACL and then denies the request, its debug message prints the access mask of the ACE that the second DACL walk stopped at. On that path the walk ran to the end of the DACL, so the pointer is one past the last ACE. If the DACL is the last part of the stored security descriptor, the message reads 4 bytes past the buffer, and KASAN reports a slab-out-of-bounds read in smb_check_perm_dacl(). Print the requested and allowed masks instead. They are what the check compares. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Signed-off-by: Ian Bridges Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin commit 18ca06b36c4da8b46859dcd1c9aec557d05bc23a Author: Federico Musto Date: Tue Oct 27 12:51:51 2026 +0100 net: atl1c: drop oversized RX frames instead of panicking [ Upstream commit c4ba1716853de5178a9df785844ebb5e397a80e6 ] atl1c sizes its receive buffers from the netdev MTU plus a fixed set of L2 overheads, which comes to 1522 bytes at the default MTU. A link partner that sends a longer frame - in practice a MikroTik CCR2004-1G-2XS-PCIe, whose RouterOS side defaults to l2mtu 1600 while the host stays at MTU 1500 - makes the length reported by the RX return descriptor exceed what the hardware wrote, and skb_put() then either includes bytes that were never received or trips skb_over_panic and takes the host down. Compare the descriptor length against buffer_info->length, the length the hardware was given, rather than against skb_tailroom(): the skb carries 64 bytes of slack for the DMA erratum, so tailroom is larger than the DMA buffer and a frame in between would pass the check and still be delivered with a tail the device never wrote. The same test rejects frames shorter than ETH_HLEN + ETH_FCS_LEN; before this change a reported length below ETH_FCS_LEN underflowed in skb_put(). The frame is dropped with kfree_skb_reason(SKB_DROP_REASON_PKT_TOO_BIG) so drop_monitor and the kfree_skb tracepoint see it, and counted through dev_core_stats_rx_dropped_inc(), which survives atl1c_get_stats() overwriting the hardware counters on every read. It also counts as work: atl1c_clean_rfd() has already recycled the RFD, and the refill at the end of the poll only runs when work_done is non-zero, so sustained oversized traffic would otherwise drain the ring and stop RX. Tested on a MikroTik CCR2004-1G-2XS-PCIe (4x AR8151) in a Proxmox VE host, with atl1c built from a DKMS tree carrying this change: the l2mtu-1600 traffic that panics the stock driver is dropped and counted with the patch applied, and received normally once the host MTU is raised to match. This complements commit 36c2009d90f2 ("net: atl1c: fix soft lockup on out-of-range tpd_cons read"), which fixed the TX side of the same "host dies while the card resets" problem. Fixes: 43250ddd75a3 ("atl1c: Atheros L1C Gigabit Ethernet driver") Cc: stable@vger.kernel.org Signed-off-by: Federico Musto Signed-off-by: Dave Miller Signed-off-by: Sasha Levin commit df3857c44d56da90527e2ed1bae0f222eebe8e19 Author: Mitul Golani Date: Mon Oct 12 09:34:02 2026 +0530 drm/i915/display: Allow port sync on PTL [ Upstream commit 285300ef89aacbe902ba29c91625975f51345217 ] Some dual-SST tiled displays exhibit visual corruption on PTL, with one tile's image vertically shifted or wrapped by a random amount that changes on every hotplug. PTL supports port sync, so allow it to be used to avoid these display issues. Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/8991 Fixes: 05cffc074938 ("drm/i915/display: Implement Wa_16024710867") Cc: stable@vger.kernel.org Signed-off-by: Mitul Golani Reviewed-by: Suraj Kandpal Link: https://patch.msgid.link/20261012040402.3332398-1-mitulkumar.ajitkumar.golani@intel.com Signed-off-by: Jani Nikula (cherry picked from commit 7b308d9d496dd3bbe2fdd09d4e9d32499f2a1a0b) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit b0cb4eeeaae098f967a194f9a79dd4004e4dedb4 Author: Vidya Srinivas Date: Wed Oct 28 12:34:04 2026 +0530 drm/i915/display: Disable pipe joiner on WCL [ Upstream commit b42b656db1384255044754cd2163d370d766b776 ] Pipe joining is not supported in the WCL display configuration. Report no joiner support on WCL so that modes which would require joining are rejected, matching the 4k 60Hz maximum resolution documented for the platform. v2: Rebase onto latest upstream v3: Fix up the commit message v4: Split the scaler and joiner changes into separate patches (Jani) Bspec: 74286 Fixes: f8e1c3e07db1 ("drm/i915/xe3lpd: Add support for display version 30.02") Cc: stable@vger.kernel.org Suggested-by: Charlton Lin Reviewed-by: Uma Shankar Signed-off-by: Vidya Srinivas Signed-off-by: Uma Shankar Link: https://patch.msgid.link/20261028070404.1913843-3-vidya.srinivas@intel.com (cherry picked from commit 917676a55a690319a01b45d3956eaf94ba564df8) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit d888af52674b0445d1359ad9e28a2c3f46cb8e7d Author: Vidya Srinivas Date: Wed Oct 28 12:34:03 2026 +0530 drm/i915/display: Single scaler per pipe on WCL [ Upstream commit 25ea7671bdbc85820026776cbe22df41c560d518 ] WCL has only one scaler per pipe. Set num_scalers to 1 for WCL. v2: Rebase onto latest upstream v3: Fix up the commit message v4: Split the scaler and joiner changes into separate patches (Jani) Bspec: 74286 Fixes: f8e1c3e07db1 ("drm/i915/xe3lpd: Add support for display version 30.02") Cc: stable@vger.kernel.org Suggested-by: Charlton Lin Reviewed-by: Uma Shankar Signed-off-by: Vidya Srinivas Signed-off-by: Uma Shankar Link: https://patch.msgid.link/20261028070404.1913843-2-vidya.srinivas@intel.com (cherry picked from commit 8ff2ba499b20edf6c4aad89527a1e9a70c2b2074) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit b54bf6cede04b8b8a8c9c078d103e322f2105df1 Author: Lu Yao Date: Tue Oct 27 15:28:32 2026 +0800 drm/i915/gem: Reset err for each fence entry [ Upstream commit 31643dc89818d9b65bf42ecb1c67c99b64146fba ] If dma_fence_chain_find_seqno() failed once, 'err' will store val in the following loop. May causing returns '-EINVAL' even though that entry never called dma_fence_chain_find_seqno() at all. Fixes: 13149e8bafc4 ("drm/i915: add syncobj timeline support") Signed-off-by: Lu Yao Cc: # v5.10+ Reviewed-by: Andi Shyti Signed-off-by: Andi Shyti Link: https://patch.msgid.link/20261027072832.726435-1-yaolu@kylinos.cn (cherry picked from commit 4e9db08db75f55c920986ac929cfd82a4ee99f41) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit b32969afd985dcdc6115ec48da93d070757be9db Author: Werner Sembach Date: Fri Aug 7 22:04:30 2026 +0200 drm/i915/display: Add quirk to force backlight type on some TUXEDO devices [ Upstream commit 88d804cd1be9a8ffcaf67f1a414ee92b5166a0a8 ] The display backlight on TUXEDO DX1708 and InsanityBook 15 v1 have a broken VBT in the AUO 12701 and AUO 12701 panels, but not others. They are advertising INTEL_BACKLIGHT_DISPLAY_DDI, but are actually failing to use the Intel interface. Adding a fallback to the VESA interface gives these devices a working backlight for both the broken and non broken panel VBTs. Forcing the fallback can already be achieved via a module parameter, but this patch adds a quirk to apply this by default on the mentioned devices. This commit does not actually test for the exact panels as the ID that is used in the intel_dpcd_quirks list is sadly zeroed on the devices, but afaik all these devices use try_intel_interface first anyway so all the quirk does is to add the fallback to try_vesa_interface, so the behaviour on the devices not needing the quirk and fallback should functionally stay the same. Fixes: 2914709c9141 ("Revert "drm/i915/backlight: Remove try_vesa_interface"") Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/15679 Cc: stable@vger.kernel.org Signed-off-by: Werner Sembach Reviewed-by: Suraj Kandpal Signed-off-by: Suraj Kandpal Link: https://patch.msgid.link/20260807200709.464343-2-wse@tuxedocomputers.com (cherry picked from commit 9499c3fca1c70ccfaddc9815b4c5afdfddedbd04) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit f22255363ca1f56d87cc6d795e295c8d68b69f6f Author: Jouni Högander Date: Tue Sep 29 12:44:34 2026 +0300 drm/i915/psr: Don't clip plane state destination rectangle [ Upstream commit e30830d21860fbf030ad162c3db4d1219477dfb5 ] clip_area_update() uses drm_rect_intersect which modifies passed r1 rectangle. Early transport alignment passes the cursor uapi.dst rectangle to clip_area_update, so the cursor uapi.dst is unintentionally modified by drm_rect_intersect. Fix this by using local copy in clip_area_update(). Also make the damage and the display area const. Fixes: 1bff93b8bc27 ("drm/i915/psr: Extend SU area to cover cursor fully if needed") Cc: # v6.9+ Assisted-by: GitHub-Copilot:claude-opus-5 Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola Link: https://patch.msgid.link/20260929094434.77129-9-jouni.hogander@intel.com (cherry picked from commit 8621f3bcea6b0a790a954ddf2e6514c20a24ac1a) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit e4d3937ce878c081097c9e80924efe126532540c Author: Jouni Högander Date: Tue Sep 29 12:44:30 2026 +0300 drm/i915/psr: Fix SFF and CFF CTL register bit definitions [ Upstream commit 15b3187740291c4705b995bbf984da462e9f1e35 ] Single full frame bit in SFF_CTL and continuous full frame bit in CFF_CTL are bit 0. Fix the definitions accordingly. Fixes: 3b5bf853e309 ("drm/i915/psr: Add register definitions for SFF_CTL and CFF_CTL registers") Cc: # v6.15+ Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola Link: https://patch.msgid.link/20260929094434.77129-5-jouni.hogander@intel.com (cherry picked from commit 95ca8fab5232dfb7459989d54f09501704a8d7ad) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit 88cfc8df4e955298798afed317fe6747a614f998 Author: Jouni Högander Date: Tue Sep 29 12:44:29 2026 +0300 drm/i915/psr: Disable linked plane sel fetch as well [ Upstream commit b56721c32eb3ad0f086fdc0f33479be395e43bb9 ] Currently we are not setting linked plane selective area when selective fetch is about to be disabled for the UV plane. Fix this by simplifying the loop by just handling plane selective fetch disable and area setting same way. Also set the update_planes bit based on comparing old and new plane selective fetch area. This way both the plane and its linked Y plane are updated only when their selective fetch area changed. Fixes: a4f477e6ac17 ("drm/i915/psr: Add proper handling for disabling sel fetch for planes") Cc: # v6.8+ Assisted-by: GitHub-Copilot:claude-opus-5 Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola Link: https://patch.msgid.link/20260929094434.77129-4-jouni.hogander@intel.com (cherry picked from commit b10c83af60cbc00ce4112742fd297581233e43cd) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit c76322c4a60da18daa18763fb16dbf4048b73855 Author: Jouni Högander Date: Tue Sep 29 12:44:28 2026 +0300 drm/i915/display: Add enabled pipe planes into state for selective fetch [ Upstream commit 94cb1f08b197d9ae932ff98c741bd0dbc96e17e8 ] Selective fetch support for biplanar formats relies on linking of UV and the Y planes. Planes that are not part of the atomic state are pulled in by the drm_atomic_add_affected_planes. If the UV plane is added into the state by drm_atomic_add_affected_planes in the selective fetch calculation, the linking isn't done anymore and the Y plane is left disabled. Fix this by adding affected planes already in intel_add_affected_planes if selective fetch is enabled. Remove redundant drm_atomic_add_affected_planes from intel_psr2_sel_fetch_update and redundant check for plane selective fetch support that is not needed as all planes are already in atomic state on first loop iterating them. Also switch to intel_atomic_get_new_plane_state for linked plane new plane state. Fixes: 3809991ff5f4 ("drm/i915/display: Add initial selective fetch support for biplanar formats") Cc: # v5.17+ Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola Link: https://patch.msgid.link/20260929094434.77129-3-jouni.hogander@intel.com (cherry picked from commit 0d173898b11157d37de3e5f01ef28a48582167d8) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit 10b07a2d47ac64e349d04cc700c0aa060a8bd673 Author: Jouni Högander Date: Tue Sep 29 12:44:27 2026 +0300 drm/i915/psr: Clear selective fetch area when duplicating plane state [ Upstream commit cbe565475988d3b22dc36f13c14d9f0eec1685cd ] We are currently not clearing selective fetch area when duplicating plane state. This is causing problem when plane is re-used for another purpose. Fix this by clearing selective fetch area when duplicating plane state. Now as the state is cleared we need to ensure we have consistent selective fetch area in plane state on full update. Earlier this was relying on selective fetch area being copied from old state on state duplicate. Now this isn't true anymore as we are clearing it. Tackle this by setting full plane area as selective fetch area for each plane on full update. Rename the label as skip_su_area_calc as the loop setting the plane selective fetch area is not skipped anymore. Move also psr2_sel_fetch_pipe_state_supported check after psr2_su_area initialization. The loop is run on full update as well now and it needs initialized psr2_su_area. Clip_area_update is only touching rect height and x1/x2 are left untouched. Don't set the area at all for planes not intersecting with the selective update area. It is already zero sized after plane state duplicate. Fixes: efab47658a6c ("drm/i915/display/psr: Calculate selective fetch plane registers") Cc: # v5.12+ Assisted-by: GitHub-Copilot:claude-opus-5 Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola Link: https://patch.msgid.link/20260929094434.77129-2-jouni.hogander@intel.com (cherry picked from commit bd58f0e221386808cd614bb205112e807dc6b159) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin commit 4d4c1e32e564b850a4315860d900788b05b5e6fc Author: Rosen Penev Date: Mon Oct 19 20:32:38 2026 -0400 x86/csum: Relax the len and proto constraints in 32-bit csum_ipv6_magic() [ Upstream commit f01a394fe2a00d3cb4cf2cda279c58604a2540ad ] Building an i386 allmodconfig kernel with clang fails since allmodconfig started building netfilter with GCOV profiling: In file included from net/netfilter/nf_synproxy_core.c:7: In file included from ./include/linux/skbuff.h:26: In file included from ./include/net/checksum.h:21: In file included from ./arch/x86/include/asm/checksum.h:9: ./arch/x86/include/asm/checksum_32.h:149:6: error: inline assembly requires more registers than available The csum_ipv6_magic() asm needs five registers at once: the early-clobber sum plus register-only inputs for saddr, daddr, htonl(len) and htonl(proto). With frame pointers enabled, six general purpose registers are left to choose from. In synproxy_send_tcp_ipv6(), the GCOV instrumentation lets clang's machine scheduler move the copies of two incoming register arguments, EDX and ECX, below the asm. Both registers then stay live across the asm, which leaves four registers for its five operands. This is LLVM issue #206307. The error goes away without either GCOV or frame pointers, and it reproduces with clang 19-22. Neither len nor proto has to be in a register: ADCL also takes a 32-bit memory or immediate source operand. Use "g" for both, so the asm needs at most three registers whatever the caller looks like. ASM_INPUT_G, which normally replaces "g" to avoid clang's poor handling of it, is not enough here. It expands to "ir" for clang, so callers that pass a variable protocol, like nf_ip6_checksum(), would still need five registers. With "g", clang passes a non-constant len or proto through the stack and still turns constants into immediates. [ bp: Make Rosen Penev the author because of a previous identical submission https://lore.kernel.org/all/20260904000833.2058186-1-rosenp@gmail.com/ and Sasha graciously agreeing and giving his much more detailed commit message explaining the background of why this exists. ] Fixes: 403cec8ab6d0 ("netfilter: add option for GCOV profiling") Closes: https://dashboard.kernelci.org/build/maestro:6ad55fe255fda507603d2651 Closes: https://lore.kernel.org/a28df759-d0e9-41c0-97c7-5f89a18d54e2@oss.qualcomm.com Reported-by: kernelci.org bot Reported-by: Jeff Johnson Assisted-by: LLM Signed-off-by: Rosen Penev Signed-off-by: Sasha Levin Signed-off-by: Borislav Petkov (AMD) Acked-by: Nick Desaulniers Cc: stable@vger.kernel.org Link: https://github.com/llvm/llvm-project/issues/206307 Signed-off-by: Sasha Levin commit 5bc572befb2990cb2ad83ca447f64e6654a9889f Author: Breno Leitao Date: Thu Oct 29 07:45:03 2026 -0700 x86/bugs: Select the BHI mitigation based on the attack vector properly [ Upstream commit 3457b3bcd344005af894876cab4e634cabdcbb62 ] The BHI mitigation selection is inconsistent with the documentation (attack_vector_controls.rst), which lists BHI under both the user->kernel and guest->host attack vectors. bhi_select_mitigation() only enables it when CPU_MITIGATE_GUEST_HOST is set; otherwise it selects BHI_MITIGATION_OFF, even if CPU_MITIGATE_USER_KERNEL is set. As a result, a kernel compiled with KVM disabled gets BHI automatically disabled, since CPU_MITIGATE_GUEST_HOST defaults to off without KVM. This is a bug, given that CPU_MITIGATE_USER_KERNEL still needs it: on affected Intel CPUs these kernels lose BHI_DIS_S or the BHB clearing loop by default. Booting with mitigations=auto,no_guest_host has the same effect. Select BHI_MITIGATION_ON whenever user->kernel is mitigated, and keep BHI_MITIGATION_VMEXIT_ONLY for the guest->host-only case. [ bp: Clarify commit title. ] Fixes: ddcd4d3cb37c ("x86/bugs: Add attack vector controls for BHI") Signed-off-by: Breno Leitao Signed-off-by: Borislav Petkov (AMD) Acked-by: David Kaplan Cc: Link: https://patch.msgid.link/20261029-bhi-attack-vector-v1-1-29cfa697efb6@debian.org Signed-off-by: Sasha Levin commit be6fda13447b6aaceb03a06eb5b59d132b1b2b26 Author: Lee Jones Date: Fri Oct 30 10:46:44 2026 +0000 ASoC: SOF: Intel: hda-sdw-bpt: Stop active DMA before closing BPT streams [ Upstream commit 348bc756d912dd8f47fd36c167075717951a515e ] When sdw_enable_stream() fails in intel_ace2x_bpt_send_async() after hda_sdw_bpt_send_async() has already started the TX and RX DMA streams, intel_ace2x_bpt_close_stream() invokes hda_sdw_bpt_close() directly without calling hda_sdw_bpt_wait(). As a result, hda_sdw_bpt_dma_deprepare() tears down the DMA buffers and BDL while the DMA hardware is still running. Disable any running TX or RX BPT DMA stream at the start of hda_sdw_bpt_close() before unmapping channels and depreparing DMA resources. Fixes: 4c1ce9f37d8a ("soundwire: intel_ace2x: add BPT send_async/wait callbacks") Closes: https://sashiko.dev/#/bug/linux-ff0012de-abdd-4796-875e-b1fbbf47235f Cc: stable@vger.kernel.org Signed-off-by: Lee Jones Acked-by: Peter Ujfalusi Link: https://patch.msgid.link/20261030104840.3361217-6-lee@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin commit feac2c64cf85ad9b888333308763676c52a8fadc Author: Miguel Ojeda Date: Sun Oct 18 18:37:19 2026 +0200 rust: cpufreq: fix `undocumented_unsafe_blocks` in `PolicyCpu::from_cpu()` [ Upstream commit 62a40c72905be262e9e10790008d505ed0be6c0f ] For Rust <= 1.86, Clippy triggers after commit 02c5d7bfa872 ("rust: cpufreq: reject NULL from cpufreq_cpu_get()"): warning: unsafe block missing a safety comment --> rust/kernel/cpufreq.rs:700:26 | 700 | NonNull::new(unsafe { bindings::cpufreq_cpu_get(u32::from(cpu)) }).ok_or(ENODEV)?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding a safety comment on the preceding line = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks = note: requested on the command line with `-W clippy::undocumented-unsafe-blocks` Thus clean it up. Cc: stable@vger.kernel.org Fixes: 02c5d7bfa872 ("rust: cpufreq: reject NULL from cpufreq_cpu_get()") Assisted-by: LLM Reviewed-by: Zhongqiu Han Acked-by: Viresh Kumar Link: https://patch.msgid.link/20261018163719.81691-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda Signed-off-by: Sasha Levin commit 33782daeb2ef6f620b08d41f1a15785676370c78 Author: Jack Blessed Kimani Date: Sun Nov 1 11:21:03 2026 +0900 ksmbd: fix NULL pointer dereference in session_user_name() and session_account_type() [ Upstream commit d13da43938d15b0b719827d8f2b32df8eaec5def ] session_user_name() and session_account_type() dereference session->user without checking for NULL. A session can be published and exposed via the procfs session interface before authentication completes, during which session->user is NULL: show_proc_session() -> session_user_name(sess) -> user_guest(session->user) -> NULL->flags -> oops Guard both functions by treating a NULL session->user as an explicit not-yet-authenticated state rather than dereferencing it. Fixes: 1f7dd03a88a8 ("ksmbd: fix malformed procfs status output") Cc: stable@vger.kernel.org Signed-off-by: Jack Blessed Kimani Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin commit bd7142a1d60c8aeb203e007515e077bcded88769 Author: Ian Bridges Date: Wed Oct 28 20:28:03 2026 -0500 ksmbd: revert fsids on durable reconnect and replay failure [ Upstream commit 539223f18026448f67d33d09719c355b91db7fd0 ] On a durable handle reconnect or a request replay, smb2_open() switches to the SMB user's fsids before calling ksmbd_vfs_getattr(). If that call fails, the code jumps to err_out2 and skips ksmbd_revert_fsids() at err_out1. The user's credentials then stay installed on the shared ksmbd worker. Later work on that worker, including other users' requests, runs with the first user's fsuid, fsgid and supplementary groups. ksmbd_free_work_struct() also warns, because work->saved_cred is still set. Jump to err_out1 instead. No path is held at this point, so skipping the path_put() at err_out is correct. Fixes: c8efcc786146 ("ksmbd: add support for durable handles v1/v2") Fixes: bb8bf7eb13b5 ("ksmbd: add SMB3 request replay support") Cc: stable@vger.kernel.org Signed-off-by: Ian Bridges Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin commit ece35b45ec17a462cc5947ad4fbc3450657aa55b Author: Ian Bridges Date: Wed Oct 28 20:25:32 2026 -0500 ksmbd: enforce the read-only share flag when creating a stream [ Upstream commit 09139429fab3a5114c18d7c15fb161511d4d66c9 ] When a share is read-only, smb2_open() rejects opens that would create or truncate a file. Creating a named stream on an existing file with streams_xattr sets neither O_CREAT nor O_TRUNC, so it passes this check, and smb2_set_stream_name_xattr() then creates the stream. On a Time Machine share, opening a missing AFP_AfpInfo stream also writes one. A user who can write a file at the filesystem level can therefore add streams to it through a read-only share. Do not create a stream or synthesize AFP_AfpInfo when the share is not writable. Existing streams still open normally, and a missing stream opened with FILE_OPEN still returns STATUS_OBJECT_NAME_NOT_FOUND. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Fixes: eaff8e924f60 ("ksmbd: synthesize empty AFP_AfpInfo xattr on first probe") Cc: stable@vger.kernel.org Signed-off-by: Ian Bridges Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin commit 7e9a78223752911e118710009aab9dd9e10b2ee7 Author: Ian Bridges Date: Wed Oct 28 10:24:13 2026 -0500 ksmbd: require DELETE access for delete-on-close opens [ Upstream commit 1dd91081ba3c692565f9c1f884149178d5a06d1e ] smb2_open() accepts FILE_DELETE_ON_CLOSE on an existing file without DELETE in DesiredAccess. When the request asks only for FILE_READ_ATTRIBUTES or READ_CONTROL, it also skips inode_permission() and the parent directory MAY_WRITE | MAY_EXEC check that delete-on-close is meant to get. The file is then marked for deletion by a caller who could not delete it. The unlink happens later, in __ksmbd_inode_close(), when the last handle on the inode is closed, and it runs with the credentials of that handle. If the caller closes last, the unlink fails. If another user who can write the parent directory, such as the file's owner, still has the file open, the file is deleted when that user closes it. Until then new opens of the file fail with STATUS_DELETE_PENDING. So a user with only search permission on a directory can delete a file in it, or block opens of it, while the owner has it open. A MAXIMUM_ALLOWED open that also requests DELETE has the same problem. The requested access is replaced with the maximal access, which does not include DELETE when the caller cannot write the parent directory, and the later permission checks are skipped as already done. MS-FSA 2.1.5.1 requires an open with FILE_DELETE_ON_CLOSE and without DELETE in DesiredAccess to fail with STATUS_INVALID_PARAMETER, and Samba does the same. Add that check to the CreateOptions validation, using the generic-mapped DesiredAccess so that GENERIC_ALL still qualifies. This also refuses MAXIMUM_ALLOWED with FILE_DELETE_ON_CLOSE but no explicit DELETE, as MS-FSA and Samba do. When MAXIMUM_ALLOWED is requested with DELETE but the maximal access does not include DELETE, fail with STATUS_ACCESS_DENIED. With DELETE requested, delete-on-close opens go through the existing parent directory check. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Signed-off-by: Ian Bridges Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin commit 890fd9c4e02bc9e477e6365fef4ac8c2262a3b3c Author: Jamal Hadi Salim Date: Sat Oct 31 15:38:52 2026 -0400 bpf: Fix skb_pull() BUG in __bpf_redirect_neigh() [ Upstream commit 23503acb214cbefaf3945d05ab9667ff11ae3de9 ] The issue: This is a follow-up to the short link-layer header fixes from Eric. After vlan pop_eth, a privileged SCHED_ACT BPF program can call bpf_skb_change_head(skb, 1, 0) and then bpf_redirect_neigh(). __bpf_redirect_neigh() calls skb_pull(skb, sizeof(*ethh)) after checking only that mac_header < network_header. Nothing verifies that the MAC header is long enough, that it is linear, or that the IP header the redirect goes on to read is linear either. A SCHED_ACT BPF program can do: bpf_skb_change_head(skb, 1, 0); bpf_redirect_neigh(lo, NULL, 0, 0); after vlan pop_eth. The skb then has mac_len == 1 and only one byte of linear data; skb_pull(ETH_HLEN) trips the skb->len < skb->data_len BUG in __skb_pull(): kernel BUG at ./include/linux/skbuff.h:2839! RIP: skb_pull+0x40/0x50 Call Trace: skb_do_redirect -> packet_xmit -> packet_sendmsg Kernel panic - not syncing: Fatal exception in interrupt The v4 and v6 paths read ip_hdr() and ipv6_hdr() as soon as the MAC header is gone. On the AF_PACKET frame below that leaves headlen == 0 after the pull, so the network header sits at skb->tail and the route lookup reads ip4h->protocol, ip4h->saddr and ip4h->daddr past the linear area. The Fix: Use skb_network_offset(), which is the MAC header span, instead of skb->mac_len. mac_len is zero for locally generated tc egress and netkit packets, while the span still rejects the one-byte header produced by pop_eth + bpf_skb_change_head(skb, 1, 0). The single check also covers the mac_header >= network_header test it replaces. Use pskb_may_pull() to make the Ethernet header linear before it is read or pulled, and to make the IP header linear in both the v4 and the v6 path before ip_hdr()/ipv6_hdr() is read. The header pointers are taken after the pull, since pskb_may_pull() may reallocate skb->head. Conditions to recreate the bug: On x86-64 with 4 KiB pages, enable CONFIG_PACKET, CONFIG_BPF_SYSCALL, CONFIG_NET_SCH_INGRESS, CONFIG_NET_CLS_MATCHALL, CONFIG_NET_ACT_VLAN and CONFIG_NET_ACT_BPF. Run as root with BPF loading, network administration and raw-packet privileges. Bring lo up and attach a SCHED_ACT program that calls bpf_skb_change_head(skb, 1, 0), then returns bpf_redirect_neigh(skb->ifindex, NULL, 0, 0): ip link set lo up tc qdisc add dev lo clsact tc filter add dev lo egress matchall action vlan pop_eth pipe \ action bpf object-file neigh_chghead.o section action Send an untagged ETH_P_IP frame of ETH_HLEN + 8192 bytes through an AF_PACKET/SOCK_RAW socket bound to lo, without PACKET_VNET_HDR or PACKET_QDISC_BYPASS. Use a unicast destination MAC. The sender's skb has a 14-byte linear Ethernet prefix and a fragmented payload; pop_eth removes that prefix and change_head restores only one linear byte. The unfixed neighbor redirect then tries to pull 14 bytes and BUGs. Sending the same frame without pop_eth and change_head leaves the IP header in the frags, which is the route lookup reading past skb->tail. Fixes: b4ab31414970 ("bpf: Add redirect_neigh helper as redirect drop-in") Signed-off-by: Jamal Hadi Salim Signed-off-by: Alexei Starovoitov Reviewed-by: Victor Nogueira Cc: stable@vger.kernel.org Link: https://lore.kernel.org/netdev/20261027082604.1485903-1-edumazet@kernel.org/ Link: https://lore.kernel.org/all/2a0f5ff1d8db81b07fc4b344b8e68e3505fcbf36f72a471d1678b2f1cecd881b@mail.kernel.org/ Link: https://lore.kernel.org/netdev/DMII4JGTEUEG.2WRJPT6ODT6J0@gmail.com/ Link: https://patch.msgid.link/bpf_redirect_neigh_short_linear.v3.r0.20261031153053-1@mojatatu.com Signed-off-by: Sasha Levin commit 1b94ca29b1edbbdb357c2c8a9163d1d1755e4ad2 Author: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Date: Thu Oct 29 16:48:09 2026 +0800 ALSA: hwdep: Serialize DSP load requests [ Upstream commit aee83c204f80d56b4d55f53acdb8594308ddcd4a ] The check of the loaded DSP indices and the call of the driver's dsp_load callback in snd_hwdep_dsp_load() are not serialized. A hwdep file descriptor can be shared among threads, or inherited across fork, so two SNDRV_HWDEP_IOCTL_DSP_LOAD requests for the same index can both observe the index as unloaded and enter the driver's callback concurrently, even though the device itself is opened exclusively. This breaks the assumption behind hw->dsp_loaded that a firmware index is loaded only once. For example, snd-usb-usx2y hits WARN_ON(usx2y->as04.buffer) in usx2y_async_seq04_init() and may allocate the US-428 sequence URBs twice. Serialize the check, the callback invocation and the bookkeeping with a per-hwdep mutex, so that the second request returns -EBUSY. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Co-developed-by: Bin Yu Signed-off-by: Bin Yu Co-developed-by: Cheng Wen Signed-off-by: Cheng Wen Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Link: https://patch.msgid.link/20261029084810.21910-2-25031212351@stu.xidian.edu.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit aa91b5324b5c856e18a9d356df875b29fbedd33a Author: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Date: Wed Oct 28 18:31:58 2026 +0800 ALSA: usx2y: Initialize idle URBs before submitting streams [ Upstream commit ceb0d8c22473933099b46cec70639d0f1f7c68ad ] usb_stream_start() submits the first two capture and playback URBs and only afterwards assigns sk->idle_inurb, sk->idle_outurb, sk->completed_inurb and sk->completed_outurb to the remaining two URBs of each direction. A transfer can complete as soon as usb_submit_urb() has been called, so the completion handler i_capture_start() or i_playback_start() may run before those pointers are set. While the stream is still being synchronized (state below usb_stream_sync1), stream_start() then calls playback_prep_freqn(sk, sk->idle_outurb) with sk->idle_outurb still NULL, and the packet descriptors are written through that NULL pointer: Oops: general protection fault, probably for non-canonical address 0xdffffc0000000018: 0000 [#1] SMP KASAN KASAN: null-ptr-deref in range [0x00000000000000c0-0x00000000000000c7] RIP: 0010:playback_prep_freqn+0x11c/0x4a0 sound/usb/usx2y/usb_stream.c:33 Call Trace: stream_start+0x5dc/0x8d0 sound/usb/usx2y/usb_stream.c:596 i_capture_start+0x3da/0x710 sound/usb/usx2y/usb_stream.c:654 __usb_hcd_giveback_urb+0x238/0x550 drivers/usb/core/hcd.c:1657 usb_giveback_urb_bh+0x20b/0x530 drivers/usb/core/hcd.c:1691 tasklet_hi_action+0xa/0x20 kernel/softirq.c:994 handle_softirqs+0x16f/0x440 kernel/softirq.c:645 The four URBs referenced by these pointers are allocated long before and do not depend on any transfer state, so assign them before the submit loop. Keeping the assignment inside the retry path also restores a well-defined URB rotation when the start frame mismatch handling kills and resubmits the streams. Fixes: 030a07e441296c372f946cd4065b5d831d8dc40c ("ALSA: Add USB US122L driver") Cc: stable@vger.kernel.org Co-developed-by: Bin Yu Signed-off-by: Bin Yu Co-developed-by: Cheng Wen Signed-off-by: Cheng Wen Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Link: https://patch.msgid.link/20261028103158.22996-1-25031212351@stu.xidian.edu.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit b21aa212c9ba4536e66d65783cc883951c95ba01 Author: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Date: Wed Oct 28 15:41:43 2026 +0800 ALSA: us122l: Fix NULL dereference at hwdep open and release [ Upstream commit 820e0050866942b5498488496462d12c6ce1c7a9 ] usb_stream_hwdep_open() and usb_stream_hwdep_release() pass the result of usb_ifnum_to_if() straight to usb_autopm_get_interface() and usb_autopm_put_interface(), without checking it for NULL. usb_ifnum_to_if() returns NULL once the device is gone, since usb_disable_device() clears udev->actconfig on disconnect. The hwdep file can outlive the disconnect: the card is released with snd_card_free_when_closed(), so a process that keeps the character device open reaches the driver's release callback after the USB configuration has been dropped, and interface_to_usbdev() then dereferences the NULL interface at offsetof(struct device, parent). The open callback has the same problem when it races with the disconnect. Check both lookups and fail the open with -ENODEV; in release, skip the runtime PM put when the interface is already gone and still run the rest of the per-file cleanup. Move the us122l->first bookkeeping after the checks so that a failed open no longer leaves a stale file pointer behind. Fixes: 030a07e44129 ("ALSA: Add USB US122L driver") Cc: stable@vger.kernel.org Co-developed-by: Bin Yu Signed-off-by: Bin Yu Co-developed-by: Cheng Wen Signed-off-by: Cheng Wen Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Link: https://patch.msgid.link/20261028074143.14440-1-25031212351@stu.xidian.edu.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 6fdd96fa2f7a70d61eeed166e520a990c40ff223 Author: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Date: Wed Oct 28 12:25:25 2026 +0800 ALSA: us122l: Add missing NULL check in usb_stream_hwdep_mmap() [ Upstream commit f5d3eb483fed59fc0f3b059b8b6a32cedc922360 ] usb_stream_hwdep_mmap() reads us122l->sk.s and dereferences it without checking for NULL. The stream object is released by usb_stream_free(), which is reached through us122l_stop() both when the device is disconnected and when us122l_start() fails, and it leaves us122l->sk.s set to NULL. The hwdep file stays usable after that, so a later mmap() KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] RIP: 0010:usb_stream_hwdep_mmap+0x107/0x890 sound/usb/usx2y/us122l.c:182 crashes while reading s->read_size, which sits at offset 0x10. That NULL is an expected state for this field: usb_stream_hwdep_vm_fault(), usb_stream_hwdep_poll(), usb_stream_hwdep_ioctl(), usb_stream_stop() and usb_stream_free() all test it before use. Only the mmap callback misses the check, so let it return -ENODEV, matching what the other hwdep mapping in usx2yhwdeppcm.c does when its shared buffer has not been allocated. Fixes: 030a07e441296c372f946cd4065b5d831d8dc40c ("ALSA: Add USB US122L driver") Cc: stable@vger.kernel.org Co-developed-by: Bin Yu Signed-off-by: Bin Yu Co-developed-by: Cheng Wen Signed-off-by: Cheng Wen Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Link: https://patch.msgid.link/20261028042525.8737-1-25031212351@stu.xidian.edu.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin commit 256ca06920504adde310fb5252342e4b827ebcce Author: Evanshenf Date: Sat Oct 3 09:34:59 2026 +0000 drm/loongson: Handle buffer mapping failures when clearing a BO [ Upstream commit f00d7a241f846b053e89c0bb2285ef5988d4cafc ] lsdc_bo_clear() ignores the return value from lsdc_bo_kmap() and writes to lbo->kptr unconditionally. When the first mapping of a newly allocated buffer fails, kptr is still NULL and the subsequent memset accesses it. Return the mapping error without touching the buffer and propagate it from lsdc_gem_object_create(). Install the GEM object functions before clearing so that drm_gem_object_put() can release the buffer correctly on failure. Do not add the failed object to the tracking list or return an uncleared buffer to the caller. Imported buffers still skip clearing, and successfully mapped buffers are cleared and unmapped as before. Tested on LS7A2000 with a one-shot range error in ttm_bo_kmap(). Its -EINVAL return reached userspace, the object was destroyed once, and no GEM handle was published. Normal create/map/zero/write/read/close cycles passed, with the tracked BO count and VRAM usage unchanged. AI assistance was used for the lifetime analysis, fix, fault-injection tools, build and test execution. Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Evanshenf Reviewed-by: Icenowy Zheng Signed-off-by: Icenowy Zheng Link: https://patch.msgid.link/20261003093415.902f89244043-2-archwse@gmail.com Signed-off-by: Sasha Levin commit c8da4789c0c916fed4d546a2b07423151e5f9d59 Author: Evanshenf Date: Sat Oct 3 09:34:58 2026 +0000 drm/loongson: Fix double free on BO initialization failure [ Upstream commit f086dbdeb6e56510e158a853d752c6d8ed9e0674 ] If ttm_bo_init_validate() fails, it drops the buffer object's reference and cleans it up through the supplied destroy callback. lsdc_bo_destroy() releases the GEM object and frees the enclosing lsdc_bo, so freeing it again in lsdc_bo_create() causes a double free on a synchronous failure path. Let TTM own the cleanup after initialization has started and return the error directly. Keep the explicit free on drm_gem_object_init() failure, which occurs before ownership is passed to TTM. Tested on LS7A2000 by making drm_vma_offset_add() return -ENOSPC for one selected dumb-buffer creation. The error reached userspace, the destroy callback ran once, and no handle was published or tracked BO retained. Normal buffer creation, zeroing, mapping, readback and release passed. AI assistance was used for the ownership analysis, fix, fault-injection tools, build and test execution. Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Evanshenf Reviewed-by: Icenowy Zheng Reviewed-by: Qianhai Wu Reviewed-by: Huacai Chen Signed-off-by: Icenowy Zheng Link: https://patch.msgid.link/20261003093415.e64386de1e64-1-archwse@gmail.com Signed-off-by: Sasha Levin commit b3aeb586494826c2254e949437f3286257c5bf3b Author: Evanshenf Date: Sat Oct 3 09:00:13 2026 +0000 drm/loongson: Fix framebuffer selection in async cursor updates [ Upstream commit fa66daafbb6d5c984de2502809ff533ab66f6573 ] An asynchronous cursor update swaps the new framebuffer into the live plane state. However, the driver reads both old_fb and new_fb from the live state before this swap. When an enabled cursor changes buffers, the address-update condition is therefore false and the hardware continues scanning the previous buffer. Read new_fb from the new plane state before swapping the framebuffer references. This updates the hardware address when the framebuffer changes while retaining the existing behavior for cursor movement. Verified on a Loongson 3A5000 with LS7A2000 using 32x32 and 64x64 legacy cursor updates. Callback counters and read-only register observations confirmed the asynchronous path, the stale address before the change, and the new address afterward. Same-framebuffer movement and cursor disable/re-enable also passed, with the primary framebuffer and mode unchanged. AI assistance was used to investigate the existing report, prepare the fix and test tools, run the build and hardware comparison, and draft this message. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202311152357.4KFS0M8f-lkp@intel.com/ Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Evanshenf Reviewed-by: Icenowy Zheng Reviewed-by: Qianhai Wu Reviewed-by: Huacai Chen Signed-off-by: Icenowy Zheng Link: https://patch.msgid.link/20261003090006.4e29fdce9913-1-archwse@gmail.com Signed-off-by: Sasha Levin commit a27e6e9f7ce47eb15f1a29514ee63ec752c49e33 Author: Shao Mingyin Date: Mon Oct 26 19:52:45 2026 +0800 scsi: target: tcmu: Fix divide-by-zero in data_pages_per_blk store [ Upstream commit b8d0bb6a8ba0d3878940a914a19336844101867b ] tcmu_set_data_pages_per_blk() only validates the upper bound of the value parsed from data_pages_per_blk=. Zero passes that check and is then used as the divisor when computing udev->max_blocks: divide error: 0000 [#1] SMP ... tcmu_set_data_pages_per_blk tcmu_configure_device Reject non-positive values, as the neighbouring max_data_area_mb and cmd_ring_size setters already do. Fixes: 08976cb548d6 ("scsi: target: tcmu: Make data_pages_per_blk changeable via configfs") Signed-off-by: Shao Mingyin Cc: stable@vger.kernel.org Reviewed-by: Bodo Stroesser Link: https://patch.msgid.link/20261026195245337ktSXy9G17VCcXyw760g9s@zte.com.cn Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Sasha Levin commit d1db24c32bbe7b998573392070c3a6bdd9f4066c Author: Yuanhe Shu Date: Mon Oct 26 20:41:38 2026 +0800 scsi: target: Verify the iSCSI ISID is null-terminated [ Upstream commit cdf4b87a18cb6a0ee26865cb1b7b5660a491d302 ] iscsi_parse_pr_out_transport_id() returns the ISID of a FORMAT CODE 01b TransportID as a pointer into the PERSISTENT RESERVE OUT parameter list, lowercased in place and never null-terminated. spc4r37 Table 508 requires the field to be null-terminated, but a non-conforming initiator can omit the NULL; when the ISID ends at the end of the received buffer, the pointer is not a C string. The registration code still consumes it as one: strcmp() in __core_scsi3_locate_pr_reg() and in the REGISTER AND MOVE path, and snprintf("%s") in __core_scsi3_do_alloc_registration(), which also reads its first 8 bytes unconditionally with get_unaligned_be64() - a NUL check does not bound that read. When the parameter list spans more than one page, transport_kmap_data_sg() maps it with vmap(), and the over-read walks off the end of the mapping into the vmalloc() guard page and oopses. Reproduced with a PR OUT REGISTER + SPEC_I_PT parameter list of exactly 8192 bytes whose final TransportID carries a 12-byte ISID without a terminating NUL: BUG: unable to handle page fault for address: ffffc9000138c000 RIP: 0010:strcmp+0xc/0x30 Call Trace: __core_scsi3_locate_pr_reg+0xd3/0x120 [target_core_mod] core_scsi3_decode_spec_i_port+0x8fc/0x13a0 [target_core_mod] core_scsi3_emulate_pro_register+0x73c/0x900 [target_core_mod] ... iscsi_target_rx_thread+0xef/0x1d0 [iscsi_target_mod] With a single-page parameter list the buffer is a kmap() direct mapping, so the over-read continues into the physically adjacent page instead of faulting. snprintf("%s") then copies whatever follows the ISID in memory into pr_reg_isid, and PR IN READ FULL STATUS reports the registration back to any initiator, turning the over-read into an info leak of kernel heap contents. Reproduced with a 4096-byte parameter list whose last TransportID ends at the end of the buffer with a 4-byte ISID and no NUL, interleaved with I/O to populate adjacent pages: the READ FULL STATUS response returned the ISID as "0xleak" followed by raw bytes that were not part of the parameter list. The snprintf() into pr_reg_isid[PR_REG_ISID_LEN] caps the echoed ISID at 15 characters, so at most 11 bytes past the buffer are leaked per command, but the PR OUT command is not rate limited. Any initiator that can send PR OUT to an iSCSI-exported LUN can trigger either variant, including a guest via vhost-scsi. Require 8 bytes to remain after the ",i,0x" separator, and a NUL inside the rest of the descriptor, before the ISID pointer is returned. REGISTER AND MOVE fails with TCM_INVALID_PARAMETER_LIST; on SPEC_I_PT no target port claims the malformed TransportID, and the command fails the same way. Fixes: d04a179085c2 ("scsi: target: Bound PR-OUT TransportID parsing to the received buffer") Reported-by: kitta Reported-by: sashiko AI review Link: https://lore.kernel.org/r/sashiko-outbox-184760@kernel.org/ Cc: stable@vger.kernel.org Cc: Bryam Vargas Cc: John Garry Assisted-by: LLM Signed-off-by: Yuanhe Shu Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6") Link: https://patch.msgid.link/20261026124138.2708365-1-xiangzao@linux.alibaba.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Sasha Levin commit a223bf1decef436f6fc901b1fd9c16cbbc5457a3 Author: Yingjie Wang Date: Fri Oct 23 16:23:06 2026 +0000 scsi: bsg: Report io_uring data copyback failures [ Upstream commit ffb7b533a47906b96166eec4b7eaa4199b7a7462 ] scsi_bsg_uring_task_cb() discards the result of blk_rq_unmap_user(). For a data-in command that uses a bounce buffer, the task work can therefore post a CQE with res == 0 despite a copyback failure. Use the unmap result as the CQE status. A later sense-buffer copy failure continues to take precedence. On x86_64, a raw BSG INQUIRY into an unaligned anonymous PROT_NONE mapping posted a CQE with res == 0 in 20/20 runs before this change and res == -EFAULT in 20/20 runs afterward. Writable controls succeeded in 20/20 runs on both kernels. Fixes: 7b6d3255e7f8 ("scsi: bsg: add io_uring passthrough handler") Cc: stable@vger.kernel.org Signed-off-by: Yingjie Wang Reviewed-by: Yang Xiuwei Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/0b35d2d46bf8ff9f2dbba83ae093d17351e950e9.1792772194.git.x-professor@outlook.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Sasha Levin commit 0f0323dc06a04f83f366e6a6381a5a3568f36301 Author: Yingjie Wang Date: Fri Oct 23 16:23:04 2026 +0000 scsi: bsg: Report synchronous data copyback failures [ Upstream commit a52f2ad45726d788755b525adcf51f65a6b836ff ] scsi_bsg_sg_io_fn() ignores the result of blk_rq_unmap_user(). For a data-in command that uses a bounce buffer, unmapping copies the completed data to userspace. If that copy fails, SG_IO can report success despite the copyback failure. Capture the unmap status. Preserve an earlier sense-buffer copy error and otherwise return the data copyback error. This matches the error precedence used by scsi_complete_sghdr_rq(). On x86_64, a virtio-scsi INQUIRY with an unaligned PROT_NONE destination made ioctl() return 0 in 20/20 runs before this change and return -1 with errno EFAULT in 20/20 runs afterward. Writable controls succeeded in 20/20 runs on both kernels. Fixes: 10e8855b9451 ("bsg: add SG_IO to SG v4") Cc: stable@vger.kernel.org Signed-off-by: Yingjie Wang Reviewed-by: Yang Xiuwei Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/2561d633cc8cef513d75eb1df260046a4971e783.1792772194.git.x-professor@outlook.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Sasha Levin commit 6a236983e79b92d989d7179cf74927330f6606a4 Author: Yu Zhang Date: Mon Oct 26 20:05:35 2026 +1000 ptp: fix use-after-free in extts_fifo_show() reading tsevqs unlocked [ Upstream commit 603a0c40d414ea12509fc45f2b930449a8d4aad2 ] extts_fifo_show() walks ptp->tsevqs with list_count_nodes() and then list_first_entry() without holding ptp->tsevqs_lock, the spinlock that "protects tsevqs from concurrent access". Every other accessor of the list honours it: ptp_open() (list_add_tail), ptp_release() (list_del followed by kfree of the per-fd queue), ptp_clock_release() and ptp_clock_event() all take tsevqs_lock. extts_fifo_show() is the only one that does not. A per-fd timestamp queue is appended to tsevqs on open("/dev/ptpN") and removed and freed on close(), both under tsevqs_lock: scoped_guard(spinlock_irq, &ptp->tsevqs_lock) list_del(&queue->qlist); bitmap_free(queue->mask); kfree(queue); So a read of /sys/class/ptp/ptpN/fifo running concurrently with a close() of a /dev/ptpN fd can have list_count_nodes() walk into the queue that close() is removing and freeing, dereferencing freed memory (use-after-free) or a poisoned list pointer. Take tsevqs_lock around the list walk. The fifo only ever draws from the first queue, which is the registration-time queue created in ptp_clock_register() and freed only in ptp_clock_release(); that cannot run while the sysfs attribute is being read, so the dequeue from queue->buf under queue->lock may stay outside tsevqs_lock and the lock order is unchanged. Fixes: d26ab5a35ad9 ("ptp: Replace timestamp event queue with linked list") Cc: stable@vger.kernel.org Signed-off-by: Yu Zhang Link: https://patch.msgid.link/20261026100535.68114-1-yuz08559@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin commit db399899dbac590d7d124b6896bd113916e7ab09 Author: guolingxing Date: Sun Oct 18 15:38:10 2026 +0000 btrfs: prevent deleting the wrong subvolume by ID [ Upstream commit 1960146913b31b288ed2cd607d103ee3b41681d4 ] When deleting a subvolume by ID, btrfs_ioctl_snap_destroy() first resolves the requested ID to a name, then looks up that name again under the parent directory lock. A concurrent rename can change which subvolume is associated with the name between these operations. Since the deletion path does not verify the ID of the resolved subvolume, it can delete a different subvolume while leaving the requested one intact. This was reproduced by repeatedly exchanging the names of two subvolumes using renameat2(RENAME_EXCHANGE) while deleting one of them by ID. The wrong subvolume was deleted in 9 out of 14 independent tests. Fix this by checking that the resolved subvolume ID matches the requested ID while holding the parent directory lock. Return -EAGAIN on a mismatch so that userspace can retry the operation instead of being told that the requested subvolume does not exist. Fixes: 949964c92843 ("btrfs: add new BTRFS_IOC_SNAP_DESTROY_V2 ioctl") CC: stable@vger.kernel.org Reviewed-by: Qu Wenruo Signed-off-by: guolingxing Signed-off-by: David Sterba Signed-off-by: Sasha Levin commit c7011ad8d6941e1a53882c486145935dc5664c6f Author: guolingxing Date: Thu Oct 15 06:53:19 2026 +0000 btrfs: sysfs: restore NOFS context on early return in btrfs_sysfs_add_block_group_type() [ Upstream commit 4172be965c2ce887ebfb1117c634a68555be8c11 ] btrfs_sysfs_add_block_group_type() sets up a NOFS context with memalloc_nofs_save() because kobject_add() performs GFP_KERNEL allocations deep in its call chain, and the function may be called while holding a transaction handle or a lock required for a transaction commit, where reclaim could deadlock. Every other return path of this function calls memalloc_nofs_restore() except the early return taken when another thread has already created the kobject for the same raid index (this can happen when restriping). Taking that path leaves PF_MEMALLOC_NOFS set on the calling task, so all subsequent memory allocations performed by that task remain restricted to the NOFS scope, which may lead to unexpected allocation failures or deadlocks later on. Restore the NOFS context before returning from that path. Fixes: 49ea112da0e6 ("btrfs: do not create raid sysfs entries under any locks") CC: stable@vger.kernel.org Signed-off-by: guolingxing Reviewed-by: Qu Wenruo Signed-off-by: David Sterba Signed-off-by: Sasha Levin commit 658741fce421246da6a7cb7cc884820eea123d04 Author: Hengyu Liang Date: Sun Oct 11 11:58:15 2026 -0400 btrfs: fix chattr failing on nodatasum files that have the compress flag [ Upstream commit 16b8f07d1ed50d4a8da468b56484873784dd8f4a ] Commit cf1afec09e9f ("btrfs: validate properties before setting them") made btrfs_set_prop() validate a property before setting it. For the compression property, the validation fails with -EINVAL when the inode has NODATASUM. However, chattr writes back all the flags it read from the file, and btrfs_fileattr_set() sets the compression property whenever the new flags include FS_COMPR_FL, even when the compression flags do not change. A file created on a filesystem mounted with nodatasum has NODATASUM and still inherits the compress flag from its directory. As of now, chattr fails on such a file when it changes any other flag. The issue can be reproduced with: mkfs.btrfs -f /dev/sdb mount -o nodatasum /dev/sdb /mnt mkdir /mnt/dir chattr +c /mnt/dir touch /mnt/dir/file chattr +A /mnt/dir/file Before commit cf1afec09e9f ("btrfs: validate properties before setting them"), the last command succeeds. After that commit, it fails with EINVAL. This patch will make btrfs_fileattr_set() leave the compression flags and the compression property alone when the call changes neither FS_COMPR_FL nor FS_NOCOMP_FL. Fixes: cf1afec09e9f ("btrfs: validate properties before setting them") CC: stable@vger.kernel.org # 7.2+ Suggested-by: Qu Wenruo Assisted-by: LLM Signed-off-by: Hengyu Liang Reviewed-by: Qu Wenruo Reviewed-by: Filipe Manana Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Sasha Levin commit 0ff27cefd26182be8366c414478967d667bd8e86 Author: Masafumi Suzuki Date: Tue Oct 27 17:24:05 2026 +0900 sctp: account for chunk padding in sctp_init_cause() [ Upstream commit ed6c53b27be492643da2017c6f8e2732be5edf1a ] sctp_init_cause() accepts a chunk when skb_tailroom() can hold the cause header and the payload. sctp_addto_chunk() then writes 0-3 bytes of padding before that header so the chunk stays 4-byte aligned. The check does not include the padding, and the following skb_put() calls skb_over_panic() from softirq. Count the padding sctp_addto_chunk() is about to write. The cause length on the wire stays the header plus the payload. Found by LLM inspection, triggered and tested the fix. Fixes: 8914f4bace3f ("sctp: add sctp_make_op_error_limited and reuse inner functions") Cc: stable@vger.kernel.org Signed-off-by: Masafumi Suzuki Acked-by: Xin Long Link: https://patch.msgid.link/20261027082405.1297-1-shengshilingmu97@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin commit eff5259d14345fc9df59084e38d88769c1fdd91b Author: Lucas Tanure Date: Mon Oct 26 16:40:28 2026 +0000 drm/vc4: hdmi: enable scrambling before the TMDS clock starts [ Upstream commit 81383bd290a18f06ccf9b0bfb29e1a3ef73d9357 ] HDMI 2.0 requires a source to suspend the TMDS clock, write the TMDS_Bit_Clock_Ratio bit in the sink's SCDC registers, wait at least 1 ms and only then resume the clock. vc4 does the opposite: the PHY starts at the new rate first, and the SCDC bits are written tens of milliseconds later, at the very end of the enable sequence, together with the source side scrambler. On disable the bits are cleared while the clock is still running. Some sinks sample the bit only when the clock appears. One HDMI 2.0 sink we tested then sets up its receiver for a 1/10 clock and never recovers: a Raspberry Pi 5 at 3840x2160@60 shows no picture, while 1080p60 and 4K30 work and other sources work at 4K60 on the same sink. Writing the bit by hand before enabling the output makes the same mode lock every time. Enable scrambling, on the sink and in the controller, before the PHY is started, and disable it only after the PHY has been stopped. The SCDC helper already waits the required time after writing the ratio bit. Cc: stable@vger.kernel.org Fixes: c85695a2016e ("drm/vc4: hdmi: Enable the scrambler") Link: https://github.com/raspberrypi/linux/issues/7693 Assisted-by: LLM Signed-off-by: Lucas Tanure Reviewed-by: Maíra Canal Link: https://patch.msgid.link/20261026164028.78792-4-lucas.tanure@neat.no Signed-off-by: Maíra Canal Signed-off-by: Sasha Levin commit 7456cb345721b6ba48878dc124a66293497ebc30 Author: Lucas Tanure Date: Mon Oct 26 16:40:27 2026 +0000 drm/vc4: hdmi: always cancel the scrambling work synchronously [ Upstream commit 2e47848f0d076dec66df3bc403214073cd2214ac ] The scrambling work re-arms itself every second while a scrambled mode is active. When the output is disabled, the work may be executing at that moment rather than pending, and delayed_work_pending() is then false, so the cancel is skipped. The running instance finishes after the disable, sees the sink report scrambling off, writes the SCDC scrambling and clock ratio bits back on, and queues itself again. The sink is left configured for a scrambled 1/40 link that no longer exists and the work keeps running until the next enable. cancel_delayed_work_sync() handles both states: it waits for a running instance and blocks it from queueing itself again. Cc: stable@vger.kernel.org Fixes: 257d36d493e9 ("drm/vc4: hdmi: Add a workqueue to set scrambling") Assisted-by: LLM Signed-off-by: Lucas Tanure Reviewed-by: Maíra Canal Link: https://patch.msgid.link/20261026164028.78792-3-lucas.tanure@neat.no Signed-off-by: Maíra Canal Signed-off-by: Sasha Levin commit 156816bc910000d6af737bfc0a19698b7ec0227e Author: Dom Cobley Date: Mon Oct 26 16:40:26 2026 +0000 drm/vc4: hdmi: power down the BCM2712 PHY when the output is disabled [ Upstream commit a59a60e6e9e3a1d5177b28577d935d5ee37ace66 ] vc6_hdmi_phy_disable() is empty, so on BCM2712 the PHY keeps its PLL and TMDS drivers running after the HDMI output is disabled, until the next vc6_hdmi_phy_init(). The TMDS clock is therefore not stopped between two mode sets, which the SCDC clock ratio change requires, and the idle PHY wastes power. Reset and power down the PHY on disable, as the BCM2711 variant does. Cc: stable@vger.kernel.org Fixes: 0b1dbe82e051 ("drm/vc4: hdmi: Add support for BCM2712 HDMI controllers") Signed-off-by: Dom Cobley [lucas.tanure: Rewrote commit message to clarify the issue and fix] Signed-off-by: Lucas Tanure Reviewed-by: Dave Stevenson Link: https://patch.msgid.link/20261026164028.78792-2-lucas.tanure@neat.no Reviewed-by: Maíra Canal Signed-off-by: Maíra Canal Signed-off-by: Sasha Levin commit 18772182967f9a0160dc7ada43311eab87c3d9ec Author: Zhou Qiuyue Date: Mon Oct 26 12:48:08 2026 +0800 ipv6: raw: fix use-after-free in rawv6_send_hdrinc() [ Upstream commit 66dfb2cacda7faae614d688943d85e75abf7f586 ] rawv6_send_hdrinc() caches the route before handing the skb to l3mdev_ip6_out(). The VRF output path may replace skb->dst and release the original route, leaving the cached pointer stale. The function later dereferences that pointer for statistics accounting and as the output device passed to NF_HOOK(). Its RCU read-side critical section starts after l3mdev_ip6_out(), so it cannot prevent the old route from being reclaimed in between. Reload the route from the current skb destination after l3mdev_ip6_out() returns. KASAN reports a slab-use-after-free in rawv6_sendmsg(), with the route allocated by ip6_dst_alloc(), freed by dst_destroy() from rcu_core(), and the related RCU callback queued from vrf_l3_out(). Fixes: 4c1feac58e06 ("net: vrf: Flip IPv6 output path from FIB lookup hook to out hook") Cc: stable@vger.kernel.org Signed-off-by: Zhou Qiuyue Reviewed-by: Hangbin Liu Signed-off-by: Dave Miller Signed-off-by: Sasha Levin commit 4a9302c13c22a0e91375ce478544eb7d2232877e Author: Franck Baur Date: Sat Oct 24 14:40:44 2026 +0200 net: jme: keep RX MAC clock enabled for WoL [ Upstream commit ed9179fc7228315fb745dc3b111bae446e6894d2 ] On the JMicron JMC250 revision 03, the MAC reset performed during suspend leaves GPREG1_RXCLKOFF set. Although the driver enables Magic Packet detection, the gated RX MAC clock prevents wake-up from ACPI S3. Keep the RX MAC clock enabled while WoL is armed. Restore the gated clock state immediately after disabling WoL during resume, preserving the RX engine initialization ordering. Prevent concurrent link-change work from gating the clock again after WoL has been armed. Quiesce interrupt-driven link-change scheduling, synchronize pending interrupts, and cancel outstanding link-change work before programming WoL in suspend and shutdown paths. Restore the deferred processing state before requesting link reinitialization on resume. Tested on an ASUS K42JE with JMC250 [197b:0250] rev 03 using a Debian 6.12.111 kernel and an externally built module. ACPI S3 wake with a Magic Packet completed in 19 seconds, while a control without a Magic Packet resumed through the RTC alarm after 123 seconds. Ethernet and SSH recovered after resume. S4 and S5 wake behaviour has not been validated with this revision. Fixes: 854a2e7c331a ("jme: Safer MAC processor reset sequence") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Franck Baur Signed-off-by: Dave Miller Signed-off-by: Sasha Levin commit cd2ff491c8eed4773f4f50ae10c942e09db1f6c4 Author: Sven Eckelmann Date: Thu Oct 8 17:41:24 2026 +0200 batman-adv: tt: don't drop local events queued during TVLV update [ Upstream commit ed7a0dfdd370acb48be7a281df732c1bebcc7f1d ] batadv_tt_tvlv_container_update() read the number of local changes without holding changes_list_lock. batadv_tt_local_event() is not serialized by the commit_lock and can queue new events before the changes_list is flushed: CPU0 CPU1 batadv_tt_tvlv_container_update() num = ...local_changes; batadv_tt_local_event() list_add_tail(...); ...local_changes++; spin_lock_bh(&...changes_list_lock); /* only num events copied but all freed */ The additional events were freed without ever being sent. Other nodes will only notice this via a CRC mismatch and must request the full table. The number of changes and the changes_list must therefore be taken atomically. Events queued afterwards then stay in the tt.changes_list for the next TT round. The changes can no longer be kept for the next round when the TVLV buffer allocation fails. But they would be sent with a skipped TTVN anyway, so the other nodes have to request the full table in this case either way. The last changeset is only dropped in this case when the TTVN was incremented. Without new changes, it still describes the current TTVN. Previously, the unconsumed changes caused a retry of the TVLV container update in the next commit round. Since the changes are now consumed, the next round would only take the path without changes and wait for BATADV_TT_OGM_APPEND_MAX rounds before updating the container again. Until then, the outdated container with the previous TTVN would still be announced. The ogm_append_cnt is therefore reset on failure to retry the update in the next OGM interval. This doesn't make the CRC consistent with the announced changeset. The local table modifications are still not serialized with the commit and batadv_tt_local_transition_new() can still make a client part of the CRC for which the event is only part of the next TT round. Such an inconsistency is detected by the CRC check of the other nodes and solved via a full table request. Cc: stable@vger.kernel.org Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-fc286ddd-5bed-4683-b842-ee7a307eeb19 Fixes: a73105b8d4c7 ("batman-adv: improved client announcement mechanism") Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 1654eeaccde3bc9fd71b6b316bcc8eb6f4f9c012 Author: Sven Eckelmann Date: Wed Oct 7 13:03:29 2026 +0200 batman-adv: tt: ignore ROAM flag of received ADD changes [ Upstream commit c5d68abe6e7f1dbd132a602cb696fe1fff0389eb ] A received TT change (OGM diff or full table response) with the ROAM flag but without DEL is handled by batadv_tt_global_add() like a ROAMING_ADV: * a newly created global entry gets BATADV_TT_CLIENT_ROAM and is therefore excluded from the global CRC. The sender has it in its local CRC and the receiver has to request the full table again * batadv_tt_global_purge_local() removes the local entry of the receiver. The receiver's own client is considered as roamed to the sender and frames for it are rerouted The ROAM flag only has a meaning together with DEL. Drop it on reception to keep it from populating the global table with a temporary ROAMING entry which is not part of the CRC - and therefore causing a CRC mismatch. Cc: stable@vger.kernel.org Fixes: 068ee6e204e1 ("batman-adv: roaming handling mechanism redesign") Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 310479adf366e73944e0d75cc8ec11e99327dafc Author: Sven Eckelmann Date: Thu Oct 8 18:29:16 2026 +0200 batman-adv: stop originator purge worker before freeing TT [ Upstream commit f89eda5a9ccf82cba06b085b42ebc4886b8dfe9e ] batadv_mesh_free() releases the translation tables via batadv_tt_free() before batadv_originator_free() stops orig_work. The purge worker can therefore still run while the TT is torn down. When an originator times out, batadv_purge_orig_ref() calls batadv_tt_global_del_orig(), which loads tt.global_hash and walks all buckets while taking their locks: CPU0 CPU1 batadv_tt_free() batadv_purge_orig() batadv_tt_global_del_orig() hash = ...tt.global_hash; batadv_tt_global_table_free() batadv_hash_destroy(hash); spin_lock_bh(&hash->list_locks[i]); Disable orig_work at the beginning of batadv_mesh_free(), directly after the mesh was marked as deactivating. The second disable_delayed_work_sync() in batadv_originator_free() is harmless because it is free'd anyway. Cc: stable@vger.kernel.org Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260708091821.314516-1-sw%40simonwunderlich.de?part=3 Fixes: 9d31b3ce8168 ("batman-adv: fix potential TT client + orig-node memory leak") Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 2a47810eea1c244b69c7f991b445f309be295c7f Author: Sven Eckelmann Date: Tue Oct 13 11:23:34 2026 +0000 batman-adv: fix skb leak when hard_iface is being released [ Upstream commit 522e4aece2e96cacbb8a6ae1eec0d4c0dd6f4fed ] batadv_batman_skb_recv() owns the skb it is given. When the hard_iface refcount already dropped to zero, the function jumped to err_out, which only returned NET_RX_DROP and skipped the kfree_skb() under err_free. To avoid a leak, free the skb before returning in this case. Cc: stable@vger.kernel.org Fixes: 4fe56e60ac1b ("batman-adv: Check hard_iface refcnt when receiving skb") Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 7a50da393b4cb767417e37967f24b163818eee26 Author: Sven Eckelmann Date: Sun Oct 4 10:10:06 2026 +0200 batman-adv: dat: initialize orig_node of unfilled candidate slots [ Upstream commit 4eb19a389d74f06901b4cd6f24b996b2e84eaefc ] batadv_dat_select_candidates() allocates the candidate array without zeroing it. batadv_choose_next_candidate() marks each slot as BATADV_DAT_CANDIDATE_NOT_FOUND but only sets orig_node when an eligible originator was found. In the following rounds, batadv_is_orig_node_eligible() compares res[j].orig_node of all previous slots against the evaluated originator. For slots without candidates, it reads uninitialized memory. The orig_node has to be cleared together with the BATADV_DAT_CANDIDATE_NOT_FOUND type. Cc: stable@vger.kernel.org Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-b25d9aa4-10bb-427c-a145-ccaadc2a1bb9 Fixes: 785ea1144182 ("batman-adv: Distributed ARP Table - create DHT helper functions") Acked-by: Linus Lüssing Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit bff356c3b6103b9f21417923c8dafda69613ff94 Author: Sven Eckelmann Date: Tue Oct 6 19:38:15 2026 +0200 batman-adv: tpmeter: fix u32 truncation of reported bytes [ Upstream commit 1025b76d13288a311e8259a0eefde0854fa63c41 ] When more than 4 GB are transferred by the throughput meter, batadv_tp_batctl_notify() will cut of the upper 32 bit of the u64 counter and thus under-report the actual transferred bytes. The data type of the temporary storage variable must therefore still continue to use u64. Cc: stable@vger.kernel.org Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-08bb3be4-6c6a-452d-b4e4-606940c6cfa5 Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation") Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit dc52eedaf27cb9ca4f52202f391c1793c0c54eba Author: Kyle Zeng Date: Thu Oct 29 21:21:46 2026 -0700 batman-adv: mcast: validate tracker padding before forwarding [ Upstream commit ea01fff30f631e67ee5f0a2b97855d772b3a35fc ] A multicast tracker with an even number of destinations needs two padding bytes after its destination list. batadv_mcast_forw_packet() currently only checks that the count field and the addresses fit in the tracker TVLV. If an unpadded even tracker is compacted to an odd number of destinations, batadv_mcast_forw_shrink_update_headers() includes those missing padding bytes in the amount to remove. The subsequent memmove can then write two bytes past the old packet tail. With no tailroom, this corrupts skb_shared_info. Include the required padding in the existing tracker length check. This rejects the malformed tracker before either received or locally generated packets can reach the compactor. Fixes: 2dfe644a1ce0 ("batman-adv: mcast: shrink tracker packet after scrubbing") Cc: stable@vger.kernel.org Signed-off-by: Kyle Zeng Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 79c8ebad036737c02438d24d5af331abbd1095e0 Author: Eric Biggers Date: Wed Oct 28 22:45:34 2026 -0700 lib/crypto: mldsa: Add __must_check to mldsa_verify() [ Upstream commit 01ad209f122b7c173477bd60c7997564f9c65961 ] Signature verification status always must be checked. Add __must_check, for consistency with e.g. the AES-GCM and ChaCha20Poly1305 functions. No effect on current callers, who always check the return value. Fixes: 64edccea594c ("lib/crypto: Add ML-DSA verification support") Cc: stable@vger.kernel.org Reviewed-by: Ard Biesheuvel Link: https://patch.msgid.link/20261029054534.68481-4-ebiggers@kernel.org Signed-off-by: Eric Biggers Signed-off-by: Sasha Levin commit 37abad2a54d7f1ded707c9443f5397a1c27dcd52 Author: Eric Biggers Date: Wed Oct 28 22:45:33 2026 -0700 lib/crypto: mldsa: Explicitly check that 'alg' is a valid value [ Upstream commit efb621a57d7e4ce28e12082ba5692231858c4a3a ] C doesn't guarantee at the language level that an enum actually has one of the declared values. For robustness, make mldsa_verify() handle invalid values of 'alg'. No effect on current callers, who always pass a valid value for 'alg'. (Except for the KUnit test case that this commit adds.) Fixes: 64edccea594c ("lib/crypto: Add ML-DSA verification support") Cc: stable@vger.kernel.org Reviewed-by: Ard Biesheuvel Link: https://patch.msgid.link/20261029054534.68481-3-ebiggers@kernel.org Signed-off-by: Eric Biggers Signed-off-by: Sasha Levin commit a34fed9fc5999f8c73fe9e197e0724b2bec919f2 Author: Eric Biggers Date: Wed Oct 28 22:45:32 2026 -0700 lib/crypto: mldsa: Check pk_len before doing pointer arithmetic [ Upstream commit 5c140c870044af2f4b79e87b42d078cf7c318582 ] Though common in the kernel and benign in practice (not even triggering UBSAN warnings), taking an address past the end of an array is undefined behavior according to the C specification. Therefore, compute &pk[RHO_LEN] only after pk_len has been validated, since pk_len could be less than RHO_LEN if an incorrectly sized public key is provided. (Also fix a typo that isn't worth its own commit.) Fixes: 64edccea594c ("lib/crypto: Add ML-DSA verification support") Cc: stable@vger.kernel.org Reviewed-by: Ard Biesheuvel Link: https://patch.msgid.link/20261029054534.68481-2-ebiggers@kernel.org Signed-off-by: Eric Biggers Signed-off-by: Sasha Levin commit 3bd1a93283dccefcdf265d1cd82f2b9ea25518d7 Author: Chengfeng Ye Date: Sun Sep 27 18:16:24 2026 +0800 batman-adv: Close OGM aggregation before transmission [ Upstream commit f91f64a91682c07e6c5f059804e709656364e8a6 ] The OGM send worker leaves its forwarding packet on forw_bat_list until after batadv_iv_ogm_emit() returns. Aggregation holds forw_bat_list_lock, but emission reads and clones the packet without that lock. CPU 0 can therefore start emitting a queued packet while CPU 1 takes the list lock, finds the same packet and appends another OGM. The sender can observe the new packet length before the corresponding direct-link flag is set, or clone the skb while its length and payload are being updated. This can transmit an OGM with incorrect flags or inconsistent data. KCSAN reported: BUG: KCSAN: data-race in batadv_iv_ogm_queue_add / batadv_iv_send_outstanding_bat_ogm_packet write to 0xffff888100fedcf8 of 2 bytes by interrupt on cpu 1: read to 0xffff888100fedcf8 of 2 bytes by task 70 on cpu 2: value changed: 0x00c0 -> 0x00d8 Mark the aggregate as full under forw_bat_list_lock before emission. This waits for any ongoing append and prevents further aggregation. Emission uses packet_len to walk the OGMs, so all queued packets are still sent. Keep the packet on the list so interface purging can find the worker, wait for it to finish and free the packet. Fixes: 9b4aec647a92 ("batman-adv: fix rare race conditions on interface removal") Cc: stable@vger.kernel.org # 4.10.x: 434becf57bdc ("batman-adv: Limit number of aggregated packets directly") Cc: stable@vger.kernel.org # 4.10.x Signed-off-by: Chengfeng Ye [ sven: drop assisted tag, document new meaning of num_packets ] Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin commit 8d247ae04b11459bc7d2ee295c2327e16a0e2893 Author: Yuanfu Xie Date: Mon Sep 28 15:25:48 2026 +0800 9p: don't decrement a server-owned zero nlink [ Upstream commit 4e915aa8566173b44146bc46177c85afbe6bdf96 ] A 9P2000.L server can report nlink=0 for a regular file that still exists. On a cache=loose or cache=fscache mount, lookup stores that value with set_nlink(). A later successful unlink calls v9fs_dec_count(), which still calls drop_nlink() for a non-directory. drop_nlink() warns, and the unsigned link count wraps to 4294967295. fstat() on a descriptor opened before the unlink shows 0 before and 4294967295 after. The warning on the unpatched kernel, trimmed: WARNING: fs/inode.c:408 at drop_nlink+0xac/0xd0, CPU#1: trigger/188 CPU: 1 UID: 0 PID: 188 Comm: trigger Tainted: G N 7.3.0-rc4-00537-ga3ff15db6820 #1 PREEMPT(lazy) RIP: 0010:drop_nlink+0xac/0xd0 Call Trace: v9fs_remove+0x529/0x750 vfs_unlink+0x2f0/0xbd0 filename_unlinkat+0x340/0x6c0 __x64_sys_unlink+0x46/0x70 do_syscall_64+0xe8/0x4f0 entry_SYSCALL_64_after_hwframe+0x77/0x7f ---[ end trace 0000000000000000 ]--- Directories whose cached nlink is at most 2 already skip this decrement, because the exported filesystem may not maintain nlink (commit ac89b2ef9b559). cache=none skips it as well (commit 574aa0b479947). cache=mmap does not take this path: it sets neither CACHE_META nor CACHE_LOOSE. A regular file on cache=loose or cache=fscache still does. Its count came from GETATTR and may already be zero, so skip the decrement when i_nlink is already 0. Verified on 7.3-rc4-00537-ga3ff15db6820 with only this change. A server that advertises nlink=0 and accepts the unlink no longer warns, and the open descriptor stays at nlink 0. An honest server on the same mount still goes from 1 to 0. A rejected unlink leaves the count unchanged. cache=none is unchanged. With panic_on_warn the unpatched kernel panics on the warning; the patched kernel does not. Fixes: ac89b2ef9b559 ("9p: don't maintain dir i_nlink if the exported fs doesn't either") Cc: stable@vger.kernel.org Signed-off-by: Yuanfu Xie Message-ID: <8B490036-EBB0-4A36-AE39-F294F7C79649@stu.pku.edu.cn> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit c342fef95252c92c46531da676784c833806fd9a Author: Yehyeong Lee Date: Mon Oct 5 21:56:38 2026 +0900 9p/xen: validate the response size from the backend [ Upstream commit 9b4cf60c6b739461c5b4ec9c52587da6b2608786 ] p9_xen_response() takes the length of an incoming response from the ring -- the first field of the 9p header, which the Xen transport reuses as its framing header -- and uses it to advance the consumer index, but never checks that it is at least the header size or no larger than the number of bytes the backend has actually produced. A malicious or buggy backend can post a response whose size is smaller than the header (for example 0). The consumer index then never advances, so the response work re-reads the same ring contents instead of making progress. In testing this raced with the teardown that the malformed reply triggers and dereferenced a freed p9_client: 9pfs 9pfs-0: Wrong req tag=ffff BUG: kernel NULL pointer dereference, address: 0000000000000060 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: Oops: 0000 [#1] SMP NOPTI CPU: 0 UID: 0 PID: 11 Comm: kworker/0:1 Not tainted 7.2.0-rc5 #6 PREEMPT(lazy) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014 Workqueue: events p9_xen_response RIP: 0010:idr_find+0x4/0x10 RSP: 0018:ffffbf5d80063de8 EFLAGS: 00010202 RAX: 0000000000000001 RBX: ffffa229c21195a0 RCX: ffffa229c2400000 RDX: ffffa229c11c2200 RSI: 000000000000ffff RDI: 0000000000000050 RBP: 000000000000ffff R08: 3fffffffffffdfff R09: ffffffffffffffff R10: 3fffffffffffdfff R11: ffffffff87a60e80 R12: 0000000000000050 R13: 0000000000000000 R14: 000000000000ffff R15: 0000000000100000 FS: 0000000000000000(0000) GS:ffffa22a7661c000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000060 CR3: 000000003ac34002 CR4: 0000000000770ef0 PKRU: 55555554 Call Trace: p9_tag_lookup+0x2b/0x90 p9_xen_response+0x17c/0x2e0 process_one_work+0x16a/0x3a0 worker_thread+0x172/0x2e0 kthread+0xdd/0x110 ret_from_fork+0x18b/0x240 ret_from_fork_asm+0x1a/0x30 Modules linked in: CR2: 0000000000000060 ---[ end trace 0000000000000000 ]--- Reject a response whose size is outside [sizeof(header), queued] before using it, matching the validation the backend already applies to incoming requests. Fixes: f66c72bea129 ("xen/9pfs: receive responses") Cc: stable@vger.kernel.org Signed-off-by: Yehyeong Lee Reviewed-by: Juergen Gross Message-ID: <20261005125640.274054-1-yhlee@isslab.korea.ac.kr> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 78ad4413fab0cbd42c7280b5069ed2dd3f039162 Author: Yu Zhang Date: Wed Oct 14 11:37:46 2026 +1000 scsi: target: Fix demo-mode dynamic ACL dev-entry UAF vs LUN teardown [ Upstream commit 6a6e7d7230cd4e0a6c003bae5b85bf37a1e77b94 ] A demo-mode (generate_node_acls=1) login that allocates a dynamic NodeACL populates that ACL's per-LUN dev entries in core_tpg_add_node_to_devs() *before* the ACL is linked onto tpg->acl_node_list by target_add_node_acl(): core_tpg_check_initiator_node_acl(): ... core_tpg_add_node_to_devs(acl, tpg, NULL); /* builds deves */ target_add_node_acl(acl); /* only now listed */ The LUN teardown sweep, core_clear_lun_from_tpg(), enumerates only tpg->acl_node_list, so a dev entry whose ACL is still in the window above is invisible to the sweep and is never disabled. It is left on the se_lun->lun_deve_list after core_tpg_remove_lun() frees the se_lun; when the same unpacked_lun is later re-added and the se_lun is reallocated at the same address, the stale dev entry is rediscovered by target_nacl_find_deve() and core_enable_device_list_for_node() corrupts lun_deve_list: BUG: KASAN: slab-use-after-free ... core_enable_device_list_for_node+0x5ce/0x880 core_tpg_add_node_to_devs+0x169/0x190 core_dev_add_lun+0x146/0x190 target_fabric_port_link+0xe9/0x1b0 configfs_symlink+0x381/0xae0 __x64_sys_symlink+0x55/0x80 The demo-mode login path that drives the ACL/dev-entry creation is reachable by an unauthenticated initiator; the colliding LUN add/remove is a local configfs operation. Commit 49cb77e297dc ("target: Avoid mappedlun symlink creation during lun shutdown") introduced se_lun->lun_shutdown and guarded the *explicit* ACL MappedLUN path (target_fabric_mappedlun_link()), but the demo-mode automatic path, core_tpg_add_node_to_devs() -> core_enable_device_list_for_node(), was never given the equivalent guard, and the publish-after-populate ordering in core_tpg_check_initiator_node_acl() was left unchanged. Fix it in three cooperating parts: 1) Publish the dynamic NodeACL onto acl_node_list *before* creating its dev entries, so the teardown sweep can observe them. 2) Refuse to attach a dev entry to an se_lun that is shutting down, checked under nacl->lun_entry_mutex -- the same lock the sweep takes -- so once the sweep has passed an ACL any later enable for that LUN observes lun_shutdown and skips it. 3) In core_enable_device_list_for_node(), insert the new dev entry onto lun->lun_deve_list while still holding nacl->lun_entry_mutex, in both the replace and the new-entry branch. Previously the entry was added to nacl->lun_entry_hlist under the mutex but to lun->lun_deve_list only after dropping it; with the ACL now published early, the sweep could take the mutex in that gap, find the entry on the hlist, core_disable_device_list_for_node() it (list_del() on the not-yet- linked lun_link succeeds and the entry is freed), and then the enable would list_add_tail() the freed entry back onto lun_deve_list. Linking both lists under the mutex makes enable and the sweep mutually exclusive, closing that window. core_tpg_add_node_to_devs() already ignores the return value of core_enable_device_list_for_node(), so a shutting-down LUN is simply skipped. Cc: stable@vger.kernel.org Fixes: 49cb77e297dc ("target: Avoid mappedlun symlink creation during lun shutdown") Signed-off-by: Yu Zhang Tested-by: Yu Zhang Link: https://patch.msgid.link/20261014013746.46705-1-yuz08559@gmail.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Sasha Levin commit dab8971b78d13d0aaca40e96feb6188b85d3c752 Author: Andrew Luebke Date: Mon Oct 26 10:20:32 2026 -0700 scsi: aic79xx: Fix NULL pointer dereference in device reset [ Upstream commit f057a8bfeb6ff89c65e95540b8700a53c66d4a31 ] Since commit c67e63800446 ("scsi: aic79xx: Do not reference SCSI command when resetting device") the device reset SCB has no SCSI command, but ahd_linux_dev_reset() still sets its residual, and ahd_abort_scbs(), which completes it, sets its status. Seen on an AIC-7902 when a failing disk triggered a device reset, which killed the SCSI error handler: BUG: kernel NULL pointer dereference, address: 0000009c EIP: ahd_linux_dev_reset.cold+0xee/0x26e Add NULL command checks to the accessors in aic79xx_osm.h. Also skip autosense for an SCB without a command and complete it with ahd_done() right away: the REQUEST SENSE path can clear SCB_DEVICE_RESET, after which ahd_done() would dereference the missing command. Fixes: c67e63800446 ("scsi: aic79xx: Do not reference SCSI command when resetting device") Cc: stable@vger.kernel.org Reviewed-by: Hannes Reinecke Signed-off-by: Andrew Luebke Assisted-by: LLM Link: https://patch.msgid.link/20261026172032.749756-1-andrew.luebke@gmail.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Sasha Levin commit 50a5ebe6b4ea7af73056262d1b65617e237910c8 Author: Imre Kaloz Date: Mon Oct 26 14:14:32 2026 +0100 scsi: aic7xxx: Use default settings on the SGI O2 onboard controllers [ Upstream commit 696bdfc58975fbc70d2e2347a74e0b562e7e2494 ] The SGI O2 firmware runs its onboard aic7880s without the Adaptec BIOS, so scratch RAM holds no settings. The left over BIOS path reads uninitialised bytes, and bad parity panics the boot. Use the defaults there with host ID 0. ahc_init() keeps the default host ID ahc_pci_config() chose, 7 on other PCI controllers, so only the O2 changes. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Imre Kaloz Link: https://patch.msgid.link/20261026131432.26065-1-kaloz@kernel.org Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Sasha Levin commit e465b8f50337d0fb3b9753be6cb9fcac79800046 Author: Fourie Zhang Date: Thu Oct 22 10:26:22 2026 +0800 xfrm4: use a full socket for local errors [ Upstream commit 5def91015ba7b59de62a81384572da7281b8a033 ] xfrm4_local_error() passes skb->sk to inet_sk() and ip_local_error() without ensuring it points to a full socket. TCP SYN-ACK skbs can be owned by TCP_NEW_SYN_RECV request sockets. xfrm4_tunnel_check_size() already checks sk_fullsock() since commit 1620c88887b1 ("xfrm: Fix the usage of skb->sk"), so iptfs_is_too_big() is the only remaining IPv4 caller passing a request socket here: the sk it tests is the listener, while skb->sk is the request socket. When IP-TFS rejects such an skb because it exceeds its payload MTU, the local error path treats the request socket as a struct inet_sock. KASAN reports a slab-out-of-bounds read in ip_local_error() beyond the request_sock_TCP allocation. Resolve the skb owner with skb_to_full_sk() before accessing inet_sock state or reporting the error. This maps a request socket to its listener and rejects sockets that cannot be used as full sockets, matching what commit 6973a21ee73c ("ipv6: xfrm: use full sockets in local error paths") did for xfrm6_local_error(). Fixes: 0e4fbf013fa5 ("xfrm: iptfs: add user packet (tunnel ingress) handling") Cc: stable@vger.kernel.org Reported-by: TencentOS Corvus AI Link: https://lore.kernel.org/netdev/20260908224856.1591189-1-kuba@kernel.org/ Reviewed-by: Eric Dumazet Assisted-by: tencentos-corvus-ai:hy4-preview Signed-off-by: Fourie Zhang Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin commit 03a00b6be3cec2e701e05c877cc210f4555d8b2e Author: Toke Høiland-Jørgensen Date: Fri Oct 23 13:00:51 2026 +0200 wifi: mac80211: reinstate IEEE80211_TX_CTL_AMPDU flag in ieee80211_tx_prep_agg() [ Upstream commit 25e73f1d6868c759c8eb56cad4e411692c5341b4 ] The commit 592234e941f1 ("wifi: mac80211: Fix iTXQ AMPDU fragmentation handling") changed the way handling of the IEEE80211_TX_CTL_AMPDU flag is done in mac80211, so the only place it is set is in ieee80211_tx_dequeue(). This means that any frames that are sent to the driver via drv_tx() will no longer have the flag set. In particular, this affects packets going through ieee80211_tx_pending(). Evan reported that this can result in the ath9k driver failing to account such packets in its block ack window, eventually overrunning the window and stalling TX. Fix this by reinstating the flag in ieee80211_tx_prep_agg() when inside a valid block ack window. This should be harmless for the TXQ path, and will reinstate the previous behaviour for drivers that use the flag as a signal to track the packet in the window. Fixes: 592234e941f1 ("wifi: mac80211: Fix iTXQ AMPDU fragmentation handling") Cc: stable@vger.kernel.org Reported-by: Evan Severson Link: https://lore.kernel.org/all/20261014025734.2288693-1-eseverson@gmail.com/ Signed-off-by: Toke Høiland-Jørgensen Tested-by: Evan Severson Link: https://patch.msgid.link/20261023110052.650519-1-toke@toke.dk Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin commit 8c5b1e309ddf50a14a7cd4068b8ca4de90d9fa0b Author: Eric Biggers Date: Wed Oct 21 22:44:50 2026 -0700 lib/crypto: mips: Disable Octeon SHA code on little-endian kernels [ Upstream commit dd2a4edb26e1c78823c50ba10c42f2d3de2e5ec4 ] Kernels built for the MIPS64-based Cavium Octeon SoCs are normally big-endian, but little-endian builds are also supported. Currently, the SHA-1, SHA-256, and SHA-512 code using the Octeon crypto co-processor is enabled in both builds. This code is untestable without the hardware. However, based on the code itself, it is implausible that it computes hash values correctly in little-endian builds. Such builds write many incorrect values to COP2: - SHA-1 and SHA-256: The 64-bit integer that contains the last two 32-bit message words of each block is written to COP2 entirely byte-reflected, due to missing endianness conversion in octeon_sha1_start() and octeon_sha256_start() to compensate for using native 64-bit loads from the message bytes. This differs from all the earlier message words which are written correctly. Furthermore, the state is written to COP2 with each 32-bit word byte-reflected within each 64-bit integer, due to incorrect use of 64-bit endianness conversion in write_octeon_64bit_hash_dword() when the state is kept in memory in native-endian 32-bit words. - SHA-512: All the 64-bit message words are written to COP2 byte-reflected, due to missing endianness conversion in write_octeon_64bit_block_sha512() and octeon_sha512_start(). The SHA-512 state words seem to be written correctly. Big-endian kernels aren't affected by these bugs. These bugs also aren't new; this code has been broken on little-endian ever since it and Octeon little-endian support were first added in v4.1. Commit d2a948d2db68 ("MIPS: Octeon: Make octeon-md5 driver endian-agnostic") made the MD5 code work on little-endian kernels by adding 64-bit endianness conversions to the COP2 macros used by MD5 (some of which are shared by SHA-1 and SHA-256, despite those algorithms keeping the state words in native-endian instead of MD5's little-endian, causing some of the strange behavior described above). However, SHA-1, SHA-256, and SHA-512 were never fixed to work on little-endian kernels. Therefore, disable the Octeon SHA-1, SHA-256, and SHA-512 code in little-endian kernels. This causes the generic code that actually computes hash values correctly to be used instead. Fixes: 82be2dcfa6a1 ("crypto: octeon - add SHA1 module") Fixes: c3d0def62001 ("crypto: octeon - add SHA256 module") Fixes: fbaa4dfd51a0 ("crypto: octeon - add SHA512 module") Cc: stable@vger.kernel.org Acked-by: Ard Biesheuvel Link: https://patch.msgid.link/20261022054450.20746-1-ebiggers@kernel.org Signed-off-by: Eric Biggers Signed-off-by: Sasha Levin commit 6bdd3a24acae6a5f888cca9c148a5c8175f1c5b0 Author: Maíra Canal Date: Sun Oct 4 12:42:02 2026 -0300 drm/vc4: Drop the BO reservations outside of job_lock [ Upstream commit 8ef66514d7b993c9fb96a5886f001e3556610c1c ] vc4_queue_submit() calls drm_exec_fini() with job_lock held and interrupts disabled. Besides unlocking the reservations, drm_exec_fini() frees the object array with kvfree(), which asks for preemptible task context or a non-NMI interrupt, and may reach might_sleep() through vfree(). Considering that an array that exceeds a page can take the vmalloc fallback, call drm_exec_fini() once job_lock is dropped. The reservations are then held across the job kick, which is harmless as nothing in the completion path takes a BO reservation. Note that vc4_attach_fences() has to stay inside the critical section, as it walks exec, which the job done worker is free to release as soon as job_lock is dropped. Cc: stable@vger.kernel.org Fixes: 04630796c437 ("drm/vc4: Use DRM Execution Contexts") Reviewed-by: Iago Toral Quiroga Link: https://patch.msgid.link/20261004-vc4-misc-fixes-v1-2-b763df9e33e1@igalia.com Signed-off-by: Maíra Canal Signed-off-by: Sasha Levin commit e16cc0843946e998b6dc6c4b41fee8d9e324ccec Author: Maíra Canal Date: Sun Oct 4 12:42:01 2026 -0300 drm/vc4: Publish the output fence outside of job_lock [ Upstream commit 9ee552a42c3905b4547e83173d46413137ec329a ] job_lock is taken by the V3D interrupt handler, so nesting an IRQ-unsafe lock under it creates an inversion. drm_syncobj_replace_fence() takes drm_syncobj::lock, which other paths acquire with interrupts enabled. For example, a thread interrupted while holding it blocks the handler on job_lock, and the handler can only make progress once the submit path releases job_lock, which it cannot do while waiting for drm_syncobj::lock. This is reported by lockdep: [ 188.139076] ======================================================== [ 188.139086] WARNING: possible irq lock inversion dependency detected [ 188.139096] 7.3.0-rc3-00067-gc4f3feeaf60f #67 Tainted: G C [ 188.139108] -------------------------------------------------------- [ 188.139116] swapper/0/0 just changed the state of lock: [ 188.139125] ffff0000054f8ff8 (&vc4->job_lock){-...}-{3:3}, at: vc4_irq+0xa8/0x28c [vc4] [ 188.139234] but this lock took another, HARDIRQ-unsafe lock in the past: [ 188.139242] (&syncobj->lock){+.+.}-{3:3} [ 188.139256] and interrupts could create inverse lock ordering between them. [ 188.139267] other info that might help us debug this: [ 188.139275] Possible interrupt unsafe locking scenario: [ 188.139284] CPU0 CPU1 [ 188.139291] ---- ---- [ 188.139299] lock(&syncobj->lock); [ 188.139312] local_irq_disable(); [ 188.139320] lock(&vc4->job_lock); [ 188.139335] lock(&syncobj->lock); [ 188.139350] [ 188.139358] lock(&vc4->job_lock); [ 188.139372] *** DEADLOCK *** Hand the fence over after job_lock is dropped. The job can complete and drop exec->fence in that window, so take a reference first and publish through the local pointer, as exec may already be gone. Cc: stable@vger.kernel.org Fixes: e84fcb95e074 ("drm/vc4: Export fence through syncobj") Reviewed-by: Iago Toral Quiroga Link: https://patch.msgid.link/20261004-vc4-misc-fixes-v1-1-b763df9e33e1@igalia.com Signed-off-by: Maíra Canal Signed-off-by: Sasha Levin commit 73ec0cd32c6ad7afda1ee35f3eca4ff85b882907 Author: Zijing Yin Date: Thu Oct 15 06:31:57 2026 -0700 wifi: cfg80211: fix out-of-bounds read in valid_rule() [ Upstream commit 9d8ec0b5b5295bd23d979d1b2b905de25c36fff2 ] valid_rule() validates a struct fwdb_rule from the regulatory database firmware file, but bounds checks only the first byte of the structure, the length field itself. It then uses that length, which comes straight out of the file, to decide whether the optional fields are present, and reads rule->wmm_ptr at offset 18 of the 20-byte structure once the length claims 20 bytes or more. A rule placed in the last bytes of the file therefore makes the parser read up to 19 bytes past the end of the firmware image. The image comes from vmalloc() in kernel_read_file(), so with the rule at the end of a page the read falls into the guard page and oopses, with no memory debugging enabled. A length of at least offsetofend(max_bw) but below offsetofend(wmm_ptr) takes the other branch, so valid_rule() returns true having read nothing out of bounds, and the database is accepted. regdb_query_country() does not re-check the rule, and reads rule->start, rule->end, rule->max_bw and rule->cac_timeout off the end of the kmemdup()ed copy. A malformed regulatory.db is parsed by cfg80211's own request_firmware_nowait() at init time, and on demand from user space through NL80211_CMD_RELOAD_REGDB, which needs CAP_NET_ADMIN but no wireless hardware. Both paths require write access to the firmware search path and CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=n. Bound the whole declared rule, not just its length field. The existing check on sizeof(rule->len) is still needed, since rule->len has to be shown to be inside the file before it can be read, so the new test goes after it. A rule reaching past the end of the file is now rejected, which fails the database rather than reading out of bounds. That also gives regdb_query_country() the bound it already assumes. Fixes: 230ebaa189af ("cfg80211: read wmm rules from regulatory database") Cc: stable@vger.kernel.org Signed-off-by: Zijing Yin Link: https://patch.msgid.link/20261015133159.1499728-1-yzjaurora@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin commit a2afdca7efb24989122771f94cccf2312d0f2720 Author: Alex Kazinsky Date: Thu Oct 15 11:20:05 2026 +0400 wifi: rsi: Skip TX aggregation setup for non-QoS frames [ Upstream commit 71f756a4c064b0312f46617c20893ecc17c332e4 ] When transmitting a non-QoS unicast frame to a station in AP mode, rsi_core_xmit() assigns IEEE80211_NONQOS_TID (16) to tid. The station lookup succeeds, allowing tid to index start_tx_aggr[], which has only IEEE80211_NUM_TIDS (16) elements. This causes an out-of-bounds read and, if the value read is zero, an out-of-bounds write. Only access the aggregation state for tids below IEEE80211_NUM_TIDS, excluding the non-QoS sentinel from TX aggregation setup. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 19844c0a9a19 ("rsi: data and managemet path changes for AP mode") Cc: stable@vger.kernel.org Signed-off-by: Alex Kazinsky Link: https://patch.msgid.link/20261015072010.742369-1-a.kazinsky@ideco.ru Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin commit 6e5c5cd178316c8aa9848c8b5d5f9566e9f5adba Author: Jason Perlow Date: Wed Oct 21 22:52:38 2026 +0530 wifi: brcmfmac: map msgbuf RX packet IDs bidirectional [ Upstream commit 7ed5dce55fa8393972b1bf2bf5af1c818c5e7dc2 ] Commit f0ba5fd51ff2 ("wifi: brcmfmac: Set DMA direction for msgbuf packet IDs") maps the RX packet ID buffers DMA_FROM_DEVICE. The BCM4364 firmware also reads posted RX buffers, so with VT-d translation enabled every such read faults ("PTE Read access is not set") and the firmware crashes and resets in a loop. Map the RX pool DMA_BIDIRECTIONAL again, as before that commit. TX keeps DMA_TO_DEVICE. Fixes: f0ba5fd51ff2 ("wifi: brcmfmac: Set DMA direction for msgbuf packet IDs") Cc: stable@vger.kernel.org Signed-off-by: Jason Perlow Signed-off-by: Aditya Garg Acked-by: Arend van Spriel Link: https://patch.msgid.link/20261021172238.10004-1-aditya.garg@linux.dev Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin commit 5251ad1a6caa35e6d8378aadb909d3f0a675f321 Author: Weigang He Date: Thu Oct 22 01:58:07 2026 +1100 wifi: mac80211: reload TDLS header pointer after skb_linearize() [ Upstream commit 35c5a5ea4418571997a7e7af3e7e8922b136f6e6 ] ieee80211_process_tdls_channel_switch() sets tf = skb->data before it calls skb_linearize(), and reads tf->action_code afterwards. ieee80211_rx_h_data() queues TDLS channel switch requests and responses to the interface after pulling only offsetof(struct ieee80211_tdls_data, u) bytes, so the skb can still be non-linear when the interface work handles it. Drivers that build paged RX skbs do this for every frame that does not fit into the skb head, e.g. iwlwifi (mvm), which is also the only mac80211 driver that sets NL80211_FEATURE_TDLS_CHANNEL_SWITCH. If the remaining data does not fit into the tailroom, skb_linearize() moves the data to a new head and frees the old one, and the action code is then read from freed memory. Depending on what that memory holds by then, the frame is handled as before or ends in the WARN_ON_ONCE() of the default case. The frame only has to be a data frame with the TDLS ethertype from an authorized peer, e.g. relayed by the AP from another station in the BSS; the read happens before the sender is checked to be a TDLS peer. Load tf after skb_linearize(), as the request and response handlers already do. Found by static analysis tool CodeQL. Fixes: 8a4d32f30d11 ("mac80211: add TDLS channel-switch Rx flow") Cc: stable@vger.kernel.org Assisted-by: LLM codeql Signed-off-by: Weigang He Link: https://patch.msgid.link/20261021145807.3018338-1-geoffreyhe2@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin commit 83e8acf5efbc6f31beb0938654c61ae61b6fbf02 Author: Yili Zhang Date: Thu Sep 24 14:55:08 2026 +0800 dma-buf: Fix IOVA offset when linking phys vecs to sgt [ Upstream commit d57e3a7d880d783c64aa29457d78b0e3c5a40e3c ] The dma_buf_phys_vec_to_sgt() routine links every physical range into the allocated IOVA space at offset zero instead of advancing the offset by the already mapped length. This breaks the THRU_HOST_BRIDGE flow whenever phys_vec contains more than one entry: the second and subsequent dma_iova_link() calls try to install mappings on top of PTEs that already exist, which fails and makes the whole conversion return an error. Fix it by passing the accumulated mapped_len as the IOVA offset. This matches the pattern used by all other dma_iova_link() callers and is consistent with the rest of the function: dma_iova_sync() and the error path in dma_iova_destroy() both operate on the [0, mapped_len) prefix of the IOVA space, which assumes that the ranges were linked contiguously starting at offset 0. Fixes: 3aa31a8bb11e ("dma-buf: provide phys_vec to scatter-gather mapping routine") Cc: stable@vger.kernel.org Signed-off-by: Yili Zhang Reviewed-by: Dawid Osuchowski Reviewed-by: Leon Romanovsky Link: https://lore.kernel.org/r/20260924065508.27245-1-zhangyili01@baidu.com Signed-off-by: Christian König Signed-off-by: Sasha Levin commit 84b31b9b294ac2f41fc7720444b9171e62562e6f Author: André Draszik Date: Tue Jul 21 09:21:27 2026 +0100 drm/drm_crtc: fix race with dma_fence_signal() in ::get_driver_name() [ Upstream commit cb104d395da48d965665fefe8502f71b6e7e3733 ] Since commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"), I'm seeing the BUG_ON() triggering in drm_crtc's fence_to_crtc() via drm_crtc_fence_get_driver_name() regularly: Call trace: panic+0x58/0x5c die+0x160/0x178 bug_brk_handler+0x70/0xa4 call_el1_break_hook+0x3c/0x1a0 do_el1_brk64+0x24/0x74 el1_brk64+0x34/0x54 el1h_64_sync_handler+0x80/0xfc el1h_64_sync+0x84/0x88 drm_crtc_fence_get_driver_name+0x60/0x68 (P) sync_file_get_name+0x184/0x45c sync_file_ioctl+0x404/0xf70 __arm64_sys_ioctl+0x124/0x1dc This looks to be caused by a code flow similar to the following: +++ snip +++ thread A thread B ioctl(SYNC_IOC_FILE_INFO) sync_file_ioctl() sync_file_get_name() dma_fence_signal_timestamp_locked() dma_fence_driver_name() ops = rcu_dereference(fence->ops) if (!dma_fence_test_signaled_flag()) ops->get_driver_name(fence) i.e. drm_crtc_fence_get_driver_name() test_and_set_bit(SIGNALED) RCU_INIT_POINTER(fence->ops, NULL) drm_crtc_fence_get_driver_name() BUG_ON(rcu_access_pointer(fence->ops) != &drm_crtc_fence_ops) +++ snap +++ In other words, a fence's ops pointer can now change to NULL on signal, which wasn't the case before the culprit commit and hence the BUG_ON() triggers. Simply drop the BUG_ON() as it's usage of fence ops is invalid now, and because using BUG_ON() and friends to take down the system is an unacceptable way to handle a failure. Note that the adjacent drm_crtc_fence_get_timeline_name() has the same problem and is fixed by this patch as well. Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3") Cc: stable@vger.kernel.org Signed-off-by: André Draszik Reviewed-by: Philipp Stanner Reviewed-by: Christian König Signed-off-by: Christian König Link: https://lore.kernel.org/r/20260721-linux-drm_crtc_fix2-v3-2-afa8c71506e6@linaro.org Signed-off-by: Sasha Levin commit f8e6f4deb868fd9da3eda95db222609ab1edc18d Author: André Draszik Date: Tue Jul 21 09:21:26 2026 +0100 drm/drm_crtc: ensure dma_fence_ops remain valid during device unbind [ Upstream commit 3be436cbd3d265fe4fcfbb5b650edad7b2108443 ] In [1], sashiko reported the following issue: === snip === Looking at how these fences are managed, drm_crtc_create_fence() creates a dma_fence without taking a reference to the drm_device or drm_crtc. Because the sync_file framework exposes this fence to userspace, the fence can outlive the CRTC. The dma_fence contract requires that data accessed by dma_fence_ops (like get_driver_name) must remain valid for an RCU grace period after the fence is signaled. However, drm_crtc_cleanup() and the subsequent freeing of the device do not wait for an RCU grace period via synchronize_rcu(). If userspace calls ioctl(SYNC_IOC_FILE_INFO) concurrently with a device hot-unplug: CPU1 (Userspace) sync_file_get_name() ops = rcu_dereference(fence->ops); if (!dma_fence_test_signaled_flag()) // Preempted or delayed here CPU2 (Driver Teardown) Signals the fence (setting fence->ops = NULL) Destroys and frees the CRTC without waiting for an RCU grace period CPU1 (Resumes) ops->get_driver_name(fence) -> drm_crtc_fence_get_driver_name() crtc = fence_to_crtc(fence); // Casts to the freed CRTC return crtc->dev->driver->name; // Use-after-free ... Does the CRTC or DRM device need to be kept alive for the RCU grace period, or should the fence hold a proper reference to prevent the use-after-free when get_driver_name() and get_timeline_name() access the freed CRTC structure? === snap === I believe this to be a correct observation and this patch implements the suggestion of waiting for an RCU grace period before proceeding with destruction of the drm_crtc, so that get_driver_name() and get_timeline_name() can still work. Link: https://sashiko.dev/#/patchset/20260618-linux-drm_crtc_fix2-v1-1-c03e77b36f34@linaro.org?part=1 Fixes: 6d6003c4b613 ("drm/fence: add fence timeline to drm_crtc") Cc: stable@vger.kernel.org Signed-off-by: André Draszik Reviewed-by: Philipp Stanner Reviewed-by: Christian König Link: https://lore.kernel.org/r/20260721-linux-drm_crtc_fix2-v3-1-afa8c71506e6@linaro.org Signed-off-by: Christian König Signed-off-by: Sasha Levin commit 5a9230cfe7b5de8c2ab4cdabafaaae6357c4b707 Author: Devin Wittmayer Date: Thu Oct 15 22:27:21 2026 -0700 drm/panic: Fix kmsg screen hang on a long log line [ Upstream commit 1ba6405638439a4214783965538b0196c8de8a5b ] The kmsg panic screen reads the log back one chunk at a time. A record that does not fit in a chunk comes back empty without moving on, so the screen asks for it again forever and the panic never finishes. Every oops logs the list of loaded modules, and on my machine that list does not fit. Read into a buffer the size printk formats one record into, and stop if a read still comes back empty. Fixes: 54034bebb22f ("drm/panic: Add a kmsg panic screen") Cc: stable@vger.kernel.org Signed-off-by: Devin Wittmayer Reviewed-by: Jocelyn Falempe Link: https://patch.msgid.link/20261016052722.60051-1-lucid_duck@justthetip.ca Signed-off-by: Jocelyn Falempe Signed-off-by: Sasha Levin commit 3eac7cf352cedd05215bdc7e9786c3ee4b4b43b2 Author: Sabrina Dubroca Date: Thu Oct 8 14:38:32 2026 +0200 xfrm: espintcp: reorder operations within espintcp_init_sk [ Upstream commit f9a11716c8445b496e9fafeec7e8412d384d02e2 ] When enabled on a socket, espintcp sets the socket callbacks to its own before it has finished setting up its context and published it as icsk_ulp_data. Any one of those callbacks that gets called before will dereference a NULL icsk_ulp_data. Fix this by reording the operations, and add memory barriers to ensure callers will have a struct espintcp_ctx available. Add a few WRITE_ONCE/READ_ONCE too while we're there. Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)") Cc: stable@vger.kernel.org Reported-by: Yuan Tan Reported-by: Yifan Wu Reported-by: Juefei Pu Reported-by: Xin Liu Reported-by: Peihan Liu Reported-by: Yilin Zhu Reported-by: Ren Wei Reported-by: Eulgyu Kim Reported-by: Jaeyoung Chung Link: https://lore.kernel.org/all/c30b645074a1b379e0f7fe297f917c66137d9964.1778464688.git.zylzyl2333@gmail.com/ Link: https://lore.kernel.org/all/20260819155349.3555804-1-jjy600901@snu.ac.kr Signed-off-by: Sabrina Dubroca Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin commit 56f9254cb83d93033e449f70cd9b896bbc3c191f Author: Qihang Date: Wed Sep 23 16:41:23 2026 +0800 xfrm: interface: validate the IP header on xmit [ Upstream commit 86de3a1118a16dbbbe5fabe9aa20ffb93c072ed5 ] Packets injected into an xfrm interface (e.g. AF_PACKET on an xfrmi device) reach the xfrm output path without IP header validation, but xfrm4_transport_output() uses iph->ihl for __skb_pull() and memmove() and expects the header to be valid. vti_tunnel_xmit() already calls pskb_inet_may_pull() before handing packets to the xfrm output path. Do the same in xfrmi_xmit() and perform the header checks ip_rcv_core()/ip6_rcv_core() do on entry to the IP stack: reject wrong IP versions and malformed IPv4 header lengths. Fixes: f203b76d7809 ("xfrm: Add virtual xfrm interfaces") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Qihang Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin commit c090c95f747714999a3fdebafa07b663473b7b7b Author: Hyungjung Joo Date: Tue Sep 22 00:26:00 2026 +0200 net/9p/usbg: clear stale client pointer on close [ Upstream commit a478958f4c1181ff3362f8857b489c2d069f9c7d ] p9_usbg_close() tears down the client transport, but usb9pfs keeps using usb9pfs->client from asynchronous TX and RX completion handlers. A late completion can therefore dereference a client that has already been freed during mount teardown. Clear usb9pfs->client under usb9pfs->lock when closing the transport, detach any pending TX request from in_req->context, and make the TX/RX completion handlers bail out once the transport has been detached. This keeps late completions from touching a freed or rebound p9_client. Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Cc: stable@vger.kernel.org Signed-off-by: Hyungjung Joo Signed-off-by: Michael Grzeschik Message-ID: <20260922-usb9pfsfixes-v1-7-9d8dcc52904c@kernel.org> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit b3d262be54f5cfc5f75f7271e94d64a6315cd2f1 Author: Michael Grzeschik Date: Tue Sep 22 00:25:59 2026 +0200 net/9p/usbg: remove bogus context initialization in alloc_requests [ Upstream commit bbdb38b2e543ffa72dca5450f2535cf998ef1cdd ] alloc_requests() initializes usb9pfs->in_req->context to point at the struct f_usb9pfs instance itself. usb9pfs_queue_tx() later overwrites this with the real struct p9_req_t pointer before every transmit, and usb9pfs_tx_complete() clears it back to NULL after each completion, so in_req->context only ever holds a valid p9_req_t once a request has actually been queued. usb9pfs_clear_tx(), however, can run at any time (mount close, gadget disable) independent of whether a request was ever queued. If it runs before the first usb9pfs_transmit(), it reads the leftover sentinel value, type-confuses the struct f_usb9pfs pointer as a struct p9_req_t, and both writes through it (req->t_err = -ECONNRESET) and hands it to p9_client_cb(), which manipulates req->wq and req->refcount at bogus offsets inside f_usb9pfs. This reliably corrupts memory or panics whenever the transport is torn down before any 9p request has been transmitted, e.g. mounting and immediately unmounting, or a cable disconnect racing the very first request. usb9pfs->out_req->context is set the same way but is never read by this transport (usb9pfs_rx_complete() identifies the instance via ep->driver_data instead), so it serves no purpose either. Both endpoints' ->driver_data are already set to usb9pfs in enable_endpoint(), which is what the completion handlers actually use to recover the f_usb9pfs instance. Just drop the leftover ->context assignments; usb_ep_alloc_request()/alloc_ep_req() already return zeroed requests, so in_req->context correctly starts out NULL. Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4.8 Signed-off-by: Michael Grzeschik Message-ID: <20260922-usb9pfsfixes-v1-6-9d8dcc52904c@kernel.org> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 9ea2ffacee886707b8728c6b62d9e9650e2733ec Author: Michael Grzeschik Date: Tue Sep 22 00:25:58 2026 +0200 net/9p/usbg: fix out_req buffer leak in disable_usb9pfs [ Upstream commit 5f9807270c7bda8f86b312ed1a8acd7716600555 ] usb9pfs->out_req is allocated with alloc_ep_req(), which also allocates the request's data buffer (req->buf). disable_usb9pfs() frees it with plain usb_ep_free_request(), which only frees the usb_request structure itself and leaks req->buf on every close. Use free_ep_req() instead, matching the allocator, as documented by its own comment ("Requests allocated via alloc_ep_req() *must* be freed by free_ep_req()"). Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4.8 Signed-off-by: Michael Grzeschik Message-ID: <20260922-usb9pfsfixes-v1-5-9d8dcc52904c@kernel.org> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 277167375d269e411e2c5ce79527ff3ebf57a0bc Author: Michael Grzeschik Date: Tue Sep 22 00:25:57 2026 +0200 net/9p/usbg: call disable_usb9pfs() from usb9pfs_disable() [ Upstream commit cd1988cf723c2eae87112b198bf90b0aebfeaf31 ] usb9pfs_disable() is the usb_function ->disable callback, invoked by the composite gadget core whenever the host resets or unconfigures the gadget. The gadget function API requires this callback to disable its endpoints; every other in-tree function driver does so from its ->disable hook. usb9pfs_disable() never called disable_usb9pfs(), so the IN/OUT endpoints and their usb_request objects were left active and allocated across a host-driven disable. When the host later reconfigures the device, enable_usb9pfs() calls alloc_requests() again and unconditionally overwrites usb9pfs->in_req/out_req, permanently leaking the previous allocations, while the endpoints themselves are left enabled underneath the function's own idea of being disabled. Call disable_usb9pfs() before reinit_completion(&usb9pfs->send), mirroring the same sequence already used in p9_usbg_close(). Placing it before the reinit_completion() also ensures usb_ep_disable() has synchronously flushed any requests still queued in hardware before the completion is reset, closing the same race that motivated resetting the completion here in the first place. Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Assisted-by: Claude:claude-opus-4.8 Cc: stable@vger.kernel.org Signed-off-by: Michael Grzeschik Message-ID: <20260922-usb9pfsfixes-v1-4-9d8dcc52904c@kernel.org> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 56a679b49c0598ec0d051b0f592c978fdc77f5a6 Author: Michael Grzeschik Date: Tue Sep 22 00:25:56 2026 +0200 net/9p/usbg: always reset completion when disconnecting [ Upstream commit 08c6b9f484a406d9d87c5b2580725d2e0597f3b9 ] When some tx or rx transfers were pending while closing the connection, the completion handler could catch one pending completion call. To ensure a normal start when mounting again, we have to reset the completion and flush any pending completions. Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Cc: stable@vger.kernel.org Signed-off-by: Michael Grzeschik Message-ID: <20260922-usb9pfsfixes-v1-3-9d8dcc52904c@kernel.org> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit fe814d4a3a3ecd8962cf8289e0c41061f2935557 Author: Michael Grzeschik Date: Tue Sep 22 00:25:55 2026 +0200 net/9p/usbg: set client to Disconnected on usb9pfs_disable [ Upstream commit 795f8eeca01d1c9ca3d9a450385b7745ace4e53a ] This patch is setting the client status to Disconnected, when the client is still in use. Otherwise a disconnected usb cable would run any use of the mount to faults. Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Cc: stable@vger.kernel.org Signed-off-by: Michael Grzeschik Message-ID: <20260922-usb9pfsfixes-v1-2-9d8dcc52904c@kernel.org> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 3f2f5b01cddeecf36738f5d1f056ea82d1b3290b Author: Michael Grzeschik Date: Tue Sep 22 00:25:54 2026 +0200 net/9p/usbg: also disable endpoints on p9_usbg_close [ Upstream commit f81cdb9164806eb2df1e1c6df402e03bff7dde31 ] The close function has to fully reverse the state change of 9p_create (mount) and the potential call of set_alt(1). This includes to ensure that the usage of the endpoints is not active any more. Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Cc: stable@vger.kernel.org Signed-off-by: Michael Grzeschik Message-ID: <20260922-usb9pfsfixes-v1-1-9d8dcc52904c@kernel.org> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 197f886898325b191147e9015a47f969a2568838 Author: Yizhou Zhao Date: Sun Jun 7 21:01:16 2026 +0800 net/9p/usbg: Fix use-after-free in disable_usb9pfs() [ Upstream commit 6f401e350939442b2ac905f7e5ac952e3802a5d8 ] disable_usb9pfs() frees the IN and OUT usb_request objects before it disables the corresponding endpoints. If either request is still queued, the later usb_ep_disable() call cancels the endpoint queue and the UDC driver can still access the already freed request. With dummy_hcd and KASAN, this is reproducible by queueing the OUT request and then disconnecting the configfs gadget: BUG: KASAN: slab-use-after-free in dummy_disable+0x2b4/0x300 Read of size 8 at addr ffff888009702400 by task sh/1 usb_ep_disable+0x8e/0x1f0 usb9pfs_func_unbind+0x193/0x350 gadget_dev_desc_UDC_store+0x135/0x280 dummy_free_request() also warns because the request is freed while its queue entry is still linked. Disable both endpoints before freeing the request objects. This lets usb_ep_disable() cancel any queued transfers and invoke the completion callback while the request storage is still valid. The request objects are then freed only after they have been removed from the endpoint queues. Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Cc: stable@vger.kernel.org Reported-by: Yizhou Zhao Reported-by: Yuxiang Yang Reported-by: Ao Wang Reported-by: Xuewei Feng Reported-by: Qi Li Reported-by: Ke Xu Assisted-by: GLM:GLM-5.1 Signed-off-by: Yizhou Zhao Acked-by: Michael Grzeschik Message-ID: <20260607130118.16579-1-zhaoyz24@mails.tsinghua.edu.cn> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 7c93625e382b1198dcda6777ba95d70480fff848 Author: Zhao Zhang Date: Sat Jun 20 23:53:03 2026 +0800 9p: fix caches_show() out-of-bounds write [ Upstream commit 2acd800de8827b7cdce8cb5c2c63b8e8608ec8e3 ] The sysfs show handler for /sys/fs/9p/caches appends cache tags with snprintf(buf + count, limit, ...) and then advances count and limit by the return value. This is incorrect for truncation because snprintf() returns the full would-have-been length, not the number of bytes stored. Once the accumulated output exceeds PAGE_SIZE, count can advance past the sysfs buffer and limit can become negative. A later iteration then passes an out-of-bounds destination pointer and an oversized size_t into snprintf(), leading to an out-of-bounds write. Use sysfs_emit_at() for the append instead. It follows the sysfs buffer contract and returns the number of bytes actually stored, so the offset remains bounded even when the output is truncated. Fixes: 86db0c32f16c ("9p: fix /sys/fs/9p/caches overwriting itself") Cc: stable@vger.kernel.org Reported-by: Yuan Tan Reported-by: Zhengchuan Liang Reported-by: Xin Liu Assisted-by: Codex:GPT-5.4 Signed-off-by: Zhao Zhang Co-authored-by: Ren Wei Signed-off-by: Ren Wei Message-ID: Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 3480ece36ed728c2ddda004bc3e2b99bb364765b Author: Yifei Gao Date: Thu Aug 6 14:42:54 2026 +0000 9p/xen: fix refcount leak in p9_xen_response() on wrong tag [ Upstream commit 4d183e6f153245aca2534e372152583b868dd925 ] p9_xen_response() looks up the request for an incoming reply with p9_tag_lookup(), which takes a reference on the returned p9_req_t. When the tag does not resolve to a request in REQ_STATUS_SENT, the function warns and continues the loop without dropping that reference, permanently leaking the p9_req_t and its msize buffers. The reply header, including the tag, is supplied by the backend, so a malicious or buggy 9P backend can leak kernel memory on every crafted response. Drop the reference before continuing. Fixes: 728356dedeff ("9p: Add refcount to p9_req_t") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Yifei Gao Reviewed-by: Stefano Stabellini Message-ID: <20260806144255.4167019-1-gyf161023@gmail.com> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit b8779990399009d73f8d039a149c398a9b879839 Author: Michael Bommarito Date: Sat Jun 27 17:10:12 2026 -0400 9p/trans_virtio: reject mount tags longer than NAME_MAX at probe [ Upstream commit 5bfef2b6dafe83fe2d8d210d54093a8f48cfc97e ] p9_virtio_probe() reads a 16-bit mount tag length (tag_len) from the device config and kzalloc()s tag_len + 1 bytes for chan->tag with no upper bound. A malicious or compromised host can present a tag of up to 65535 bytes; that tag is later copied into the single-page sysfs buffer by p9_mount_tag_show() (memcpy(buf, chan->tag, tag_len + 1)), a host-controlled out-of-bounds write of up to ~64 KiB past the PAGE_SIZE attribute buffer. Reject an overlong tag at probe time. A 9p mount tag is a name-like identifier, so bound it by NAME_MAX (255): that limit is independent of the sysfs/seq_file page size and is far above any legitimate mount tag, which keeps p9_mount_tag_show() safe at the root without hard-coding a seq_file implementation detail. Fixes: 179a5bc4b8cb ("net/9p: use memcpy() instead of snprintf() in p9_mount_tag_show()") Cc: stable@vger.kernel.org Suggested-by: Christian Schoenebeck Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Michael Bommarito Reviewed-by: Christian Schoenebeck Message-ID: <20260627211012.4042372-1-michael.bommarito@gmail.com> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit c005fd8368ab48f5eec0d0984f4a60de0729f30a Author: Chengfeng Ye Date: Sun Aug 2 23:21:48 2026 +0800 net/9p/usbg: clear stale request context after abort [ Upstream commit b58943dd690eb9b76c652e735789937a03f3d30c ] usb9pfs_clear_tx() serializes access to the active TX request with usb9pfs->lock, but leaves in_req->context pointing at the request after p9_client_cb() drops the transport reference. A later teardown path can therefore retrieve the same request after it has been freed: CPU 0 (p9_usbg_close) CPU 1 (usb9pfs_disable) lock(usb9pfs->lock) req = in_req->context p9_client_cb(client, req) p9_req_put(client, req) unlock(usb9pfs->lock) request reaches zero refs kmem_cache_free(req) lock(usb9pfs->lock) req = in_req->context read req->t_err The lock orders the two callbacks, but cannot protect a pointer that remains published after its reference has been released. KASAN reported: BUG: KASAN: slab-use-after-free in usb9pfs_clear_tx+0x166/0x1b0 Read of size 4 at addr ffff88810e7420f4 by task poc/94 Call Trace: usb9pfs_clear_tx+0x166/0x1b0 usb9pfs_disable+0x1d/0x30 reset_config+0x9d/0x200 __composite_disconnect+0xa7/0x140 Allocated by task 93: kmem_cache_alloc_noprof+0x141/0x370 p9_tag_alloc+0x8f/0x5b0 p9_client_prepare_req+0xff/0x350 p9_client_rpc+0x1a5/0xac0 Freed by task 0: slab_free_after_rcu_debug+0xa6/0x1e0 rcu_core+0x50a/0x1850 Last potentially related work creation: kmem_cache_free+0x1db/0x3d0 p9_req_put+0x164/0x1f0 usb9pfs_clear_tx+0x120/0x1b0 p9_usbg_close+0x7e/0x150 Clear in_req->context after the callback while still holding the lock. This matches the consume-and-clear pattern in usb9pfs_tx_complete(), so subsequent teardown calls return without touching the released request. The existing callback and error ordering remain unchanged. Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Cc: stable@vger.kernel.org Signed-off-by: Chengfeng Ye Signed-off-by: Qi Zhang Message-ID: <20260802152148.810390-1-marsy12010123@gmail.com> Acked-by: Michael Grzeschik Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 50d8f2c52093320c70676e9f8af686ff6740abd0 Author: Chengfeng Ye Date: Thu Sep 3 22:57:34 2026 +0800 xfrm: retry inexact policy lookup after node reinsertion [ Upstream commit 868f63c8bfafa9b827168c9126f85264c39c02ec ] An inexact policy lookup first records pointers to candidate hlist heads and then traverses the lists. A concurrent policy insertion can merge inexact tree nodes between those operations: lookup policy insertion ------ ---------------- find inexact candidates save obsolete hlist head write_seqcount_begin(&bin->count) merge inexact tree nodes hlist_del_rcu(&policy->bydst) reinsert policy->bydst in survivor write_seqcount_end(&bin->count) evaluate saved candidate list miss the moved policy The merge immediately reinserts the same hlist node into the surviving tree node. RCU keeps the policy alive, but it does not provide a consistent view while its list node is moved. A lookup that selected the obsolete list can observe it empty. A lookup already traversing a moved policy can instead follow the next pointer rewritten by the reinsertion. Either case can return an incorrect IPsec policy result. The per-bin sequence counter already brackets calls to xfrm_policy_inexact_insert_node(), including node merges. The read side, however, currently validates the counter only while searching an individual rb-tree. A successful search returns without validation, and the later candidate-list traversal is outside that read-side section. Snapshot the per-bin sequence before discovering candidate heads and validate it after evaluating all candidate lists. Retry the lookup if the inexact policy tree changes while it is being searched. Fixes: 9cf545ebd591 ("xfrm: policy: store inexact policies in a tree ordered by destination address") Cc: stable@vger.kernel.org Signed-off-by: Chengfeng Ye Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin commit d6c21f5678f622030eac1264251e900e81eaac8d Author: Yizhou Zhao Date: Sun Jun 7 20:19:04 2026 +0800 net/9p/usbg: fix prefix matching in device lookup [ Upstream commit 9ee83ef8d24f11feb55fd0d222c0ec19f09dbd3f ] p9_usbg_create() matches the mount source against registered usb9pfs instance tags with strncmp() and the length of the caller supplied source. That accepts any prefix of the registered tag. For example, a gadget instance tagged "secret_channel" can be selected with "s", "sec", or any other non-empty prefix. Once selected, the instance is marked in use and the client is attached to that transport. This differs from the configfs tag lookup path, which uses strcmp() and therefore requires an exact tag match. Require an exact tag match in p9_usbg_create() as well. Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport") Cc: stable@vger.kernel.org Reported-by: Yizhou Zhao Reported-by: Yuxiang Yang Reported-by: Ao Wang Reported-by: Xuewei Feng Reported-by: Qi Li Reported-by: Ke Xu Assisted-by: GLM:GLM-5.1 Signed-off-by: Yizhou Zhao Co-developed-by: Jackie Liu Signed-off-by: Jackie Liu Message-ID: <20260607121907.12588-1-zhaoyz24@mails.tsinghua.edu.cn> Message-ID: <20260719040346.88295-1-liu.yun@linux.dev> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit e83b64696aa04c60cff04d74960026badec17d6d Author: Stefano Garzarella Date: Fri Jul 3 12:22:54 2026 +0200 9p: fix privport option setting wrong RDMA field [ Upstream commit 7fb9bd3659051ff74a29387de0023bb8300e4aa7 ] While reviewing a patch adding vsock transport to 9p, I noticed that since commit 1f3e4142c0eb ("9p: convert to the new mount API"), the Opt_privport case incorrectly sets rdma_opts->port instead of rdma_opts->privport, so mounting with the privport option overwrites the RDMA port number instead of enabling privileged port usage. Fixes: 1f3e4142c0eb ("9p: convert to the new mount API") Cc: stable@vger.kernel.org Cc: sandeen@redhat.com Signed-off-by: Stefano Garzarella Acked-by: Eric Sandeen Message-ID: <20260703102254.114446-1-sgarzare@redhat.com> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin commit 3e1b2b2e77d5f196e53a79aee8c43cc1dd806069 Author: SJ Park Date: Sun Nov 8 16:57:24 2026 -0800 mm/damon/sysfs-schemes: read sysfs_filter->sz_range only once [ Upstream commit af19aff38d6faea35b10f26cca32d0e54f8aea5e ] DAMON sysfs interface reads the user-provided size range arguments for hugepage_size type DAMOS filter twice. Once for validation, and once again for assignments to the variable that will be passed to the core layer. If the user updates the arguments in parallel, an invalid size range could be passed to the core layer. Avoid it by doing the assignments first, and then validating the assigned variables before passing those to the core layer. User impact of the bug should be trivial. From the core layer's perspective, the invalid size range is not really invalid. It just works as having a weird size range. No critical issues such as a crash or a leak could happen. And sane users ain't do such parallel arguments update anyway. If they do, such racy behavior is arguably somewhat expected and deserved. That said, there is no reason to keep such races. Link: https://lore.kernel.org/20260914142327.92510-3-sj@kernel.org Fixes: ea1f204ba29a ("mm/damon/sysfs-schemes: add files for setting damos_filter->sz_range") Signed-off-by: SJ Park Signed-off-by: Andrew Morton Cc: Brendan Higgins Cc: David Gow Cc: Usama Arif Cc: Signed-off-by: SJ Park Signed-off-by: Sasha Levin commit f7d98fa96c949f82ab471be6422a1d56902b109a Author: Ricardo Ribalda Date: Mon Nov 9 09:27:07 2026 +0000 media: uvcvideo: Force UVC version for Avermedia GC515 [ Upstream commit 65444446f0c595c0e250368cde88735b59ccc446 ] The device announces itself as UVC 1.5, but it only accepts UVC 1.1 controls. The camera can probably be handled by the automatic uvc_version handler, but it is more correct to add a quirk and keep some tracking of what vendors are more or less compliant. Also it might be more robust if we introduce more UVC version-dependent code. Bus 003 Device 021: ID 07ca:1515 AVerMedia Technologies, Inc. X'tra Go GC515 Negotiated speed: High Speed (480Mbps) Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 [unknown] bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x07ca AVerMedia Technologies, Inc. idProduct 0x1515 X'tra Go GC515 bcdDevice 0.10 iManufacturer 1 AVerMedia iProduct 2 X'tra Go GC515 iSerial 3 5313180000221 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 0x03fd bNumInterfaces 4 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 500mA Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 0 bInterfaceCount 2 bFunctionClass 14 Video bFunctionSubClass 3 Video Interface Collection bFunctionProtocol 0 iFunction 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 1 Video Control bInterfaceProtocol 1 iInterface 0 VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 1 (HEADER) bcdUVC 1.50 wTotalLength 0x0059 dwClockFrequency 30.000000MHz bInCollection 1 baInterfaceNr( 0) 1 VideoControl Interface Descriptor: bLength 18 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 1 wTerminalType 0x0201 Camera Sensor bAssocTerminal 0 iTerminal 0 wObjectiveFocalLengthMin 0 wObjectiveFocalLengthMax 0 wOcularFocalLength 0 bControlSize 3 bmControls 0x00000000 VideoControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 3 (OUTPUT_TERMINAL) bTerminalID 2 wTerminalType 0x0101 USB Streaming bAssocTerminal 0 bSourceID 4 iTerminal 0 VideoControl Interface Descriptor: bLength 7 bDescriptorType 36 bDescriptorSubtype 4 (SELECTOR_UNIT) bUnitID 3 bNrInPins 1 baSource( 0) 1 iSelector 0 VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 5 (PROCESSING_UNIT) bUnitID 4 bSourceID 3 wMaxMultiplier 0 bControlSize 3 bmControls 0x00000000 iProcessing 0 bmVideoStandards 0x00 VideoControl Interface Descriptor: bLength 29 bDescriptorType 36 bDescriptorSubtype 6 (EXTENSION_UNIT) bUnitID 5 guidExtensionCode {55be8e1c-2fdb-4f7a-bd8d-b9b1108d20c3} bNumControls 24 bNrInPins 1 baSourceID( 0) 4 bControlSize 4 bmControls( 0) 0xff bmControls( 1) 0xff bmControls( 2) 0xff bmControls( 3) 0x00 iExtension 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x85 EP 5 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 VideoControl Endpoint Descriptor: bLength 5 bDescriptorType 37 bDescriptorSubtype 3 (EP_INTERRUPT) wMaxTransferSize 64 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 2 Video Streaming bInterfaceProtocol 1 iInterface 0 VideoStreaming Interface Descriptor: bLength 16 bDescriptorType 36 bDescriptorSubtype 1 (INPUT_HEADER) bNumFormats 3 wTotalLength 0x0303 bEndpointAddress 0x81 EP 1 IN bmInfo 0 bTerminalLink 2 bStillCaptureMethod 1 bTriggerSupport 0 bTriggerUsage 0 bControlSize 1 bmaControls( 0) 4 bmaControls( 1) 4 bmaControls( 2) 0 VideoStreaming Interface Descriptor: bLength 28 bDescriptorType 36 bDescriptorSubtype 16 (FORMAT_FRAME_BASED) bFormatIndex 1 bNumFrameDescriptors 8 guidFormat {34363248-0000-0010-8000-00aa00389b71} bBitsPerPixel 24 bDefaultFrameIndex 1 bAspectRatioX 0 bAspectRatioY 0 bmInterlaceFlags 0x00 Interlaced stream or variable: No Fields per frame: 2 fields Field 1 first: No Field pattern: Field 1 only bCopyProtect 1 bVariableSize 1 VideoStreaming Interface Descriptor: bLength 62 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 1 bmCapabilities 0x01 Still image supported wWidth 1920 wHeight 1080 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 9 dwBytesPerLine 0 dwFrameInterval( 0) 83333 dwFrameInterval( 1) 83416 dwFrameInterval( 2) 166666 dwFrameInterval( 3) 166833 dwFrameInterval( 4) 200000 dwFrameInterval( 5) 333333 dwFrameInterval( 6) 333667 dwFrameInterval( 7) 400000 dwFrameInterval( 8) 416666 VideoStreaming Interface Descriptor: bLength 42 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 2 bmCapabilities 0x01 Still image supported wWidth 3840 wHeight 2160 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 333333 bFrameIntervalType 4 dwBytesPerLine 0 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 333667 dwFrameInterval( 2) 400000 dwFrameInterval( 3) 416666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 3 bmCapabilities 0x01 Still image supported wWidth 2560 wHeight 1440 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 2 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 4 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 800 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 2 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 VideoStreaming Interface Descriptor: bLength 38 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 5 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 720 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 3 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 dwFrameInterval( 2) 200000 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 6 bmCapabilities 0x01 Still image supported wWidth 720 wHeight 576 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 200000 bFrameIntervalType 2 dwBytesPerLine 0 dwFrameInterval( 0) 200000 dwFrameInterval( 1) 400000 VideoStreaming Interface Descriptor: bLength 42 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 7 bmCapabilities 0x01 Still image supported wWidth 720 wHeight 480 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 4 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 dwFrameInterval( 2) 333333 dwFrameInterval( 3) 333667 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 8 bmCapabilities 0x01 Still image supported wWidth 640 wHeight 480 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 2 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 VideoStreaming Interface Descriptor: bLength 6 bDescriptorType 36 bDescriptorSubtype 13 (COLORFORMAT) bColorPrimaries 0 (Unspecified) bTransferCharacteristics 0 (Unspecified) bMatrixCoefficients 0 (Unspecified) VideoStreaming Interface Descriptor: bLength 28 bDescriptorType 36 bDescriptorSubtype 16 (FORMAT_FRAME_BASED) bFormatIndex 2 bNumFrameDescriptors 8 guidFormat {43564548-0000-0010-8000-00aa00389b71} bBitsPerPixel 24 bDefaultFrameIndex 1 bAspectRatioX 0 bAspectRatioY 0 bmInterlaceFlags 0x00 Interlaced stream or variable: No Fields per frame: 2 fields Field 1 first: No Field pattern: Field 1 only bCopyProtect 1 bVariableSize 1 VideoStreaming Interface Descriptor: bLength 62 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 1 bmCapabilities 0x01 Still image supported wWidth 1920 wHeight 1080 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 9 dwBytesPerLine 0 dwFrameInterval( 0) 83333 dwFrameInterval( 1) 83416 dwFrameInterval( 2) 166666 dwFrameInterval( 3) 166833 dwFrameInterval( 4) 200000 dwFrameInterval( 5) 333333 dwFrameInterval( 6) 333667 dwFrameInterval( 7) 400000 dwFrameInterval( 8) 416666 VideoStreaming Interface Descriptor: bLength 42 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 2 bmCapabilities 0x01 Still image supported wWidth 3840 wHeight 2160 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 333333 bFrameIntervalType 4 dwBytesPerLine 0 dwFrameInterval( 0) 333333 dwFrameInterval( 1) 333667 dwFrameInterval( 2) 400000 dwFrameInterval( 3) 416666 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 3 bmCapabilities 0x01 Still image supported wWidth 2560 wHeight 1440 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 2 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 4 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 800 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 2 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 VideoStreaming Interface Descriptor: bLength 38 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 5 bmCapabilities 0x01 Still image supported wWidth 1280 wHeight 720 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 3 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 dwFrameInterval( 2) 200000 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 6 bmCapabilities 0x01 Still image supported wWidth 720 wHeight 576 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 200000 bFrameIntervalType 2 dwBytesPerLine 0 dwFrameInterval( 0) 200000 dwFrameInterval( 1) 400000 VideoStreaming Interface Descriptor: bLength 42 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 7 bmCapabilities 0x01 Still image supported wWidth 720 wHeight 480 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 4 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 dwFrameInterval( 2) 333333 dwFrameInterval( 3) 333667 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 17 (FRAME_FRAME_BASED) bFrameIndex 8 bmCapabilities 0x01 Still image supported wWidth 640 wHeight 480 dwMinBitRate 33554432 dwMaxBitRate 268435456 dwDefaultFrameInterval 166666 bFrameIntervalType 2 dwBytesPerLine 0 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 VideoStreaming Interface Descriptor: bLength 6 bDescriptorType 36 bDescriptorSubtype 13 (COLORFORMAT) bColorPrimaries 0 (Unspecified) bTransferCharacteristics 0 (Unspecified) bMatrixCoefficients 0 (Unspecified) VideoStreaming Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 6 (FORMAT_MJPEG) bFormatIndex 3 bNumFrameDescriptors 1 bFlags 0 Fixed-size samples: No bDefaultFrameIndex 1 bAspectRatioX 0 bAspectRatioY 0 bmInterlaceFlags 0x00 Interlaced stream or variable: No Fields per frame: 1 fields Field 1 first: No Field pattern: Field 1 only bCopyProtect 1 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 1 bmCapabilities 0x01 Still image supported wWidth 1920 wHeight 1080 dwMinBitRate 314572800 dwMaxBitRate 314572800 dwMaxVideoFrameBufferSize 4147200 dwDefaultFrameInterval 166666 bFrameIntervalType 1 dwFrameInterval( 0) 166666 VideoStreaming Interface Descriptor: bLength 6 bDescriptorType 36 bDescriptorSubtype 13 (COLORFORMAT) bColorPrimaries 0 (Unspecified) bTransferCharacteristics 0 (Unspecified) bMatrixCoefficients 0 (Unspecified) Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 2 bInterfaceCount 2 bFunctionClass 1 Audio bFunctionSubClass 2 Streaming bFunctionProtocol 0 iFunction 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 2 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 1 Audio bInterfaceSubClass 1 Control Device bInterfaceProtocol 0 iInterface 0 AudioControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 1 (HEADER) bcdADC 1.00 wTotalLength 0x0026 bInCollection 1 baInterfaceNr(0) 3 AudioControl Interface Descriptor: bLength 12 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 1 wTerminalType 0x0602 Digital Audio Interface bAssocTerminal 0 bNrChannels 2 wChannelConfig 0x0003 Left Front (L) Right Front (R) iChannelNames 0 iTerminal 0 AudioControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 3 (OUTPUT_TERMINAL) bTerminalID 2 wTerminalType 0x0101 USB Streaming bAssocTerminal 0 bSourceID 3 iTerminal 0 AudioControl Interface Descriptor: bLength 8 bDescriptorType 36 bDescriptorSubtype 6 (FEATURE_UNIT) bUnitID 3 bSourceID 1 bControlSize 1 bmaControls(0) 0x03 Mute Control Volume Control iFeature 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 3 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 1 Audio bInterfaceSubClass 2 Streaming bInterfaceProtocol 0 iInterface 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 3 bAlternateSetting 1 bNumEndpoints 1 bInterfaceClass 1 Audio bInterfaceSubClass 2 Streaming bInterfaceProtocol 0 iInterface 0 AudioStreaming Interface Descriptor: bLength 7 bDescriptorType 36 bDescriptorSubtype 1 (AS_GENERAL) bTerminalLink 2 bDelay 1 frames wFormatTag 0x0001 PCM AudioStreaming Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 2 (FORMAT_TYPE) bFormatType 1 (FORMAT_TYPE_I) bNrChannels 2 bSubframeSize 2 bBitResolution 16 bSamFreqType 1 Discrete tSamFreq[ 0] 48000 Endpoint Descriptor: bLength 9 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x00c4 1x 196 bytes bInterval 4 bRefresh 0 bSynchAddress 0 AudioStreaming Endpoint Descriptor: bLength 7 bDescriptorType 37 bDescriptorSubtype 1 (EP_GENERAL) bmAttributes 0x01 Sampling Frequency bLockDelayUnits 0 Undefined wLockDelay 0x0000 Cc: stable@vger.kernel.org # 5.12.x Reported-by: Edwin Gatier Closes: https://lore.kernel.org/linux-media/CANiDSCu4AW=JZ9FS+Ny=DK_+LqqytGvSe+V6aVncRiGRiyDMfA@mail.gmail.com/T/#me584c35c4b523ac455925a1590a3de8efc354349 Tested-by: Edwin Gatier Reviewed-by: Laurent Pinchart Reviewed-by: Hans de Goede Signed-off-by: Ricardo Ribalda Link: https://patch.msgid.link/20260928-uvc-version-v4-5-da0e983fcb95@chromium.org Signed-off-by: Hans de Goede Signed-off-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin commit 19e93a987b5553071da3ede8046d76e09f37a5e3 Author: Ricardo Ribalda Date: Mon Nov 9 09:27:06 2026 +0000 media: uvcvideo: Add autosuspend quirk for AVerMedia Live Gamer HD 2 [ Upstream commit b79251c881bb39f70c6f6fb30ad5d454b78c9f4a ] A user has reported that this device gets stuck in a loop where every few seconds it will turn off and turn back on, causing audio devices to disappear and reappear, its LED to flash, spamming dmesg, etc. This only happens when not in use; everything is fine when the video device is actually being used. They also reported that using the AUTOSUSPEND quirk via module parameters fixes the issue. Add the device to the quirk list. ID 07ca:1570 AVerMedia Technologies, Inc. AVerMedia USB Device Negotiated speed: High Speed (480Mbps) Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.10 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 [unknown] bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x07ca AVerMedia Technologies, Inc. idProduct 0x1570 AVerMedia USB Device bcdDevice 1.00 iManufacturer 6 AVerMedia iProduct 7 AVerMedia USB Device iSerial 3 53106326013650 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 0x01d6 bNumInterfaces 4 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 150mA Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 0 bInterfaceCount 2 bFunctionClass 14 Video bFunctionSubClass 3 Video Interface Collection bFunctionProtocol 0 iFunction 8 AVerMedia Live Gamer HD 2 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 14 Video bInterfaceSubClass 1 Video Control bInterfaceProtocol 0 iInterface 8 AVerMedia Live Gamer HD 2 VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 1 (HEADER) bcdUVC 1.00 wTotalLength 0x004d dwClockFrequency 120.000000MHz bInCollection 1 baInterfaceNr( 0) 1 VideoControl Interface Descriptor: bLength 18 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 1 wTerminalType 0x0201 Camera Sensor bAssocTerminal 0 iTerminal 0 wObjectiveFocalLengthMin 0 wObjectiveFocalLengthMax 0 wOcularFocalLength 0 bControlSize 3 bmControls 0x00000000 VideoControl Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 5 (PROCESSING_UNIT) Warning: Descriptor too short bUnitID 3 bSourceID 1 wMaxMultiplier 0 bControlSize 2 bmControls 0x0000000f Brightness Contrast Hue Saturation iProcessing 0 bmVideoStandards 0x09 None SECAM - 625/50 VideoControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 3 (OUTPUT_TERMINAL) bTerminalID 2 wTerminalType 0x0101 USB Streaming bAssocTerminal 0 bSourceID 4 iTerminal 0 VideoControl Interface Descriptor: bLength 28 bDescriptorType 36 bDescriptorSubtype 6 (EXTENSION_UNIT) bUnitID 4 guidExtensionCode {c66d125b-0480-0844-8c26-b8363a84de63} bNumControls 17 bNrInPins 1 baSourceID( 0) 3 bControlSize 3 bmControls( 0) 0x07 bmControls( 1) 0xfe bmControls( 2) 0x01 iExtension 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 14 Video bInterfaceSubClass 2 Video Streaming bInterfaceProtocol 0 iInterface 8 AVerMedia Live Gamer HD 2 VideoStreaming Interface Descriptor: bLength 14 bDescriptorType 36 bDescriptorSubtype 1 (INPUT_HEADER) bNumFormats 1 wTotalLength 0x00bd bEndpointAddress 0x89 EP 9 IN bmInfo 0 bTerminalLink 2 bStillCaptureMethod 0 bTriggerSupport 0 bTriggerUsage 0 bControlSize 1 bmaControls( 0) 0 VideoStreaming Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 6 (FORMAT_MJPEG) bFormatIndex 1 bNumFrameDescriptors 5 bFlags 0 Fixed-size samples: No bDefaultFrameIndex 1 bAspectRatioX 0 bAspectRatioY 0 bmInterlaceFlags 0x00 Interlaced stream or variable: No Fields per frame: 1 fields Field 1 first: No Field pattern: Field 1 only bCopyProtect 0 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 1 bmCapabilities 0x00 Still image unsupported wWidth 640 wHeight 480 dwMinBitRate 294617088 dwMaxBitRate 294912000 dwMaxVideoFrameBufferSize 614400 dwDefaultFrameInterval 166833 bFrameIntervalType 2 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 VideoStreaming Interface Descriptor: bLength 34 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 2 bmCapabilities 0x00 Still image unsupported wWidth 720 wHeight 480 dwMinBitRate 331444224 dwMaxBitRate 331776000 dwMaxVideoFrameBufferSize 691200 dwDefaultFrameInterval 166833 bFrameIntervalType 2 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 VideoStreaming Interface Descriptor: bLength 30 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 3 bmCapabilities 0x00 Still image unsupported wWidth 720 wHeight 576 dwMinBitRate 331776000 dwMaxBitRate 331776000 dwMaxVideoFrameBufferSize 829440 dwDefaultFrameInterval 200000 bFrameIntervalType 1 dwFrameInterval( 0) 200000 VideoStreaming Interface Descriptor: bLength 38 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 4 bmCapabilities 0x00 Still image unsupported wWidth 1280 wHeight 720 dwMinBitRate 737280000 dwMaxBitRate 884736000 dwMaxVideoFrameBufferSize 1843200 dwDefaultFrameInterval 166666 bFrameIntervalType 3 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 dwFrameInterval( 2) 200000 VideoStreaming Interface Descriptor: bLength 46 bDescriptorType 36 bDescriptorSubtype 7 (FRAME_MJPEG) bFrameIndex 5 bmCapabilities 0x00 Still image unsupported wWidth 1920 wHeight 1080 dwMinBitRate 994332672 dwMaxBitRate 1990656000 dwMaxVideoFrameBufferSize 4147200 dwDefaultFrameInterval 166666 bFrameIntervalType 5 dwFrameInterval( 0) 166666 dwFrameInterval( 1) 166833 dwFrameInterval( 2) 200000 dwFrameInterval( 3) 333333 dwFrameInterval( 4) 333667 VideoStreaming Interface Descriptor: bLength 6 bDescriptorType 36 bDescriptorSubtype 13 (COLORFORMAT) bColorPrimaries 1 (BT.709,sRGB) bTransferCharacteristics 1 (BT.709) bMatrixCoefficients 4 (SMPTE 170M (BT.601)) Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 1 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 2 Video Streaming bInterfaceProtocol 0 iInterface 8 AVerMedia Live Gamer HD 2 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x89 EP 9 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x1400 3x 1024 bytes bInterval 1 Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 2 bInterfaceCount 2 bFunctionClass 1 Audio bFunctionSubClass 2 Streaming bFunctionProtocol 0 iFunction 9 AVerMedia Live Gamer HD 2 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 2 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 1 Audio bInterfaceSubClass 1 Control Device bInterfaceProtocol 0 iInterface 9 AVerMedia Live Gamer HD 2 AudioControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 1 (HEADER) bcdADC 1.00 wTotalLength 0x003a bInCollection 1 baInterfaceNr(0) 3 AudioControl Interface Descriptor: bLength 12 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 1 wTerminalType 0x0602 Digital Audio Interface bAssocTerminal 0 bNrChannels 1 wChannelConfig 0x0000 iChannelNames 0 iTerminal 0 AudioControl Interface Descriptor: bLength 12 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 5 wTerminalType 0x0603 Line Connector bAssocTerminal 0 bNrChannels 1 wChannelConfig 0x0000 iChannelNames 0 iTerminal 0 AudioControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 3 (OUTPUT_TERMINAL) bTerminalID 2 wTerminalType 0x0101 USB Streaming bAssocTerminal 0 bSourceID 3 iTerminal 0 AudioControl Interface Descriptor: bLength 8 bDescriptorType 36 bDescriptorSubtype 6 (FEATURE_UNIT) bUnitID 3 bSourceID 4 bControlSize 1 bmaControls(0) 0x01 Mute Control iFeature 0 AudioControl Interface Descriptor: bLength 8 bDescriptorType 36 bDescriptorSubtype 5 (SELECTOR_UNIT) bUnitID 4 bNrInPins 2 baSourceID(0) 1 baSourceID(1) 5 iSelector 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 3 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 1 Audio bInterfaceSubClass 2 Streaming bInterfaceProtocol 0 iInterface 9 AVerMedia Live Gamer HD 2 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 3 bAlternateSetting 1 bNumEndpoints 1 bInterfaceClass 1 Audio bInterfaceSubClass 2 Streaming bInterfaceProtocol 0 iInterface 9 AVerMedia Live Gamer HD 2 AudioStreaming Interface Descriptor: bLength 7 bDescriptorType 36 bDescriptorSubtype 1 (AS_GENERAL) bTerminalLink 2 bDelay 1 frames wFormatTag 0x0001 PCM AudioStreaming Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 2 (FORMAT_TYPE) bFormatType 1 (FORMAT_TYPE_I) bNrChannels 2 bSubframeSize 2 bBitResolution 16 bSamFreqType 1 Discrete tSamFreq[ 0] 48000 Endpoint Descriptor: bLength 9 bDescriptorType 5 bEndpointAddress 0x8a EP 10 IN bmAttributes 5 Transfer Type Isochronous Synch Type Asynchronous Usage Type Data wMaxPacketSize 0x00c0 1x 192 bytes bInterval 4 bRefresh 0 bSynchAddress 0 AudioStreaming Endpoint Descriptor: bLength 7 bDescriptorType 37 bDescriptorSubtype 1 (EP_GENERAL) bmAttributes 0x01 Sampling Frequency bLockDelayUnits 0 Undefined wLockDelay 0x0000 Binary Object Store Descriptor: bLength 5 bDescriptorType 15 wTotalLength 0x0016 bNumDeviceCaps 2 USB 2.0 Extension Device Capability: bLength 7 bDescriptorType 16 bDevCapabilityType 2 bmAttributes 0x00000006 BESL Link Power Management (LPM) Supported SuperSpeed USB Device Capability: bLength 10 bDescriptorType 16 bDevCapabilityType 3 bmAttributes 0x00 wSpeedsSupported 0x000e Device can operate at Full Speed (12Mbps) Device can operate at High Speed (480Mbps) Device can operate at SuperSpeed (5Gbps) bFunctionalitySupport 1 Lowest fully-functional device speed is Full Speed (12Mbps) bU1DevExitLat 4 micro seconds bU2DevExitLat 4 micro seconds Device Status: 0x0000 (Bus Powered) Reported-by: Sean Baggaley Closes: https://lore.kernel.org/linux-media/5ef59031-0853-41a7-8d11-c345fe535daf@drinkybird.net/ Signed-off-by: Ricardo Ribalda Link: https://patch.msgid.link/20260730-uvc-avermedia-v1-1-7272dd394d83@chromium.org Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin commit 309af21d334f970ad32175eefd1f33d154c1160d Author: Christian Loehle Date: Mon Nov 9 08:32:32 2026 +0000 cpufreq: CPPC: Select the frequency-invariance callback per CPU commit 21e018235d99bc86249b034c06646df8757b2852 upstream. cppc_cpufreq_cpu_fie_init() initializes deferred work only for CPUs whose feedback counters use PCC. However, if any CPU in a shared policy uses PCC, it installs the PCC tick callback for the entire policy. With FIE enabled, a non-PCC CPU then queues an uninitialized irq_work and can call a NULL function pointer when that work runs. Choose the frequency-invariance callback separately for each CPU using the recorded work-initialization state. Processor removal can unpublish the CPC descriptor before callback registration, so querying its counter transport again can incorrectly select direct reads for a PCC CPU. Register the callbacks after all counter initialization has completed, so a failed initial read for an online CPU cannot leave a partially registered policy. PCC CPUs use their initialized deferred work, while non-PCC CPUs read their own counters directly from the tick. Fixes: 997c021abc6e ("cpufreq: CPPC: Update FIE arch_freq_scale in ticks for non-PCC regs") Cc: All applicable Signed-off-by: Christian Loehle Tested-by: Sumit Gupta Link: https://patch.msgid.link/20260916162805.1039247-20-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Christian Loehle Signed-off-by: Sasha Levin commit 6a58052087d4183af5291a91e60ebca275c04042 Author: Jeff Layton Date: Fri Sep 4 15:42:48 2026 -0400 nfsd: shorten extack string returned with dodgy listener [ Upstream commit 8d7859d165dbdf6e8d77b76500fc990f26c8310d ] The kernel test robot reports: >> fs/nfsd/nfsctl.c:2253:4: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 94 [-Wformat-truncation] Shorten the extack string in this case so that it will fit in 80 chars. Signed-off-by: Jeff Layton Link: https://patch.msgid.link/20260904-nfsd-nl-hang-v1-1-8c8035b6294d@kernel.org Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin commit bd42c012aa8fa83ada0a1e5401b4b11bd64e39c9 Author: Darrick J. Wong Date: Thu Nov 5 10:47:22 2026 -0500 xfs: forcibly reset quota timers when upgrading to bigtime during repair [ Upstream commit 780212c8d8105eadb5f56b4c7aafb94937755582 ] If we decide to upgrade a dquot to BIGTIME as part of repairing it, we should zero out the timer fields so that they are re-evaluated and reset in bigtime format instead of letting through whatever was in there before. Cc: stable@vger.kernel.org # v6.8 Fixes: a5b91555403e3a ("xfs: repair quotas") Signed-off-by: Darrick J. Wong Assisted-by: LOLLM # finding obvious bugs Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 762af7d11be4e30354b429b161f195160921d1ed Author: Darrick J. Wong Date: Thu Nov 5 10:47:21 2026 -0500 xfs: reinitialize dquot block if non-first dquot can't load [ Upstream commit faa9aa9e846332aaad78096a2cebfeafe68a7776 ] LOLLM noticed that the early exit logic in xrep_quota_block is defective because it only looks in the first ondisk dquot for corruption that would prevent dquots from loading. We need to scan all the dquots in the block, not just the first one. Signed-off-by: Darrick J. Wong Assisted-by: LOLLM # finding obvious bugs Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Stable-dep-of: 780212c8d810 ("xfs: forcibly reset quota timers when upgrading to bigtime during repair") Signed-off-by: Sasha Levin commit 4ded35605fb6446317d305544cf6ff1848142d13 Author: Christian Loehle Date: Sun Nov 8 11:27:38 2026 +0000 ACPI: CPPC: Accept requests to retain immutable autonomous selection commit 4bcc60d326c5acaa28c5913259decb22a33a83a1 upstream. ACPI permits Autonomous Selection Enable to be Integer 1 when the platform always selects performance autonomously. cppc_get_auto_sel() returns that value, but cppc_set_auto_sel() rejects the Integer even when asked to keep autonomous selection enabled. AMD shared-memory initialization consequently fails in active or guided mode after successfully reading the capability. Accept a request to keep this immutable field enabled without issuing a register access. Expose the immutable encoding to callers, separately from the current value of a writable register. Before an AMD shared-memory transition to passive mode, reject immutable autonomous selection on any present CPU. Otherwise a guided-to-passive transition ignores the failed disable and reports the wrong mode, while active-to-passive unregisters the working driver before passive policy initialization fails. Check under the driver mode lock before invoking either transition, including known offline CPUs. Serialize this capability query with descriptor publication and removal. ACPI processor removal drops the descriptor before taking the CPU hotplug write lock, so the caller's cpus_read_lock() alone cannot protect the lookup. Unpublish under the same mutex before releasing a descriptor, including when adding its kobject fails. The cppc-cpufreq auto_select attribute can also request one while autonomous selection is already enabled. If the subsequent bounds update fails, its rollback requests zero and clears the cached mode regardless of the previous state. For an immutable field the disable request fails, leaving the cached mode wrong. Save and restore the previous mode instead. This also avoids disabling an already-enabled writable control on that error path. Fixes: c984f5d5d45b ("ACPI: CPPC: Add auto select register read/write support") Fixes: ea3db45ae476 ("cpufreq: cppc: Update MIN_PERF/MAX_PERF in target callbacks") Cc: All applicable Signed-off-by: Christian Loehle Tested-by: Sumit Gupta Link: https://patch.msgid.link/20260916162805.1039247-19-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Christian Loehle Signed-off-by: Sasha Levin commit 4f6a4864308b57cf7aa38ddd07cf4ddcecfbcc41 Author: Christian Loehle Date: Sun Nov 8 11:27:36 2026 +0000 ACPI: CPPC: Validate FFH register fields before hardware access commit 6b016c5c96448c0a5f09328d37f66562d154a5e5 upstream. The x86 CPPC FFH accessors construct masks and shift values using the firmware's Bit Width and Bit Offset without checking that the field fits in an MSR. A zero-width field or a field extending beyond bit 63 can therefore cause an invalid shift. The safe MSR accessors only handle an access fault, not invalid field arithmetic after a successful read. Also, the 64-bit GAS address is implicitly narrowed to the 32-bit MSR number. A descriptor with nonzero upper address bits can access a different MSR from the one described by firmware. The arm64 AMU counter readers have the same unchecked field arithmetic. Validate the field bounds before reading a counter, including both descriptors in the paired counter path. Dispatch FFH accesses before decoding the GAS Access Size in the common read and write paths. Otherwise, a large access_width can trigger an invalid shift in GET_BIT_WIDTH() before the architecture validates its register. That field has architecture-specific FFH semantics and is not needed by the generic memory/port accessor on this path. Validate x86 MSR addresses and share the field-bounds checks between related accessors within each architecture. Fixes: a6cbcdd5ab5f ("ACPI / CPPC: Add support for functional fixed hardware address") Fixes: 68c5debcc06d ("arm64: implement CPPC FFH support using AMUs") Fixes: f489c948028b ("ACPI: CPPC: Fix access width used for PCC registers") Cc: All applicable Signed-off-by: Christian Loehle Tested-by: Sumit Gupta Link: https://patch.msgid.link/20260916162805.1039247-17-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Christian Loehle Signed-off-by: Sasha Levin commit 7c25ee5668fbe0f9f0c011bd27dc99847e8b72b5 Author: Ping-Ke Shih Date: Sun Nov 8 09:39:03 2026 +0100 wifi: rtw88: TX report with long timeout for non-PCIE devices [ Upstream commit 7cde94dab0e74434ccc0a387d7ad373fb3becda0 ] Many USB and SDIO devices can't report TX status within 500 ms, and extending to 2500 ms as tested USB/SDIO devices can fix the problem [1]. To avoid adding chip ID one by one, and this change looks harmless. Keep PCIE using short timeout, and others use long timeout. [1] https://lore.kernel.org/linux-wireless/20260921165343.8131-1-pepe.schlehofer@gmail.com/ Cc: stable@vger.kernel.org Signed-off-by: Ping-Ke Shih Reviewed-by: Luka Gejak Tested-by: Josef Schlehofer Link: https://patch.msgid.link/20260924004637.9958-1-pkshih@realtek.com [ Adjust the removed condition. This tree has no RTL8723BS support and lacks commit 4d688f22ebbf ("wifi: rtw88: tx: extend the TX report purge timeout to RTL8723BS"), so the old check has no rtw_is_8723bs() part. The resulting code is the same as upstream. ] Signed-off-by: Josef Schlehofer Signed-off-by: Sasha Levin commit 3a6381f254ed81d36f3896f61dcd5d830e08861d Author: Andrew Morton Date: Sun Nov 8 11:57:27 2026 +0800 block: restore the iterator when rejecting a misaligned bio commit 40d070cbb1906896d6fd65c39722d2411830ed9f upstream. bio_iov_iter_get_pages() can extract some iovecs before encountering a misaligned one. It releases the pages and rejects the entire bio, but leaves the supplied iterator advanced. An iomap direct-I/O caller may subsequently reexpand the iterator's byte count and fall back to buffered I/O. The reexpanded count then includes bytes before the iterator's current segment, potentially causing iterate_iovec() to read beyond the imported iovec array. In a reproducer using an initial empty iovec followed by 10-byte and 1015-byte segments, writev() returned 1015 instead of 1025 and KASAN reported an 8-byte read beyond the nine-element iovec allocation. Saving and restoring the iterator on the rejected-bio path makes writev() return 1025 and eliminates the KASAN report. Restore the entire iterator rather than reverting a byte count: advancing past an empty segment changes its position without consuming any bytes. Leave successful and partially accepted bio paths unchanged. [ Backport to 7.3.y: restore the iterator in the existing inline -EINVAL cleanup, as this tree lacks out_release_pages. ] Fixes: 14b007e17881 ("block: validate user space vectors during extraction") Signed-off-by: Andrew Morton Reported-by: Haocheng Yu Closes: https://lore.kernel.org/20261018081203.2431035-1-l1za0.sec@gmail.com Cc: Jens Axboe Cc: Keith Busch Cc: Christoph Hellwig Cc: Tal Zussman Cc: Daehyeon Ko <4ncienth@gmail.com> Cc: Al Viro Cc: Hannes Reinecke Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261020170250.014BD1F000C9@smtp.kernel.org Signed-off-by: Jens Axboe Signed-off-by: Haocheng Yu Signed-off-by: Sasha Levin commit 16bc391d0205edf15f0d917540185507b8d30c8e Author: SJ Park Date: Sat Nov 7 09:25:23 2026 -0800 mm/damon/core: remove unreachable damos charge_{target,addr}_from [ Upstream commit 5695abc4e742b947f586bfb6a080a80ad9957e5d ] damos_quota->charge_{target,addr}_from saves the target and region the scheme's quota limit is reached. damos_skip_charged_region() skips the target and regions before the point. The target that was assigned to charge_target_from could be dynamically removed from the context by the runtime parameters update (aka commit) feature. In this case, damos_skip_charged_region() cannot find if the point is passed or not, so the scheme is effectively disabled. Similarly, the user could also remove all the regions of the target using the runtime parameters update feature. It would be uncommon to do that, but it is a supported feature. Because the skip pointer detection logic (damos_skip_charged_region()) works for each region of targets, this result in the logic is entirely skipped and the scheme is effectively disabled again. The user impact is that the DAMOS scheme could suddenly stop working under certain uses of the runtime parameters update feature. It could surprise users. No crash or leak happens though. Users could also simply work around by re-installing the scheme. Catch the corner cases in damos_adjust_quota() and reset the pointers. Link: https://lore.kernel.org/20261020023958.108276-1-sj@kernel.org Fixes: da87878010e5 ("mm/damon/sysfs: support online inputs update") Signed-off-by: SJ Park Signed-off-by: Andrew Morton Closes: https://sashiko.dev/#/bug/linux-cd0c55fc-0cc8-45d8-9637-3334811c49b8 Cc: # 5.19.x Signed-off-by: SJ Park Signed-off-by: Sasha Levin commit f336173eb9ab8c36a535c8c1c1eaf6473a83ff1c Author: Yuansheng Yang <0xbeac@gmail.com> Date: Sat Nov 7 09:16:56 2026 -0700 io_uring/rsrc: hold uring_lock across index-alloc put_user Commit d7c7037253f6935af243570635d71b4920b5a4ea upstream. io_files_update_with_index_alloc() installs a fixed file via io_fixed_fd_install(), which drops ->uring_lock when the request runs on io-wq, then put_user()s the allocated slot back to userspace. If that faults, the error path calls __io_close_fixed() by slot index after re-taking the lock. The slot can be closed and reused between the install and that cleanup: another fixed CLOSE plus open/accept/pipe/socket, or a FILES_UPDATE, can put an unrelated file into the same slot. The error path then removes that file instead of the one this request installed, ending an unrelated file's fixed-table reference early. This is a correctness/DoS issue, not a use-after-free: fixed-file requests hold an io_rsrc_node reference, so the node and file stay alive until they are done. Hold ->uring_lock across __io_fixed_fd_install() and put_user(), and do the failure cleanup with io_fixed_fd_remove() under the same lock. This is the same class as the io_pipe_fixed() fix in a3d7ee11289f. Faulting while holding ->uring_lock is fine, the registration paths already do it. Fixes: a7c41b4687f5 ("io_uring: let IORING_OP_FILES_UPDATE support choosing fixed file slots") Signed-off-by: Yuansheng Yang <0xbeac@gmail.com> Link: https://patch.msgid.link/20261104154655.81876-1-0xbeac@gmail.com [axboe: various touch-ups] Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit 6997ea718e985ff0e8dd2a4a8340abce87e8ac6b Author: Jens Axboe Date: Sat Nov 7 09:16:55 2026 -0700 io_uring/poll: don't poll a writer for urgent data Commit edeac4546a71b6c1db4ba006a2dbf7c863f54e9a upstream. io_arm_poll_handler() starts the mask of every async poll with EPOLLPRI, for a reader and a writer alike. A TCP socket reports EPOLLPRI for as long as urgent data sits unread, so once the peer has sent a byte with MSG_OOB, the async poll of a send that waits for buffer space is ready on every re-arm. The request spins through task_work and __io_arm_poll_handler() until APOLL_MAX_RETRY is used up and io-wq takes it, the same spin that EPOLLRDHUP caused for a half-closed peer. While it spins, the request is neither in the poll hash nor in io-wq. A cancel issued right after the send gets -ENOENT and the send stays pending, until a later cancel finds it in io-wq. Only add EPOLLPRI for polls that want to read. Urgent data is an event for a recv, not for a writer. Fixes: d7718a9d25a6 ("io_uring: use poll driven retry for files that support it") Reported-by: Lukáš Lalinský Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit ed37250c3975c81a701505fd4438132f2134528b Author: Jens Axboe Date: Sat Nov 7 09:16:54 2026 -0700 io_uring/poll: don't poll a writer for a read side hangup Commit 74c1f1048e4401d6a953ab2299b14ace1ad6a899 upstream. io_init_poll_iocb() adds EPOLLRDHUP to every poll, including the async poll of a send that waits for buffer space. Once the peer has shut down its sending side, the socket keeps reporting EPOLLRDHUP, so each re-arm in __io_arm_poll_handler() finds a ready mask and the request is issued again. The send still can't make progress, the request burns through APOLL_MAX_RETRY in a few milliseconds and ends up in io-wq. A send in io-wq blocks until the peer reads, but sendmsg and writev go through ____sys_sendmsg() and sock_write_iter(), which turn O_NONBLOCK into MSG_DONTWAIT, and the application gets -EAGAIN for a request that never asked for a non-blocking send. Only add EPOLLRDHUP for polls that want to read. A peer that stopped sending is no event for a writer, and a poll that asks for it explicitly still gets it. Fixes: 464dca612bc6 ("io_uring: mask in error/nval/hangup consistently for poll") Reported-by: Lukáš Lalinský Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit e409e1b03059c544d271c7f8e1215c5c0c62f278 Author: Shang En Sim Date: Sat Nov 7 09:16:53 2026 -0700 io_uring/poll: cancel all matching requests in one pass Commit 9eff9c07e927dcd9c57150cd6fb3d4ec76f00480 upstream. With IORING_ASYNC_CANCEL_ALL, __io_async_cancel() calls io_try_cancel() until nothing is found, and io_poll_cancel() cancels one request per call, starting each lookup at the beginning of the hash. A cancelled request stays hashed until its task work runs, so every lookup walks past the ones already cancelled. Cancelling K of N pending polls visits about K*N/2 requests in one io_uring_enter(), with uring_lock held. A single CANCEL_FD|ALL on 80000 polls on one eventfd takes 17.06s, 0.02s with this change. With voluntary preemption the soft lockup watchdog fires: watchdog: BUG: soft lockup - CPU#1 stuck for 26s! [repro:100] RIP: 0010:io_cancel_req_match+0x19/0xa0 io_poll_cancel+0x73/0x170 io_try_cancel+0x7b/0xf0 __io_async_cancel+0x41/0x110 Walk the hash once and cancel every match, as io_cancel_remove() does for futex and waitid. Cancel by user_data only needs its own bucket. __io_async_cancel() still loops until nothing is found, so a request that io-wq parks in the poll hash meanwhile is still cancelled. A cancel that matches one request now walks the whole hash twice instead of stopping at the match. Cc: stable@vger.kernel.org Fixes: 8e29da69fead ("io_uring: add support for IORING_ASYNC_CANCEL_ALL") Signed-off-by: Shang En Sim Link: https://patch.msgid.link/20261030050319.1448530-3-sim@shangen.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit 2d29bf01edc21d67c71ebc085d58d853c712b334 Author: Shang En Sim Date: Sat Nov 7 09:16:52 2026 -0700 io_uring/cancel: count all requests that a CANCEL_ALL cancels Commit 21ddbb14f7c3baab50a2a6c13ee375edc2bbe031 upstream. With IORING_ASYNC_CANCEL_ALL, __io_async_cancel() counts one for each io_try_cancel() call that cancels something. io_futex_cancel() and io_waitid_cancel() cancel every match in one call and return how many, so four futex waits cancelled with CANCEL_ALL give a result of 1. Add the number that they return. Cc: stable@vger.kernel.org Fixes: 194bb58c6090 ("io_uring: add support for futex wake and wait") Fixes: f31ecf671ddc ("io_uring: add IORING_OP_WAITID support") Signed-off-by: Shang En Sim Link: https://patch.msgid.link/20261030050319.1448530-2-sim@shangen.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit a21f907ff6fad96d7a71f8cf0e4b8b7435da9393 Author: Shakeel Butt Date: Sat Nov 7 09:16:51 2026 -0700 io_uring/sqpoll: do the return-to-userspace work in the SQPOLL thread Commit f013b695506491c5202a412a6568313549c81f50 upstream. The SQPOLL thread never returns to userspace. io_sq_tw() runs its task_work, but the rest of resume_user_mode_work(), like memory.high reclaim and block cgroup throttling, only runs when the thread exits. So memory.high reclaim only happens inside a charge, with sqd->lock and ctx->uring_lock held, and not at all if the charges can't block. This used to work. The loop called io_run_task_work(), which does this work since commit b5d3ae202fbf ("io_uring: handle TIF_NOTIFY_RESUME when checking for task_work"). Commit af5d68f8892f ("io_uring/sqpoll: manage task_work privately") replaced that call with io_sq_tw(). Call resume_user_mode_work() at the top of the loop when TIF_NOTIFY_RESUME is set, with sqd->lock dropped. It runs once per pass, so a pass that charges two or more batches still reclaims inside the charge, as before. Tested in a VM with memory.high=64M and swap on zram. An SQPOLL ring reads 256M from /dev/zero into untouched memory, 64K at a time. Before, the thread made 337 calls to __mem_cgroup_handle_over_high(), all from inside the charge. After, it makes 704, all from the top of the loop. memory.peak stays at 64M. With 1M reads, 296 of its 385 calls still come from inside the charge. Both runs take about 50% longer, and the extra time is in the handler, which now runs more often. Without memory.high pressure, the test never calls resume_user_mode_work() and the times do not change. Lockdep showed no warnings, also with io_uring_register() racing for sqd->lock. Fixes: af5d68f8892f ("io_uring/sqpoll: manage task_work privately") Cc: stable@vger.kernel.org Signed-off-by: Shakeel Butt Link: https://patch.msgid.link/20261101022146.309201-1-shakeel.butt@linux.dev Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit 3fe0b200a9a50e7af0cd9bc03faef5e8eb68f968 Author: Shuai Liu <847807867@qq.com> Date: Sat Nov 7 09:16:50 2026 -0700 io_uring/sqpoll: don't set IO_SQ_THREAD_SHOULD_STOP on thread exit Commit fca3ff9e2eee7d285585daf51942e0b5e2be354a upstream. io_sq_thread_stop() carries a WARN_ON_ONCE() asserting that IO_SQ_THREAD_SHOULD_STOP isn't set yet, i.e. that stopping the SQPOLL thread is never attempted twice. Since commit 22d9db9fd64a ("io_uring/sqpoll: don't attach to a thread that is canceling"), the SQPOLL thread itself sets that bit on its way out, so that io_sq_offload_create() won't attach a new ring to a thread that is canceling. When the thread exits on a fatal signal, the bit is thus set before the ring teardown gets to io_sq_thread_stop(), which now triggers the warning on every such exit: WARNING: io_uring/sqpoll.c:88 at io_sq_thread_stop Workqueue: iou_exit io_ring_exit_work Call Trace: io_put_sq_data io_sq_thread_finish io_ring_ctx_free io_ring_exit_work Introduce a separate IO_SQ_THREAD_EXITING bit for the thread marking itself as on its way out, and check it in io_sq_offload_create() along with IO_SQ_THREAD_SHOULD_STOP. IO_SQ_THREAD_SHOULD_STOP regains its original meaning, "a stop has been requested", and the WARN_ON_ONCE() holds again. Reproduced with an SQPOLL ring and an immediate fatal signal: the warning fires on v7.3.0+ (22d9db9fd64a present) and is gone with this change. Reported-by: syzbot+675af112519ca34f5502@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=675af112519ca34f5502 Fixes: 22d9db9fd64a ("io_uring/sqpoll: don't attach to a thread that is canceling") Signed-off-by: Shuai Liu <847807867@qq.com> Link: https://patch.msgid.link/tencent_BB08960D79E0261B5C1EB1E589787734E907@qq.com [axboe: trim excessive comment] Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit 5648979c481847a7ef273f727ad64b1ae071f26f Author: Jens Axboe Date: Sat Nov 7 09:16:49 2026 -0700 io_uring/sqpoll: don't attach to a thread that is canceling Commit 22d9db9fd64a493525d692b32c556875b7254665 upstream. io_sq_offload_create() refuses to attach a ring to an SQPOLL thread that has already gone, by checking sqd->thread under sqd->lock. Since the thread drops the lock while io_uring_cancel_generic() waits for its requests, that check can run while the thread is on its way out and still see it. The new ring is then added to ctx_list, io_uring_setup() succeeds, the thread finishes canceling and exits without ever having looked at the ring, and io_uring_enter() fails with -EOWNERDEAD. Only a thread that exits on a fatal signal can be caught like this, as the stop bit is set once the last ring has let go of the sqd, when no fd is left to attach through. A fatal signal is group wide and attaching needs the same thread group, so the attacher is on its way out as well. Still, make the check see it: set the stop bit before canceling, whatever the reason for the exit, and test it when attaching. Reported-by: Karl Mehltretter Fixes: cb0306c52ffa ("io_uring/cancel: drop sqd->lock while SQPOLL waits") Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin commit 682a8804640b6266a4b7fae5a131c57dd8711f70 Author: Chris Mason Date: Sat Nov 7 09:16:48 2026 -0700 io_uring/cancel: drop sqd->lock while SQPOLL waits Commit cb0306c52ffae083a86fb283de67875ae7a9500e upstream. An exiting SQPOLL thread calls io_uring_cancel_generic() with sqd->lock held, and keeps it across cond_resched() and the sleep until nothing is in flight anymore. A zero-copy send notification can't be canceled and stays pending as long as the peer doesn't read, so the lock is held for as long as a user cares to. io_ring_exit_work() needs it to park the thread, and so do IORING_REGISTER_IOWQ_AFF and IOWQ_MAX_WORKERS. With 64 such rings sharing the thread, every iou_exit slot sleeps on the lock and no ring gets freed for anyone. Drop the lock around cond_resched() and the sleep, like the main loop of the thread does. Each walk of ctx_list is still under one hold, and nothing is kept across the unlock. The thread drops its io-wq, frees its tctx and clears sqd->thread under one hold after the loop, so whoever holds the lock and finds sqd->thread set can still use them. Fixes: 63809137ebb5 ("io_uring: flush notifiers after sendzc") Signed-off-by: Chris Mason [axboe: adapted to the schedule_timeout() based loop] Signed-off-by: Jens Axboe [axboe: adapted to the schedule() based wait loop] Signed-off-by: Sasha Levin commit 4f698c3f02878fd24b513b05e8e2b6e15f68ca3c Author: Janne Grunau Date: Sat Nov 7 16:20:40 2026 +0100 wifi: brcmfmac: cfg80211: Report port_authorized for 4-way HS offload [ Upstream commit 6fff9de5c5b425817588eeed42bd56d665751c13 ] Since commit 416386060 ("Mark authorization completed on driver indication during 4-way HS offload") [0] wpa_supplicant expects NL80211_CMD_PORT_AUTHORIZED to complete the authentication when the driver supports 4-way handshake offload. This was apparently never tested with the upstream brcmfmac driver as it does not report this. This broke authentication on Apple silicon devices (BRCM4378, BRMC4387, BRMC4388) and other devices when wpa_supplicant 2.11 was released [1]. This was initially dealt with by reverting the commit in Fedora [2] and other Linux distributions. Instead of carrying the revert over to wpa_supplicant 2.12 add the expected NL80211_CMD_PORT_AUTHORIZED when the connection is established. The "Fixes:" tag is not fully accurate as this has only became an issue after userspace changes years after the change. Since the change is expected to be required in all active stable branches for wpa_supplicant 2.11 / 2.12 compatibility it is helpful even though BRCMF_PROFILE_FWSUP_SAE did not exists then. Link: https://github.com/zephyrproject-rtos/hostap/commit/41638606054a09867fe3f9a2b5523aa4678cbfa5 [0] Link: https://lists.infradead.org/pipermail/hostap/2024-August/042893.html [1] Link: https://bugzilla.redhat.com/show_bug.cgi?id=2302577 [2] Link: https://lore.kernel.org/linux-wireless/20260911065656.1269623-5-Jason.Huang2@infineon.com/ [3] Cc: stable@vger.kernel.org Fixes: b8a64f0e96c2 ("brcmfmac: support 4-way handshake offloading for WPA/WPA2-PSK") Signed-off-by: Janne Grunau Reviewed-by: Neal Gompa Acked-by: Arend van Spriel Link: https://patch.msgid.link/20260915-brcmfmac-4way-handshake-offload-authenticated-event-v2-1-fbb9cc7ac177@jannau.net Signed-off-by: Johannes Berg Signed-off-by: Janne Grunau Signed-off-by: Sasha Levin commit a39561fff17c23b68870c376279953733c046e7b Author: Gael Blivet Date: Fri Nov 6 10:52:19 2026 -0500 ksmbd: look up stream size by exact xattr name [ Upstream commit 10ea20d6584ecdaf2f7505855412a856a88d8934 ] get_file_stream_info() walks the xattr list from a single ksmbd_vfs_listxattr() and sizes each stream it finds with ksmbd_vfs_casexattr_len(), which matches with strncasecmp(). Linux xattr names are case-sensitive, so two streams differing only in case report each other's size. The loop already holds the exact name, so query it directly with ksmbd_vfs_xattr_len(), which is what casexattr_len() calls once its search succeeds. Make it non-static and declare it in vfs.h, and drop the comment above it, which describes a different bug and no longer matches the code. This also drops a full listing per stream: casexattr_len() runs its own listxattr on every call, so enumerating a file with N xattrs cost N listings instead of one. Fixes: 689f1eb3719d ("ksmbd: report actual xattr value length in stream enumeration") Signed-off-by: Gael Blivet Assisted-by: Claude:claude-opus-5 Signed-off-by: Namjae Jeon [ sashal: retained non-const struct mnt_idmap pointers to match the existing vfs_getxattr() API ] Signed-off-by: Sasha Levin commit 80ea92d6220008071f6a67ec571e922b5d1e1ff8 Author: Chuck Lever Date: Thu Nov 5 21:45:01 2026 -0500 NFSD: Complete a cld upcall when copying its reply fails [ Upstream commit 8cef2b0a01d28647facc57501a3df7ccd8d13ccd ] cld_pipe_downcall() removes the matching upcall from cn_list before copying the daemon's reply. When that copy_from_user() faults, the downcall returns -EFAULT without completing the upcall, and a retried write cannot reach it because its xid is no longer on the list. __cld_pipe_upcall() waits on cu_done uninterruptibly, so the nfsd thread that sent the upcall is stuck, and nfsd shutdown hangs behind it. The pipe is mode 0600, so only a broken or hostile nfsdcld can trigger the fault. Record the fault in the upcall's pipe message and complete it, so the waiter returns the error to its client tracking operation. Fixes: f3f8014862d8 ("nfsd: add the infrastructure to handle the cld upcall") Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260901-alemi-v2-3-e163f94a3a6e@kernel.org Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin commit 5c9944dc69356a8fa4dcad0254fa62e488e950b3 Author: Chuck Lever Date: Thu Nov 5 21:28:54 2026 -0500 NFSD: Complete a cld upcall when the daemon closes the pipe [ Upstream commit 2a83fcb50f3c25c493cc4389619340fefe9d6ac4 ] Once nfsdcld has read a whole upcall, rpc_pipe_read() unlinks the message from every pipe list, so the purges in rpc_pipe_release() and rpc_close_pipes() no longer reach it. cld_upcall_ops supplies no .release_pipe callback, and cld_pipe_destroy_msg() returns without completing the upcall because a downcall is expected to follow. A daemon that exits between the read and the write therefore strands its waiter: the nfsd thread sleeps in TASK_UNINTERRUPTIBLE in __cld_pipe_upcall() and never returns, hung task warnings follow, and the server cannot be shut down. Add a .release_pipe that completes every upcall the daemon has consumed. cu_inflight distinguishes those from upcalls still queued on the pipe, which the framework purges before it calls this callback; cld_pipe_downcall() removes an upcall it accepts from cn_list under the same lock. Neither can be completed twice. Fail the stranded upcall with -EPIPE rather than the -EAGAIN that makes cld_pipe_upcall() retry. The daemon consumed the request, so whether it acted on it before exiting is unknown. Fixes: f3f8014862d8 ("nfsd: add the infrastructure to handle the cld upcall") Reported-by: syzbot+edbebd898142ee5e24ce@syzkaller.appspotmail.com Closes: https://lore.kernel.org/linux-nfs/6a99f6f0.2e567484.299ffc.000c.GAE@google.com/ Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260901-alemi-v2-7-e163f94a3a6e@kernel.org Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin commit f4e9c2540760d6c75bfae92f75ba45843458bca2 Author: Chuck Lever Date: Thu Nov 5 21:28:53 2026 -0500 NFSD: Move the cld upcall message out of the caller's stack frame [ Upstream commit c559b05610557fa3c6c30259261f6dae523b3f23 ] __cld_pipe_upcall() builds its struct rpc_pipe_msg on the stack and hands it to rpc_queue_upcall(), which links it into a list the pipe owns until the message is released. Only the completion rules keep that frame alive for as long as the pipe refers to it, and the peer that drives those rules is an untrusted userspace daemon. The gss and idmap upcalls do not take that on: each keeps the message in the object it already allocates. Do the same here and put the message in struct cld_upcall, beside the reply buffer it carries. cld_pipe_destroy_msg() then reaches the upcall from the message directly rather than through msg->data. Reported-by: syzbot+d5c77cabf7a3492aa650@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=d5c77cabf7a3492aa650 Link: https://patch.msgid.link/20260901-alemi-v2-2-e163f94a3a6e@kernel.org Signed-off-by: Chuck Lever Stable-dep-of: 2a83fcb50f3c ("NFSD: Complete a cld upcall when the daemon closes the pipe") Signed-off-by: Sasha Levin commit 616af606765210728accbf9f036724d7b7865e3f Author: Chuck Lever Date: Thu Nov 5 21:00:31 2026 -0500 NFSD: Send a meaningful CB_RECALL_ANY keep count [ Upstream commit 9af39c0773ef956039e1ebe9c235532fe6ee1e50 ] deleg_reaper() sets craa_objects_to_keep to zero on every CB_RECALL_ANY. RFC 8881 Section 20.6.3 defines that field as the number of objects the client may keep, leaving the client to choose which of the excess to return, because the server cannot read lack of recent use as lack of usefulness. Zero asks for every delegation the client holds, including the ones backing files an application still has open. There is also no reason NFSD has to reclaim the entire delegation working set on the first sign of memory pressure. Derive the keep count from cl_deleg_count so that each callback asks for one delegation. Both the shrinker and the laundromat re-arm while their condition lasts, so a client with more to give is asked again on the next pass. The Linux client ignores craa_objects_to_keep and returns unused delegations selected from the type mask alone, so the count changes nothing for it. Fixes: 44df6f439a17 ("NFSD: add delegation reaper to react to low memory condition") Cc: stable@vger.kernel.org Reviewed-by: Jeff Layton Link: https://patch.msgid.link/20260817-recall-any-keep-count-v5-4-3b2cffce701e@kernel.org Signed-off-by: Chuck Lever [ sashal: Added missing prerequisites for per-client delegation counting and the directory-delegation callback mask. ] Signed-off-by: Sasha Levin commit 76ca00a4eca507550af13118289169bc4b508b82 Author: Jeff Layton Date: Thu Nov 5 20:53:10 2026 -0500 NFSD: stop registering with rpcbind after a failure in listener_set [ Upstream commit bf0f3a37e6ccb78ae80cc6eb2edde4f033c7574c ] nfsd_nl_listener_set_doit() calls svc_xprt_create_from_sa() once for each requested listener and passes flags of 0, so every listener registers with rpcbind on its own. A rpcbind that accepts the connection and never replies therefore costs one timeout for each entry. With the cap of 1024 entries the request can hold nfsd_mutex for about 34 minutes, which is roughly 17 times the hung-task threshold. One failure is enough to know that the next call will not fare better. Read svc_rpcb_failure_count() before the create loop, and pass SVC_SOCK_ANONYMOUS for the rest of the request once the count moves. Fixes: 16a471177496 ("NFSD: add listener-{set,get} netlink command") Cc: stable@vger.kernel.org Assisted-by: LLM Link: https://syzkaller.appspot.com/bug?extid=c7eae0eb80858a2dba0f Suggested-by: Olga Kornievskaia Signed-off-by: Jeff Layton Link: https://patch.msgid.link/20260901-nfsd-nl-hang-v5-10-a540d86668b0@kernel.org Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin commit 71e4208acad01eb2d958fc6f5ece4896956a134f Author: Jeff Layton Date: Thu Nov 5 20:53:09 2026 -0500 SUNRPC: report local rpcbind calls that get no answer [ Upstream commit 202a557d0c8e65c7fd7fcff2ad2756468d1ab711 ] A caller that creates many listeners in one operation calls svc_register() once for each of them. Every call waits for the local rpcbind on its own, so a rpcbind that never answers costs the caller one timeout per listener. The caller has no way to learn that the first call already failed. Split rpcb_register_call() failures by whether rpcbind answered: - answered: a FALSE reply, or an RPC-level rejection that rpc_decode_header() derives from the reply. -EACCES (FALSE reply or AUTH_ERROR), -EPROTONOSUPPORT, -EPFNOSUPPORT, -EOPNOTSUPP. - never sent: -ENOMEM, -EMSGSIZE, -ERESTARTSYS. - no answer: everything else, i.e. transport errors. Any no-answer error gets represented by -EIO, which is already what the RPC layer reports for most of it: rpc_check_timeout() returns -EIO for a soft timeout without RPC_TASK_TIMEOUT, and call_status() documents -EIO as "shutdown or soft timeout". Keep a count of the number of rpcbind failures in the serv. Later patches will use that to watch for hard rpcbind failures, and alter their behavior accordingly. Assisted-by: LLM Signed-off-by: Jeff Layton Link: https://patch.msgid.link/20260901-nfsd-nl-hang-v5-6-a540d86668b0@kernel.org Signed-off-by: Chuck Lever Stable-dep-of: bf0f3a37e6cc ("NFSD: stop registering with rpcbind after a failure in listener_set") Signed-off-by: Sasha Levin commit 70b97e02c320b34461bcc7d264898ee46f1e150f Author: Jeff Layton Date: Thu Nov 5 20:53:08 2026 -0500 NFSD: report listener creation failures through extack [ Upstream commit 8e590a16853fedd2697a3b0c32b3cbf1a444f7b2 ] nfsd_nl_listener_set_doit() returns the raw errno from svc_xprt_create_from_sa() and sets no extack. A failed LISTENER_SET therefore tells userland only "Address already in use", or whatever else the transport returned. It never tells userland which entry failed. Record the attribute and the transport name of the entry whose errno the call returns, and report both after the loop. NL_SET_BAD_ATTR() names the entry, which the message alone cannot do: a request can carry several entries with the same transport name. The rejections in nfsd_nl_validate_listeners() other than -E2BIG and the unsupported transport name still carry no extack. This patch does not change them. Assisted-by: LLM Signed-off-by: Jeff Layton Link: https://patch.msgid.link/20260901-nfsd-nl-hang-v5-5-a540d86668b0@kernel.org Signed-off-by: Chuck Lever Stable-dep-of: bf0f3a37e6cc ("NFSD: stop registering with rpcbind after a failure in listener_set") Signed-off-by: Sasha Levin commit e51f801132eb1809a0425cc6f430e80df716455e Author: Chuck Lever Date: Thu Nov 5 20:53:00 2026 -0500 NFSD: map fh_verify() status codes for NFS_ACLv2 replies [ Upstream commit ccfc4db5ab740175b9958ea0cf5986957bf4e659 ] The NFS_ACL v2 protocol shares its status code space with NFSv2, which has no NFSERR_BADHANDLE and no NFSERR_NOFILEHANDLE. An NFS_ACLv2 GETACL, SETACL, GETATTR, or ACCESS request that carries a malformed or empty file handle gets a reply with status 10001 or 10020, values the client cannot interpret. Commit 1459ad57673b ("nfsd: Move error code mapping to per-version proc code.") removed the version check from fh_verify() that turned those codes into NFSERR_STALE for any version 2 program. The NFSv2 procedures gained nfsd_map_status() in exchange, but the NFS_ACL v2 procedures did not, so the unmapped status reaches the encoder. Add the same mapping to the NFS_ACL v2 procedures. Fixes: 1459ad57673b ("nfsd: Move error code mapping to per-version proc code.") Cc: stable@vger.kernel.org Reviewed-by: Jeff Layton Link: https://patch.msgid.link/20260916004240.141975-1-cel@kernel.org Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin commit ac5a5205576b2970dd645bf723296b1bf63ea27a Author: Chuck Lever Date: Thu Nov 5 20:52:59 2026 -0500 NFSD: Move version-specific ACCESS maps into per-version code [ Upstream commit 3423b5f91d80d3a76424e1c9f1d0f95d4dd80101 ] nfsd_access() owns three static tables that map on-the-wire ACCESS bits to NFSD_MAY flags, and every NFS version shares them. That puts protocol-version specifics in the version-agnostic VFS layer. The NFSv4.2 extended-attribute bits are wedged into the NFSv3 tables under CONFIG_NFSD_V4. Give each version its own tables in its proc code and pass the matching set into nfsd_access() as a new argument. Splitting the tables also stops the NFSv2-ACL and NFSv3 ACCESS paths from answering for the NFSv4.2 extended-attribute bits. Both use the NFSv4-augmented table whenever CONFIG_NFSD_V4 is set, so an NFSv3 request that sets an xattr bit has it echoed back in the reply even though those bits are undefined for v3. Reviewed-by: Jeff Layton Link: https://patch.msgid.link/20260810141900.33846-2-cel@kernel.org Signed-off-by: Chuck Lever Stable-dep-of: ccfc4db5ab74 ("NFSD: map fh_verify() status codes for NFS_ACLv2 replies") Signed-off-by: Sasha Levin commit 98443548ea3186f748c5d2043ccc46ff6e7d7e55 Author: Chuck Lever Date: Thu Nov 5 20:52:58 2026 -0500 NFSD: Replace nfsd_write()'s "stable" argument with "iocb_flags" [ Upstream commit 7f7dde9a45dfd9b3c9f35cb24aff9e45669071cc ] The current nfsd_write() API is not NFS version-agnostic, as it relies on callers to pass an NFSv3 stable_how value to determine the persistence of the requested WRITE. NFSv2 does not use a stable-how value on the wire, and NFSv4 has its own stable_how4 (though stable_how and stable_how4 happen to share the same numeric values). To remove the dependence on NFSv3-specific XDR values from NFSD's generic VFS APIs, replace nfsd_write()'s stable argument with an argument that passes a set of IOCB flags instead of an XDR-defined value. The NFSv4 WRITE and COPY paths had been borrowing the NFSv3 stable_how constants for their own on-the-wire stable values, relying on the numeric coincidence noted above. Convert those sites to the stable_how4 enumerators so the v4 code expresses its own protocol's values directly, with no change in behavior. While here, bound-check the decoded NFSv3 WRITE stable value, as the NFSv4 WRITE decoder already does, and make the nfsd3_writeargs stable field unsigned to suit. The larger benefit is one less NFSv4 dependency on nfs3.h. Link: https://patch.msgid.link/20260723182043.990391-3-cel@kernel.org Signed-off-by: Chuck Lever Stable-dep-of: ccfc4db5ab74 ("NFSD: map fh_verify() status codes for NFS_ACLv2 replies") Signed-off-by: Sasha Levin commit f365dc588b2a327e693f3203dd1897bd749f6c32 Author: Darrick J. Wong Date: Thu Nov 5 10:47:17 2026 -0500 xfs: improve dirent bounds checking in scrub and repair [ Upstream commit 5d470234d04dae6fe2ca2cf4b9ef277b78c7e05a ] LOLLM complains that we don't do enough bounds checking of the directory entries in directory blocks when we're looking for errors or trying to salvage entries. Let's improve that with more detailed checks. Cc: stable@vger.kernel.org # v4.16 Fixes: ce92d29ddf9908 ("xfs: directory scrubber must walk through data block to offset") Signed-off-by: Darrick J. Wong Assisted-by: LOLLM # finding obvious bugs Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit 15ece5496c9f7eb3825d52c6bb0cd8eb7e69b3f9 Author: Darrick J. Wong Date: Thu Nov 5 10:47:16 2026 -0500 xfs: refactor directory data block walking loops in scrub [ Upstream commit 19b5653cc870788df71e7fcf2dd7b6131d8868dc ] Hoist the inner loop code of the directory data block walking code in the directory scrub and repair code to separate functions in preparation for strengthening the validation in a subsequent patch. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Stable-dep-of: 5d470234d04d ("xfs: improve dirent bounds checking in scrub and repair") Signed-off-by: Sasha Levin commit 0cc08b2ea0908cb3b2bf227b9a4fec0cc96aad91 Author: Darrick J. Wong Date: Thu Nov 5 10:47:29 2026 -0500 xfs: check for buffer overruns when examining local/remote xattr entries [ Upstream commit 91c41f9524906a8ebd2ae68c98a07b4bd5255ddb ] LOLLM noticed that the xattr scrub and repair code can walk off the end of the buffer if the xattr entry record starts so close to the end of the buffer that there's not even space for the entry structure itself. Strengthen the bounds checking here. Cc: stable@vger.kernel.org # v4.15 Fixes: 13791d3b833428 ("xfs: scrub extended attribute leaf space") Signed-off-by: Darrick J. Wong Assisted-by: LOLLM # finding obvious bugs Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin commit b628d6d8b607c8bc7683bbcbba22fc38edd17ddd Author: Darrick J. Wong Date: Thu Nov 5 10:47:28 2026 -0500 xfs: break out xattr entry checks into separate functions [ Upstream commit 9eb04a6d41c7e474d4665118895c3c2d8e5a2741 ] We're going to add more xattr entry checking code in xchk_xattr_entry so break these out into separate functions so that we don't go crazy indenting. There's a slight behavior change here where we skip updating the usedmap if we've decided the xattr structure is corrupt. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Stable-dep-of: 91c41f952490 ("xfs: check for buffer overruns when examining local/remote xattr entries") Signed-off-by: Sasha Levin commit fc5ac6813830eaf5b850e89d57403da1e1c50432 Author: Weiming Shi Date: Thu Nov 5 12:14:24 2026 -0500 smb/server: prevent file publication after tree disconnect [ Upstream commit 2ff3730998b015b5b0a3f28330bee16c648dd114 ] TREE_DISCONNECT closes the tree's published file handles before marking and removing the tree connection. A concurrent CREATE that already holds a tree reference can therefore publish its file after the close pass. When CREATE drops its reference, the tree can be freed while the published file still points to it. Mark and remove the tree connection before closing its files, and serialize both new-open and durable-reconnect volatile ID publication with that state transition. An opener is then either published in time for the close pass or rejected after disconnect with STATUS_NETWORK_NAME_DELETED. Keep a tree reference while a file carries its tree pointer. This protects asynchronous users that can defer the file's final destruction past tree disconnect. The close pass can race the successful FP_NEW to FP_INITED transition. Take the opening request's file reference atomically with that transition. This keeps the file alive until request completion even if teardown removes the ID immediately. BUG: KASAN: slab-use-after-free in proc_show_files (fs/smb/server/vfs_cache.c:126) Read of size 4 at addr ff11000101540f80 by task poc/153 Call Trace: proc_show_files (fs/smb/server/vfs_cache.c:126) seq_read_iter (fs/seq_file.c:231) proc_reg_read_iter (fs/proc/inode.c:299) vfs_read (fs/read_write.c:574) ksys_read (fs/read_write.c:716) do_syscall_64 (arch/x86/entry/syscall_64.c:84) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121) Allocated by: ksmbd_tree_conn_connect (fs/smb/server/mgmt/tree_connect.c:35) smb2_tree_connect (fs/smb/server/smb2pdu.c:2819) handle_ksmbd_work (fs/smb/server/server.c:368) Freed by: kfree (mm/slub.c:6801) handle_ksmbd_work (fs/smb/server/server.c:332) Fixes: f44158485826 ("cifsd: add file operations") Cc: stable@vger.kernel.org Reported-by: Assisted-by: LLM Signed-off-by: Weiming Shi Signed-off-by: Namjae Jeon [ sashal: replaced ksmbd_tree_connect_get() calls with equivalent inline atomic_inc() operations ] Signed-off-by: Sasha Levin commit 2a1a33004230e1bc9a1f979c066fd664bff47eff Author: Jinwang Li Date: Sat Nov 7 18:15:47 2026 -0500 Bluetooth: L2CAP: Ignore connection responses with wrong ident commit a9f9eeb5344fc7dc625e5700ccf09891bc2603b5 upstream. Adjusted context as stable does not have the lockdep_assert_held() call in l2cap_connect_create_rsp(). L2CAP/COS/CED/BI-28-C requires the IUT to ignore a Connection Response that carries an invalid Identifier. l2cap_connect_create_rsp() only checks that a connection request is outstanding, not that the response answers it. Add an ident check against the pending request so that a mismatched response is dropped. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jinwang Li Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Siwei Zhang Signed-off-by: Sasha Levin commit bef1f610bc1f99b349368cb8d9025c2ff66d1fbe Author: Siwei Zhang Date: Sat Nov 7 18:15:46 2026 -0500 Bluetooth: L2CAP: Only accept connection responses to outstanding requests commit a518b9a9ef6ee3b18ecdf6ba5360c608aaf969e9 upstream. Adjusted context as stable does not have the lockdep_assert_held() call and the __must_hold() context analysis annotations. An outgoing channel waits in BT_CONNECT until security and the feature mask exchange complete, and only then sends its connection request. A peer can answer it before that with a connection response matching our source CID. The channel then moves to BT_CONFIG, completes configuration and becomes connected before security has completed. If security then fails, l2cap_security_cfm() leaves the connected channel alone, so it stays up on a link that did not reach the required security level. A connection response with a zero source CID is matched by identifier. Another channel can hold the same identifier for a response it still has to send, so the lookup can pick the wrong channel. Only accept a connection response while our request is outstanding, and only look at such channels when matching by identifier. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Siwei Zhang Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin commit c6f3af8470e4f97553a49c48d9336bdd1f927cb0 Author: Siwei Zhang Date: Sat Nov 7 18:15:45 2026 -0500 Bluetooth: L2CAP: Reject signalling responses in invalid states commit 6320736af7dcb90da6ee9fd651ecc11c564d45b7 upstream. Adjusted context as stable does not have the lockdep_assert_held() calls, and l2cap_get_chan_by_scid() still returns the channel locked, so l2cap_config_rsp() does not lock it again. A peer can send configuration messages while an incoming channel is in BT_CONNECT2, before the security or deferred accept gate has completed. A configuration response can then promote the channel to BT_CONNECTED. Configuration responses can also act on channels that are closing, and a late connection response can move a disconnecting channel back to BT_CONFIG. Accept connection responses only while waiting in BT_CONNECT. Answer configuration requests in BT_CONNECT2, but defer our own request until BT_CONFIG so configuration cannot complete before the gate. Ignore configuration responses outside BT_CONFIG and BT_CONNECTED, and only complete configuration in BT_CONFIG. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Siwei Zhang Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin commit deb8b87c027db150de626a5808f648b1e52d90a1 Author: Ashok Raj Date: Fri Sep 11 14:53:04 2026 -0700 cxl/features: Ensure that count is set before access to ent[] __counted_by() [ Upstream commit c1031c2474f73261d8d5e4deef2b5dc20fb964f5 ] get_supported_features() assigns entries->num_features only after the memcpy() loop that fills entries->ent[] has already run. Since ent[] is __counted_by(num_features), the compiler's bounds instrumentation sees a 0-length array during that loop and FORTIFY_SOURCE trips on the memcpy. Set @num_features right after allocation, before any write into ent[], so the bound is correct for the whole lifetime of the array. This was found via a fortify panic: memcpy: detected buffer overflow: 384 byte write of buffer size 0 WARNING: lib/string_helpers.c:1035 at __fortify_report+0x54/0xa0 kernel BUG at lib/string_helpers.c:1043! Call trace: __fortify_panic+0x10/0x18 get_supported_features.isra.0+0x4a0/0x4d0 [cxl_core] devm_cxl_setup_features+0x84/0x120 [cxl_core] cxl_pci_probe+0x254/0x5e0 [cxl_pci] Same class of bug, same fix shape as commit 6c9d2e87df40 ("cxl/fwctl: Fix __fortify_panic"), which fixed the analogous issue in cxlctl_get_supported_features() but missed this one. [ dj: Fixed up title typo per Jonathan. ] Fixes: f0e6a2329bf9 ("cxl: Add Get Supported Features command for kernel usage") Signed-off-by: Ashok Raj Reviewed-by: Dave Jiang Reviewed-by: Jonathan Cameron Link: https://patch.msgid.link/20260911215304.1816467-1-ashok.raj@oss.qualcomm.com Signed-off-by: Dave Jiang Signed-off-by: Sasha Levin