fsverity now exposes fsverity_ensure_verity_info() which could be used instead of opening file to ensure that fsverity info is loaded and attached to inode. Signed-off-by: Andrey Albershteyn Acked-by: Amir Goldstein --- fs/overlayfs/util.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index 2ea769f311c3..dd2e81022e4f 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "overlayfs.h" /* Get write access to upper mnt - may fail if upper sb was remounted ro */ @@ -1377,18 +1378,9 @@ 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 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()); - if (IS_ERR(filp)) - return PTR_ERR(filp); - fput(filp); - } + if (fsverity_active(inode)) + return fsverity_ensure_verity_info(inode); return 0; } -- 2.51.2