eCryptfs: fix lookup error for special files

2007-08-22 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=df068464169a84a6a66c05d140f43a46d5eb6176
Commit: df068464169a84a6a66c05d140f43a46d5eb6176
Parent: 74e8f346d59074147c564d9c1ffd6caf18286516
Author: Ryusuke Konishi [EMAIL PROTECTED]
AuthorDate: Wed Aug 22 14:01:02 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Wed Aug 22 19:52:44 2007 -0700

eCryptfs: fix lookup error for special files

When ecryptfs_lookup() is called against special files, eCryptfs generates
the following errors because it tries to treat them like regular eCryptfs
files.

Error opening lower file for lower_dentry [0x810233a6f150], lower_mnt 
[0x810235bb4c80], and flags [0x8000]
Error opening lower_file to read header region
Error attempting to read the [user.ecryptfs] xattr from the lower file; 
return value = [-95]
Valid metadata not found in header region or xattr region; treating file as 
unencrypted

For instance, the problem can be reproduced by the steps below.

  # mkdir /root/crypt /mnt/crypt
  # mount -t ecryptfs /root/crypt /mnt/crypt
  # mknod /mnt/crypt/c0 c 0 0
  # umount /mnt/crypt
  # mount -t ecryptfs /root/crypt /mnt/crypt
  # ls -l /mnt/crypt

This patch fixes it by adding a check similar to directories and
symlinks.

Signed-off-by: Ryusuke Konishi [EMAIL PROTECTED]
Acked-by: Michael Halcrow [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/ecryptfs/inode.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 131954b..5d40ad1 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -357,6 +357,10 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, 
struct dentry *dentry,
ecryptfs_printk(KERN_DEBUG, Is a special file; 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);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


eCryptfs: fix lookup error for special files

2007-08-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=202a21d6914369c1362f1ab50f0cbe92b9c38718
Commit: 202a21d6914369c1362f1ab50f0cbe92b9c38718
Parent: 60c9834238482f805b1d9e4dc2a780405ddab80f
Author: Ryusuke Konishi [EMAIL PROTECTED]
AuthorDate: Fri Aug 10 13:00:51 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Sat Aug 11 15:47:40 2007 -0700

eCryptfs: fix lookup error for special files

When ecryptfs_lookup() is called against special files, eCryptfs generates
the following errors because it tries to treat them like regular eCryptfs
files.

Error opening lower file for lower_dentry [0x810233a6f150], lower_mnt 
[0x810235bb4c80], and flags
[0x8000]
Error opening lower_file to read header region
Error attempting to read the [user.ecryptfs] xattr from the lower file; 
return value = [-95]
Valid metadata not found in header region or xattr region; treating file as 
unencrypted

For instance, the problem can be reproduced by the steps below.

  # mkdir /root/crypt /mnt/crypt
  # mount -t ecryptfs /root/crypt /mnt/crypt
  # mknod /mnt/crypt/c0 c 0 0
  # umount /mnt/crypt
  # mount -t ecryptfs /root/crypt /mnt/crypt
  # ls -l /mnt/crypt

This patch fixes it by adding a check similar to directories and
symlinks.

Signed-off-by: Ryusuke Konishi [EMAIL PROTECTED]
Acked-by: Michael Halcrow [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/ecryptfs/inode.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 0a50942..131954b 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -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);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html