]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ecryptfs/inode.c
eCryptfs: ecryptfs_setattr() bugfix
[linux-2.6-omap-h63xx.git] / fs / ecryptfs / inode.c
index e77a2ec71aa5fd8764f6c4be9bbda250cf806a87..0a50942b4378479d5a9dee07a6d815a628468c2d 100644 (file)
@@ -902,8 +902,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;