diff options
author | James Morris <jmorris@namei.org> | 2011-05-24 08:55:24 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-05-24 08:55:24 -0400 |
commit | 434d42cfd05a7cc452457a81d2029540cba12150 (patch) | |
tree | 3a6b9b7f9ff2e1b7409dd66c15242b2a75aa4422 /security/tomoyo/common.c | |
parent | d762f4383100c2a87b1a3f2d678cd3b5425655b4 (diff) | |
parent | 12a5a2621b1ee14d32beca35304d7c6076a58815 (diff) |
Merge branch 'next' into for-linus
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 | } |