diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 14:21:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 14:21:12 -0400 |
commit | 172f993a2941ec60685c7e33af8be701759de1ab (patch) | |
tree | 2ee072d56de4a1bfe4ee6873941870837162ffba /security/selinux/hooks.c | |
parent | 7272c30b6fbc051bf8a3f3c973e64f230c91c8b3 (diff) | |
parent | e3fea3f70fd68af0574a5f24246cdb4ed07f2b74 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem bugfixes from James Morris.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
selinux: fix selinux_inode_setxattr oops
KEYS: linux/key-type.h needs linux/errno.h
smack: off by one error
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 94c45a1531a4..79690f401a58 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2791,11 +2791,16 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
2791 | 2791 | ||
2792 | /* We strip a nul only if it is at the end, otherwise the | 2792 | /* We strip a nul only if it is at the end, otherwise the |
2793 | * context contains a nul and we should audit that */ | 2793 | * context contains a nul and we should audit that */ |
2794 | str = value; | 2794 | if (value) { |
2795 | if (str[size - 1] == '\0') | 2795 | str = value; |
2796 | audit_size = size - 1; | 2796 | if (str[size - 1] == '\0') |
2797 | else | 2797 | audit_size = size - 1; |
2798 | audit_size = size; | 2798 | else |
2799 | audit_size = size; | ||
2800 | } else { | ||
2801 | str = ""; | ||
2802 | audit_size = 0; | ||
2803 | } | ||
2799 | ab = audit_log_start(current->audit_context, GFP_ATOMIC, AUDIT_SELINUX_ERR); | 2804 | ab = audit_log_start(current->audit_context, GFP_ATOMIC, AUDIT_SELINUX_ERR); |
2800 | audit_log_format(ab, "op=setxattr invalid_context="); | 2805 | audit_log_format(ab, "op=setxattr invalid_context="); |
2801 | audit_log_n_untrustedstring(ab, value, audit_size); | 2806 | audit_log_n_untrustedstring(ab, value, audit_size); |