[POWERPC] EEH: Fix PCI bridge handling bug
[cascardo/linux.git] / fs / ecryptfs / inode.c
index 83e94fe..131954b 100644 (file)
@@ -282,7 +282,7 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
        struct dentry *lower_dentry;
        struct vfsmount *lower_mnt;
        char *encoded_name;
-       unsigned int encoded_namelen;
+       int encoded_namelen;
        struct ecryptfs_crypt_stat *crypt_stat = NULL;
        struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
        char *page_virt = NULL;
@@ -353,6 +353,10 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
                ecryptfs_printk(KERN_DEBUG, "Is a symlink; returning\n");
                goto out;
        }
+       if (special_file(lower_inode->i_mode)) {
+               ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n");
+               goto out;
+       }
        if (!nd) {
                ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave"
                                "as we *think* we are about to unlink\n");
@@ -473,7 +477,7 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
        struct dentry *lower_dir_dentry;
        umode_t mode;
        char *encoded_symname;
-       unsigned int encoded_symlen;
+       int encoded_symlen;
        struct ecryptfs_crypt_stat *crypt_stat = NULL;
 
        lower_dentry = ecryptfs_dentry_to_lower(dentry);
@@ -902,8 +906,9 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
        mutex_lock(&crypt_stat->cs_mutex);
        if (S_ISDIR(dentry->d_inode->i_mode))
                crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
-       else if (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)
-                || !(crypt_stat->flags & ECRYPTFS_KEY_VALID)) {
+       else if (S_ISREG(dentry->d_inode->i_mode)
+                && (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)
+                    || !(crypt_stat->flags & ECRYPTFS_KEY_VALID))) {
                struct vfsmount *lower_mnt;
                struct file *lower_file = NULL;
                struct ecryptfs_mount_crypt_stat *mount_crypt_stat;