Commit cdf8c58a3546443073cab77d07a88ee439319c19

Authored by Eric W. Biederman
1 parent a7d9cfe97b

userns: Convert ecryptfs to use kuid/kgid where appropriate

Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Dustin Kirkland <dustin.kirkland@gazzang.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Showing 3 changed files with 5 additions and 6 deletions Side-by-side Diff

... ... @@ -544,11 +544,12 @@
544 544 goto out_free;
545 545 }
546 546  
547   - if (check_ruid && path.dentry->d_inode->i_uid != current_uid()) {
  547 + if (check_ruid && !uid_eq(path.dentry->d_inode->i_uid, current_uid())) {
548 548 rc = -EPERM;
549 549 printk(KERN_ERR "Mount of device (uid: %d) not owned by "
550 550 "requested user (uid: %d)\n",
551   - path.dentry->d_inode->i_uid, current_uid());
  551 + i_uid_read(path.dentry->d_inode),
  552 + from_kuid(&init_user_ns, current_uid()));
552 553 goto out_free;
553 554 }
554 555  
fs/ecryptfs/messaging.c
... ... @@ -33,7 +33,7 @@
33 33 struct mutex ecryptfs_daemon_hash_mux;
34 34 static int ecryptfs_hash_bits;
35 35 #define ecryptfs_current_euid_hash(uid) \
36   - hash_long((unsigned long)current_euid(), ecryptfs_hash_bits)
  36 + hash_long((unsigned long)from_kuid(&init_user_ns, current_euid()), ecryptfs_hash_bits)
37 37  
38 38 static u32 ecryptfs_msg_counter;
39 39 static struct ecryptfs_msg_ctx *ecryptfs_msg_ctx_arr;
... ... @@ -121,8 +121,7 @@
121 121 hlist_for_each_entry(*daemon, elem,
122 122 &ecryptfs_daemon_hash[ecryptfs_current_euid_hash()],
123 123 euid_chain) {
124   - if ((*daemon)->file->f_cred->euid == current_euid() &&
125   - (*daemon)->file->f_cred->user_ns == current_user_ns()) {
  124 + if (uid_eq((*daemon)->file->f_cred->euid, current_euid())) {
126 125 rc = 0;
127 126 goto out;
128 127 }
... ... @@ -941,7 +941,6 @@
941 941 depends on CEPH_FS = n
942 942 depends on CIFS = n
943 943 depends on CODA_FS = n
944   - depends on ECRYPT_FS = n
945 944 depends on EFS_FS = n
946 945 depends on EXOFS_FS = n
947 946 depends on FUSE_FS = n