aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/tomoyo.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/tomoyo/tomoyo.c')
-rw-r--r--security/tomoyo/tomoyo.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index c2d04a50f76a..d88eb3a046ed 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -373,13 +373,15 @@ static int tomoyo_path_chmod(struct path *path, umode_t mode)
373 * 373 *
374 * Returns 0 on success, negative value otherwise. 374 * Returns 0 on success, negative value otherwise.
375 */ 375 */
376static int tomoyo_path_chown(struct path *path, uid_t uid, gid_t gid) 376static int tomoyo_path_chown(struct path *path, kuid_t uid, kgid_t gid)
377{ 377{
378 int error = 0; 378 int error = 0;
379 if (uid != (uid_t) -1) 379 if (uid_valid(uid))
380 error = tomoyo_path_number_perm(TOMOYO_TYPE_CHOWN, path, uid); 380 error = tomoyo_path_number_perm(TOMOYO_TYPE_CHOWN, path,
381 if (!error && gid != (gid_t) -1) 381 from_kuid(&init_user_ns, uid));
382 error = tomoyo_path_number_perm(TOMOYO_TYPE_CHGRP, path, gid); 382 if (!error && gid_valid(gid))
383 error = tomoyo_path_number_perm(TOMOYO_TYPE_CHGRP, path,
384 from_kgid(&init_user_ns, gid));
383 return error; 385 return error;
384} 386}
385 387