ovl: fix verity lazy-load guard broken by fsverity_active() semantic change
Subsystems (4)
Eric Biggers
maintainerPATCH v2 1/1 ovl: fix verity lazy-load guard broken by fsverity_active() semantic change
From: Colin Walters <[email protected]>
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.
---
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(-)
fs/overlayfs/util.c +1 -1
@@ -1352,11 +1352,11 @@ char *ovl_get_redirect_xattr(struct ovl_fs *ofs, const struct path *path, int paint 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
Signature · 1 line
2.54.0