diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 16:38:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 16:38:19 -0400 |
commit | b0ca118dbacbc6c35e15f216e25e95cca7aedf5b (patch) | |
tree | 6c61c91ff0174c8774d4010b892ecf0bed560910 /security/tomoyo/common.c | |
parent | 2bb732cdb48d271ff7a910260ffb851fb4bc8a28 (diff) | |
parent | b7b57551bbda1390959207f79f2038aa7adb72ae (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: (43 commits)
TOMOYO: Fix wrong domainname validation.
SELINUX: add /sys/fs/selinux mount point to put selinuxfs
CRED: Fix load_flat_shared_library() to initialise bprm correctly
SELinux: introduce path_has_perm
flex_array: allow 0 length elements
flex_arrays: allow zero length flex arrays
flex_array: flex_array_prealloc takes a number of elements, not an end
SELinux: pass last path component in may_create
SELinux: put name based create rules in a hashtable
SELinux: generic hashtab entry counter
SELinux: calculate and print hashtab stats with a generic function
SELinux: skip filename trans rules if ttype does not match parent dir
SELinux: rename filename_compute_type argument to *type instead of *con
SELinux: fix comment to state filename_compute_type takes an objname not a qstr
SMACK: smack_file_lock can use the struct path
LSM: separate LSM_AUDIT_DATA_DENTRY from LSM_AUDIT_DATA_PATH
LSM: split LSM_AUDIT_DATA_FS into _PATH and _INODE
SELINUX: Make selinux cache VFS RCU walks safe
SECURITY: Move exec_permission RCU checks into security modules
SELinux: security_read_policy should take a size_t not ssize_t
...
Diffstat (limited to 'security/tomoyo/common.c')
-rw-r--r-- | security/tomoyo/common.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 7556315c1978..a0d09e56874b 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c | |||
@@ -108,10 +108,9 @@ static bool tomoyo_flush(struct tomoyo_io_buffer *head) | |||
108 | head->read_user_buf += len; | 108 | head->read_user_buf += len; |
109 | w += len; | 109 | w += len; |
110 | } | 110 | } |
111 | if (*w) { | 111 | head->r.w[0] = w; |
112 | head->r.w[0] = w; | 112 | if (*w) |
113 | return false; | 113 | return false; |
114 | } | ||
115 | /* Add '\0' for query. */ | 114 | /* Add '\0' for query. */ |
116 | if (head->poll) { | 115 | if (head->poll) { |
117 | if (!head->read_user_buf_avail || | 116 | if (!head->read_user_buf_avail || |
@@ -459,8 +458,16 @@ static int tomoyo_write_profile(struct tomoyo_io_buffer *head) | |||
459 | if (profile == &tomoyo_default_profile) | 458 | if (profile == &tomoyo_default_profile) |
460 | return -EINVAL; | 459 | return -EINVAL; |
461 | if (!strcmp(data, "COMMENT")) { | 460 | if (!strcmp(data, "COMMENT")) { |
462 | const struct tomoyo_path_info *old_comment = profile->comment; | 461 | static DEFINE_SPINLOCK(lock); |
463 | profile->comment = tomoyo_get_name(cp); | 462 | const struct tomoyo_path_info *new_comment |
463 | = tomoyo_get_name(cp); | ||
464 | const struct tomoyo_path_info *old_comment; | ||
465 | if (!new_comment) | ||
466 | return -ENOMEM; | ||
467 | spin_lock(&lock); | ||
468 | old_comment = profile->comment; | ||
469 | profile->comment = new_comment; | ||
470 | spin_unlock(&lock); | ||
464 | tomoyo_put_name(old_comment); | 471 | tomoyo_put_name(old_comment); |
465 | return 0; | 472 | return 0; |
466 | } | 473 | } |