[PATCH 20/46] mm/gup: fix clearing folios in memfd_pin_folios()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Mon Oct 26 17:13:03 PDT 2026


> From: Chris Mason <mason at kernel.org>
> 
> 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 at vger.kernel.org
> Signed-off-by: Chris Mason <mason at kernel.org>
> [ david: simplify description and comment ]
> Signed-off-by: David Hildenbrand (Arm) <david at kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261027-fixes_core-v1-0-6f74bec9a5bb@kernel.org?part=20




More information about the kexec mailing list