Re: [PATCH v3] mm/shmem: fix THP allocation and fallback loop
From: Baolin Wang
Date: Thu Oct 23 2025 - 20:47:03 EST
On 2025/10/23 14:59, Kairui Song wrote:
From: Kairui Song <kasong@xxxxxxxxxxx>
The order check and fallback loop is updating the index value on every
loop, this will cause the index to be wrongly aligned by a larger value
while the loop shrinks the order.
This may result in inserting and returning a folio of the wrong index
and cause data corruption with some userspace workloads [1].
Cc: stable@xxxxxxxxxxxxxxx
Link: https://lore.kernel.org/linux-mm/CAMgjq7DqgAmj25nDUwwu1U2cSGSn8n4-Hqpgottedy0S6YYeUw@xxxxxxxxxxxxxx/ [1]
Fixes: e7a2ab7b3bb5d ("mm: shmem: add mTHP support for anonymous shmem")
Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
---
LGTM. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>