diff options
author | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2011-05-13 12:53:38 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2011-07-18 12:29:50 -0400 |
commit | 817b54aa45db03437c6d09a7693fc6926eb8e822 (patch) | |
tree | 03d43f3abfbd8670e3a30a33ef868ec7705ef2c4 /security/security.c | |
parent | 7102ebcd65c1cdb5d5a87c7c5cf7a46f5afb0cac (diff) |
evm: add evm_inode_setattr to prevent updating an invalid security.evm
Permit changing of security.evm only when valid, unless in fixmode.
Reported-by: Roberto Sassu <roberto.sassu@polito.it>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/security/security.c b/security/security.c index 181990ae90c1..19251ccb2de0 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -571,9 +571,14 @@ int security_inode_exec_permission(struct inode *inode, unsigned int flags) | |||
571 | 571 | ||
572 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) | 572 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) |
573 | { | 573 | { |
574 | int ret; | ||
575 | |||
574 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 576 | if (unlikely(IS_PRIVATE(dentry->d_inode))) |
575 | return 0; | 577 | return 0; |
576 | return security_ops->inode_setattr(dentry, attr); | 578 | ret = security_ops->inode_setattr(dentry, attr); |
579 | if (ret) | ||
580 | return ret; | ||
581 | return evm_inode_setattr(dentry, attr); | ||
577 | } | 582 | } |
578 | EXPORT_SYMBOL_GPL(security_inode_setattr); | 583 | EXPORT_SYMBOL_GPL(security_inode_setattr); |
579 | 584 | ||