[PATCH] ovl: fix verity lazy-load guard broken by fsverity_active() semantic change

"Colin Walters" <[email protected]> Tue, 05 May 2026 14:15:58 -0400
Newsgroups dev.linux.lists.fsverity,org.kernel.vger.linux-fsdevel
Message-ID <[email protected]>
Commit f77f281b6118 ("fsverity: use a hashtable to find the fsverity_info")
that broke `ovl_ensure_verity_loaded` in the case when the inode was not in core.

The APIs here are in my opinion now confusing, but this patch intentionally
aims for a minimized fix by using `fsverity_get_info()` which ensures
the hash table is loaded.

Fixes: f77f281b6118 ("fsverity: use a hashtable to find the fsverity_info")
Cc: [email protected]
Link: https://github.com/bootc-dev/bootc/issues/2174
Signed-off-by: Colin Walters <[email protected]>
---
 fs/overlayfs/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 7b86a6bac644..bfdf9310ee78 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -1354,7 +1354,7 @@ int ovl_ensure_verity_loaded(const struct path *datapath)
 	struct inode *inode = d_inode(datapath->dentry);
 	struct file *filp;
 
-	if (!fsverity_active(inode) && IS_VERITY(inode)) {
+	if (IS_VERITY(inode) && !fsverity_get_info(inode)) {
 		/*
 		 * If this inode was not yet opened, the verity info hasn't been
 		 * loaded yet, so we need to do that here to force it into memory.
-- 
2.52.0