Re: [PATCH] tmpfs: reset the memory policy on remount with mpol=default

From: Baolin Wang

Date: Mon Nov 30 2026 - 03:00:54 EST




On 11/28/26 7:00 AM, Yifan Feng wrote:
mpol_parse_str() returns a NULL policy for "default", and
shmem_reconfigure() takes a NULL ctx->mpol to mean that no mpol option
was given. So a remount with mpol=default succeeds but keeps the old
policy:

# mount -t tmpfs -o mpol=bind:1 none /mnt
# mount -o remount,mpol=default /mnt
# grep /mnt /proc/mounts
none /mnt tmpfs rw,relatime,mpol=bind:1 0 0

Record that an mpol option was parsed, and replace the policy whenever
one was.

Fixes: 5f00110f7273 ("tmpfs: fix use-after-free of mempolicy object")
Signed-off-by: Yifan Feng <evanfengff@xxxxxxxxx>
---

Good catch.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>