clear-pkgs-linux-iot-lts2018/0108-LSM-fix-for-security_i...

44 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Casey Schaufler <casey.schaufler@intel.com>
Date: Thu, 20 Sep 2018 15:58:32 -0700
Subject: [PATCH] LSM: fix for security_inode_init_security and IMA
Correct the initialization of inodes with regard to IMA.
Signed-off-by: Casey Schaufler <casey.schaufler@intel.com>
Signed-off-by: Min He <min.he@intel.com>
---
security/security.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/security/security.c b/security/security.c
index e0651d3..11b1154 100644
--- a/security/security.c
+++ b/security/security.c
@@ -955,9 +955,9 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
}
if (ret == 0) {
- rc = evm_inode_init_security(inode, new_xattrs, evm_xattr);
- if (rc == 0)
- rc = initxattrs(inode, new_xattrs, fs_data);
+ ret = evm_inode_init_security(inode, new_xattrs, evm_xattr);
+ if (ret == 0)
+ ret = initxattrs(inode, new_xattrs, fs_data);
}
if (lsm_xattr != new_xattrs) {
@@ -965,9 +965,6 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
kfree(xattr->value);
}
- if (rc != 0)
- return rc;
-
return (ret == -EOPNOTSUPP) ? 0 : ret;
}
EXPORT_SYMBOL(security_inode_init_security);
--
https://clearlinux.org