[PATCH 22/23] LSM: Fix setting of the IMA data in inode init

From: Casey Schaufler
Date: Thu May 10 2018 - 20:56:23 EST


From: Casey Schaufler <casey@xxxxxxxxxxxxxxxx>
Date: Thu, 10 May 2018 16:23:47 -0700
Subject: [PATCH 22/23] LSM: Fix setting of the IMA data in inode init

Fix a missing assignment in the inode security initialization.
The EVM entry was not being set correctly.

Signed-off-by: Casey Schaufler <casey@xxxxxxxxxxxxxxxx>
---
security/security.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/security/security.c b/security/security.c
index ef51783e967e..571643cc7256 100644
--- a/security/security.c
+++ b/security/security.c
@@ -941,6 +941,7 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
&lsm_xattr->value_len);
if (rc == 0) {
lsm_xattr++;
+ evm_xattr = lsm_xattr;
if (ret == -EOPNOTSUPP)
ret = 0;
} else if (rc != -EOPNOTSUPP) {
@@ -950,7 +951,7 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
}

if (ret == 0) {
- rc = evm_inode_init_security(inode, lsm_xattr, evm_xattr);
+ rc = evm_inode_init_security(inode, new_xattrs, evm_xattr);
if (rc == 0)
rc = initxattrs(inode, new_xattrs, fs_data);
}
--
2.14.3