diff options
author | Jan Kara <jack@suse.cz> | 2012-01-03 07:14:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-03 19:12:19 -0500 |
commit | 30e053248da178cf6154bb7e950dc8713567e3fa (patch) | |
tree | 3ef4cb7f85f581fe53361ea0eb2586a8b6e696c2 | |
parent | 4376eee92e5a8332b470040e672ea99cd44c826a (diff) |
security: Fix security_old_inode_init_security() when CONFIG_SECURITY is not set
Commit 1e39f384bb01 ("evm: fix build problems") makes the stub version
of security_old_inode_init_security() return 0 when CONFIG_SECURITY is
not set.
But that makes callers such as reiserfs_security_init() assume that
security_old_inode_init_security() has set name, value, and len
arguments properly - but security_old_inode_init_security() left them
uninitialized which then results in interesting failures.
Revert security_old_inode_init_security() to the old behavior of
returning EOPNOTSUPP since both callers (reiserfs and ocfs2) handle this
just fine.
[ Also fixed the S_PRIVATE(inode) case of the actual non-stub
security_old_inode_init_security() function to return EOPNOTSUPP
for the same reason, as pointed out by Mimi Zohar.
It got incorrectly changed to match the new function in commit
fb88c2b6cbb1: "evm: fix security/security_old_init_security return
code". - Linus ]
Reported-by: Jorge Bastos <mysql.jorge@decimal.pt>
Acked-by: James Morris <jmorris@namei.org>
Acked-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/security.h | 2 | ||||
-rw-r--r-- | security/security.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index 19d8e04e1688..e8c619d39291 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -2056,7 +2056,7 @@ static inline int security_old_inode_init_security(struct inode *inode, | |||
2056 | char **name, void **value, | 2056 | char **name, void **value, |
2057 | size_t *len) | 2057 | size_t *len) |
2058 | { | 2058 | { |
2059 | return 0; | 2059 | return -EOPNOTSUPP; |
2060 | } | 2060 | } |
2061 | 2061 | ||
2062 | static inline int security_inode_create(struct inode *dir, | 2062 | static inline int security_inode_create(struct inode *dir, |
diff --git a/security/security.c b/security/security.c index 0c6cc69c8f86..e2f684aeb70c 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -381,7 +381,7 @@ int security_old_inode_init_security(struct inode *inode, struct inode *dir, | |||
381 | void **value, size_t *len) | 381 | void **value, size_t *len) |
382 | { | 382 | { |
383 | if (unlikely(IS_PRIVATE(inode))) | 383 | if (unlikely(IS_PRIVATE(inode))) |
384 | return 0; | 384 | return -EOPNOTSUPP; |
385 | return security_ops->inode_init_security(inode, dir, qstr, name, value, | 385 | return security_ops->inode_init_security(inode, dir, qstr, name, value, |
386 | len); | 386 | len); |
387 | } | 387 | } |