diff options
| author | Usama Arif <usama.arif@linux.dev> | 2026-07-06 04:42:06 -0700 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-07-22 21:11:49 -0700 |
| commit | e60efff765fed2b9d4d163f42f47e3591d501113 (patch) | |
| tree | 7d9cf55075841df0d5da73a33525c9747b522021 /include/linux/fcdevice.h | |
| parent | 0a2f6ca7154e9cba9f601362a64efd80b6544428 (diff) | |
| download | linux-next-e60efff765fed2b9d4d163f42f47e3591d501113.tar.gz linux-next-e60efff765fed2b9d4d163f42f47e3591d501113.zip | |
mm/huge_memory: move softleaf_to_folio() inside migration branch
change_non_present_huge_pmd() calls softleaf_to_folio() unconditionally at
the top of the function. softleaf_to_folio() extracts a PFN from the
entry and converts it to a folio pointer, which is only meaningful for
migration and device_private entries that encode a real PFN.
A swap entry encodes a swap offset instead, so softleaf_to_folio() would
produce a bogus pointer and crash on mprotect() when a PMD swap entry is
present.
Move the call into the migration_write branch where the folio is actually
used, so the function is safe for any non-present PMD type.
Link: https://lore.kernel.org/20260706114320.1643046-5-usama.arif@linux.dev
Signed-off-by: Usama Arif <usama.arif@linux.dev>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Baoquan He <baoquan.he@linux.dev>
Cc: Barry Song <baohua@kernel.org>
Cc: Chris Li <chrisl@kernel.org>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Kiryl Shutsemau <kas@kernel.org>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Nico Pache <npache@redhat.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/fcdevice.h')
0 files changed, 0 insertions, 0 deletions
