|
@@ -459,8 +459,16 @@ static int tomoyo_write_profile(struct tomoyo_io_buffer *head)
|
|
|
if (profile == &tomoyo_default_profile)
|
|
|
return -EINVAL;
|
|
|
if (!strcmp(data, "COMMENT")) {
|
|
|
- const struct tomoyo_path_info *old_comment = profile->comment;
|
|
|
- profile->comment = tomoyo_get_name(cp);
|
|
|
+ static DEFINE_SPINLOCK(lock);
|
|
|
+ const struct tomoyo_path_info *new_comment
|
|
|
+ = tomoyo_get_name(cp);
|
|
|
+ const struct tomoyo_path_info *old_comment;
|
|
|
+ if (!new_comment)
|
|
|
+ return -ENOMEM;
|
|
|
+ spin_lock(&lock);
|
|
|
+ old_comment = profile->comment;
|
|
|
+ profile->comment = new_comment;
|
|
|
+ spin_unlock(&lock);
|
|
|
tomoyo_put_name(old_comment);
|
|
|
return 0;
|
|
|
}
|