Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH v2] ovl: fix verity lazy-load guard broken by fsverity_active() semantic change
@ 2026-05-05 22:42 Eric Biggers
  0 siblings, 0 replies; only message in thread
From: Eric Biggers @ 2026-05-05 22:42 UTC (permalink / raw)
  To: fsverity
  Cc: linux-fsdevel, Miklos Szeredi, Amir Goldstein, Christoph Hellwig,
	Colin Walters, stable, Eric Biggers

From: Colin Walters <walters@verbum.org>

Commit f77f281b6118 ("fsverity: use a hashtable to find the
fsverity_info") made fsverity_active() check whether the inode has the
verity flag, rather than whether the inode's fsverity_info is loaded.
This broke ovl_ensure_verity_loaded(), which wants to load the
fsverity_info for any verity inodes that haven't had it loaded yet.

Therefore, to check that the fsverity_info hasn't yet been loaded, use
fsverity_get_info(inode) == NULL instead of !fsverity_active(inode).

Also, since fsverity_get_info() now involves a hash table lookup, put
the more lightweight IS_VERITY() flag check first.

Fixes: f77f281b6118 ("fsverity: use a hashtable to find the fsverity_info")
Cc: stable@vger.kernel.org
Link: https://github.com/bootc-dev/bootc/issues/2174
Signed-off-by: Colin Walters <walters@verbum.org>
Link: https://lore.kernel.org/r/6630d44f-967d-41f0-81ce-6958b371465a@app.fastmail.com
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---

v2: improved commit message, and use '== NULL' to make it clear that
    it's a check for a NULL pointer.

 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..b41f4788e4f0 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -1352,11 +1352,11 @@ char *ovl_get_redirect_xattr(struct ovl_fs *ofs, const struct path *path, int pa
 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) == NULL) {
 		/*
 		 * 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.
 		 */
 		filp = kernel_file_open(datapath, O_RDONLY, current_cred());

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.54.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-05 22:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 22:42 [PATCH v2] ovl: fix verity lazy-load guard broken by fsverity_active() semantic change Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox