Re: [PATCH 10/12] ovl: take freeze protection when storing the uuid

From: Amir Goldstein

Date: Sat Nov 14 2026 - 07:20:30 EST


On Sat, Nov 14, 2026 at 11:47:17AM +0100, Christian Brauner wrote:
> ovl_init_uuid_xattr() stores the persistent uuid in an xattr on the
> upper root. That happens after ovl_make_workdir() dropped its write
> access to the upper mount and before ovl_get_indexdir() takes it
> again. So a freeze of the upper filesystem that lands in between lets
> the mount modify a frozen filesystem.
>
> Take write access to the upper mount around the xattr update.
>
> Fixes: d9544c1b0d9e ("ovl: store persistent uuid/fsid with uuid=on")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>

Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>

Thanks,
Amir.

> ---
> fs/overlayfs/util.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
> index 521717209b2e4..67aa7b71e9c83 100644
> --- a/fs/overlayfs/util.c
> +++ b/fs/overlayfs/util.c
> @@ -829,8 +829,12 @@ bool ovl_init_uuid_xattr(struct super_block *sb, struct ovl_fs *ofs,
>
> /* Try to store persistent uuid */
> set = true;
> - res = ovl_setxattr(ofs, upperpath->dentry, OVL_XATTR_UUID, uuid.b,
> - UUID_SIZE);
> + res = mnt_want_write(ovl_upper_mnt(ofs));
> + if (!res) {
> + res = ovl_setxattr(ofs, upperpath->dentry, OVL_XATTR_UUID,
> + uuid.b, UUID_SIZE);
> + mnt_drop_write(ovl_upper_mnt(ofs));
> + }
> if (res)
> goto fail;
>
>
> --
> 2.53.0
>