Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

userns: Replace user_ns_map_uid and user_ns_map_gid with from_kuid and from_kgid

These function are no longer needed replace them with their more useful equivalents.

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

+4 -17
-12
include/linux/user_namespace.h
··· 69 69 70 70 #endif 71 71 72 - static inline uid_t user_ns_map_uid(struct user_namespace *to, 73 - const struct cred *cred, kuid_t uid) 74 - { 75 - return from_kuid_munged(to, uid); 76 - } 77 - 78 - static inline gid_t user_ns_map_gid(struct user_namespace *to, 79 - const struct cred *cred, kgid_t gid) 80 - { 81 - return from_kgid_munged(to, gid); 82 - } 83 - 84 72 #endif /* _LINUX_USER_H */
+1 -2
ipc/mqueue.c
··· 538 538 rcu_read_lock(); 539 539 sig_i.si_pid = task_tgid_nr_ns(current, 540 540 ns_of_pid(info->notify_owner)); 541 - sig_i.si_uid = user_ns_map_uid(info->notify_user_ns, 542 - current_cred(), current_uid()); 541 + sig_i.si_uid = from_kuid_munged(info->notify_user_ns, current_uid()); 543 542 rcu_read_unlock(); 544 543 545 544 kill_pid_info(info->notify.sigev_signo,
+1 -1
kernel/signal.c
··· 1026 1026 static inline uid_t map_cred_ns(const struct cred *cred, 1027 1027 struct user_namespace *ns) 1028 1028 { 1029 - return user_ns_map_uid(ns, cred, cred->uid); 1029 + return from_kuid_munged(ns, cred->uid); 1030 1030 } 1031 1031 1032 1032 #ifdef CONFIG_USER_NS
+2 -2
net/core/sock.c
··· 821 821 if (cred) { 822 822 struct user_namespace *current_ns = current_user_ns(); 823 823 824 - ucred->uid = user_ns_map_uid(current_ns, cred, cred->euid); 825 - ucred->gid = user_ns_map_gid(current_ns, cred, cred->egid); 824 + ucred->uid = from_kuid(current_ns, cred->euid); 825 + ucred->gid = from_kgid(current_ns, cred->egid); 826 826 } 827 827 } 828 828 EXPORT_SYMBOL_GPL(cred_to_ucred);