By the recent change of ecryptfs_setattr(), attribute modifications
(e.g. chown, chmod, and so on) for symbolic links and special files
get to fail.  These operations now hang or cause a "NULL pointer
dereference" error for kernel 2.6.22.

This patch fixes the problem.

Signed-off-by: Ryusuke Konishi <[EMAIL PROTECTED]>
---
 fs/ecryptfs/inode.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 83e94fe..a9064bf 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -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;

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
eCryptfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecryptfs-devel

Reply via email to