Re: [PATCH v13 07/23] fs,fsverity: remove check for fsverity being enabled in setattr_prepare()

Eric Biggers <[email protected]> Fri, 24 Jul 2026 16:25:40 -0700
Newsgroups dev.linux.lists.fsverity,net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-ext4,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-xfs
Message-ID <20260724232540.GA1901@sol>
On Tue, Jul 21, 2026 at 08:40:44PM +0200, Andrey Albershteyn wrote:
> The check that fs-verity is available in the kernel is not necessary
> here. Filesystems could have fsverity files even without fs-verity
> module, then truncate will succeed. Previously, this would return
> EOPNOTSUPP if verity is missing, but if it's not EPERM was returned
> anyway.
> 
> Fixes: e9734653c523 ("fs,fsverity: reject size changes on fsverity files in setattr_prepare")
> Signed-off-by: Andrey Albershteyn <[email protected]>
> ---
>  fs/attr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/attr.c b/fs/attr.c
> index 4f437fabb7f0..71888ac903c2 100644
> --- a/fs/attr.c
> +++ b/fs/attr.c
> @@ -176,7 +176,7 @@ int setattr_prepare(struct mnt_idmap *idmap, struct dentry *dentry,
>  		 * covered by the open-time check because sys_truncate() takes a
>  		 * path, not an open file.
>  		 */
> -		if (IS_ENABLED(CONFIG_FS_VERITY) && IS_VERITY(inode))
> +		if (IS_VERITY(inode))
>  			return -EPERM;

I'm confused what the commit message is trying to say.  But ignoring
that and looking at the actual diff, it looks good.  Not sure how we
missed this.

Acked-by: Eric Biggers <[email protected]>

Please add Cc stable as well.

- Eric