evm: call evm_inode_init_security from security_inode_init_security
Changelog v7: - moved the initialization call to security_inode_init_security, renaming evm_inode_post_init_security to evm_inode_init_security - increase size of xattr array for EVM xattr Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
This commit is contained in:
parent
cb72318069
commit
823eb1ccd0
|
@ -20,7 +20,7 @@
|
||||||
#include <linux/ima.h>
|
#include <linux/ima.h>
|
||||||
#include <linux/evm.h>
|
#include <linux/evm.h>
|
||||||
|
|
||||||
#define MAX_LSM_XATTR 1
|
#define MAX_LSM_EVM_XATTR 2
|
||||||
|
|
||||||
/* Boot-time LSM user choice */
|
/* Boot-time LSM user choice */
|
||||||
static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] =
|
static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] =
|
||||||
|
@ -346,8 +346,8 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
|
||||||
const struct qstr *qstr,
|
const struct qstr *qstr,
|
||||||
const initxattrs initxattrs, void *fs_data)
|
const initxattrs initxattrs, void *fs_data)
|
||||||
{
|
{
|
||||||
struct xattr new_xattrs[MAX_LSM_XATTR + 1];
|
struct xattr new_xattrs[MAX_LSM_EVM_XATTR + 1];
|
||||||
struct xattr *lsm_xattr;
|
struct xattr *lsm_xattr, *evm_xattr, *xattr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (unlikely(IS_PRIVATE(inode)))
|
if (unlikely(IS_PRIVATE(inode)))
|
||||||
|
@ -364,11 +364,17 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
|
||||||
&lsm_xattr->value_len);
|
&lsm_xattr->value_len);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
evm_xattr = lsm_xattr + 1;
|
||||||
|
ret = evm_inode_init_security(inode, lsm_xattr, evm_xattr);
|
||||||
|
if (ret)
|
||||||
|
goto out;
|
||||||
ret = initxattrs(inode, new_xattrs, fs_data);
|
ret = initxattrs(inode, new_xattrs, fs_data);
|
||||||
out:
|
out:
|
||||||
kfree(lsm_xattr->name);
|
for (xattr = new_xattrs; xattr->name != NULL; xattr++) {
|
||||||
kfree(lsm_xattr->value);
|
kfree(xattr->name);
|
||||||
|
kfree(xattr->value);
|
||||||
|
}
|
||||||
return (ret == -EOPNOTSUPP) ? 0 : ret;
|
return (ret == -EOPNOTSUPP) ? 0 : ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(security_inode_init_security);
|
EXPORT_SYMBOL(security_inode_init_security);
|
||||||
|
|
Loading…
Reference in New Issue