]> git.karo-electronics.de Git - linux-beck.git/commitdiff
userns: Convert ecryptfs to use kuid/kgid where appropriate
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 8 Feb 2012 00:24:33 +0000 (16:24 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 21 Sep 2012 10:13:09 +0000 (03:13 -0700)
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>
fs/ecryptfs/main.c
fs/ecryptfs/messaging.c
init/Kconfig

index 2768138eefeef85707f9ee29652532b25d50dfcb..1d6ce91b70612cf1fa0f2a076c2687ff3333520a 100644 (file)
@@ -544,11 +544,12 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
                goto out_free;
        }
 
-       if (check_ruid && path.dentry->d_inode->i_uid != current_uid()) {
+       if (check_ruid && !uid_eq(path.dentry->d_inode->i_uid, current_uid())) {
                rc = -EPERM;
                printk(KERN_ERR "Mount of device (uid: %d) not owned by "
                       "requested user (uid: %d)\n",
-                      path.dentry->d_inode->i_uid, current_uid());
+                       i_uid_read(path.dentry->d_inode),
+                       from_kuid(&init_user_ns, current_uid()));
                goto out_free;
        }
 
index b29bb8bfa8d929bb4dde499a6fdc9618eaf56492..5fa2471796c2d9b2174a0f39fed60ef2fc562a07 100644 (file)
@@ -33,7 +33,7 @@ static struct hlist_head *ecryptfs_daemon_hash;
 struct mutex ecryptfs_daemon_hash_mux;
 static int ecryptfs_hash_bits;
 #define ecryptfs_current_euid_hash(uid) \
-               hash_long((unsigned long)current_euid(), ecryptfs_hash_bits)
+       hash_long((unsigned long)from_kuid(&init_user_ns, current_euid()), ecryptfs_hash_bits)
 
 static u32 ecryptfs_msg_counter;
 static struct ecryptfs_msg_ctx *ecryptfs_msg_ctx_arr;
@@ -121,8 +121,7 @@ int ecryptfs_find_daemon_by_euid(struct ecryptfs_daemon **daemon)
        hlist_for_each_entry(*daemon, elem,
                            &ecryptfs_daemon_hash[ecryptfs_current_euid_hash()],
                            euid_chain) {
-               if ((*daemon)->file->f_cred->euid == current_euid() &&
-                   (*daemon)->file->f_cred->user_ns == current_user_ns()) {
+               if (uid_eq((*daemon)->file->f_cred->euid, current_euid())) {
                        rc = 0;
                        goto out;
                }
index 5f846b57a750734b372a9a0fd6cf37295d939ae9..6120bae29aea044c98cc29a31d6fc83f7038e842 100644 (file)
@@ -941,7 +941,6 @@ config UIDGID_CONVERTED
        depends on CEPH_FS = n
        depends on CIFS = n
        depends on CODA_FS = n
-       depends on ECRYPT_FS = n
        depends on EFS_FS = n
        depends on EXOFS_FS = n
        depends on FUSE_FS = n