[PATCH 07/13] ima,evm: use d_real_metadata_inode()

From: Christian Brauner

Date: Sun Nov 15 2026 - 09:04:06 EST


d_real() is about to be able to fail for D_REAL_DATA. D_REAL_METADATA
never has to look anything up and can't fail. Make that explicit and
switch the open-coded d_inode(d_real(..., D_REAL_METADATA)) in
process_measurement() and evm_calc_hmac_or_hash() over to
d_real_metadata_inode().

No functional changes.

Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
---
security/integrity/evm/evm_crypto.c | 2 +-
security/integrity/ima/ima_main.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index 1c41af2f91a60..1b50cb4913d0b 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -231,7 +231,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry,
uint8_t type, struct evm_digest *data,
struct evm_iint_cache *iint)
{
- struct inode *inode = d_inode(d_real(dentry, D_REAL_METADATA));
+ struct inode *inode = d_real_metadata_inode(dentry);
struct xattr_list *xattr;
struct shash_desc *desc;
size_t xattr_size = 0;
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index e463cfc1e3f43..9df7fbe3523e8 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -359,8 +359,7 @@ static int process_measurement(struct file *file, const struct cred *cred,
/*
* Reset the EVM status when metadata changed.
*/
- metadata_inode = d_inode(d_real(file_dentry(file),
- D_REAL_METADATA));
+ metadata_inode = d_real_metadata_inode(file_dentry(file));
if (evm_metadata_changed(inode, metadata_inode))
iint->flags &= ~(IMA_APPRAISED |
IMA_APPRAISED_SUBMASK);

--
2.53.0