aboutsummaryrefslogtreecommitdiff
path: root/fs/ecryptfs/inode.c
AgeCommit message (Collapse)AuthorFilesLines
2010-03-23eCryptfs: Clear buffer before reading in metadata xattrTyler Hicks1-0/+1
We initially read in the first PAGE_CACHE_SIZE of a file to if the eCryptfs header marker can be found. If it isn't found and ecryptfs_xattr_metadata was given as a mount option, then the user.ecryptfs xattr is read into the same buffer. Since the data from the first page of the file wasn't cleared, it is possible that we think we've found a second tag 3 or tag 1 packet and then error out after the packet contents aren't as expected. This patch clears the buffer before filling it with metadata from the user.ecryptfs xattr. Reviewed-by: Eric Sandeen <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
2010-03-23eCryptfs: Rename ecryptfs_crypt_stat.num_header_bytes_at_frontTyler Hicks1-1/+1
This patch renames the num_header_bytes_at_front variable to metadata_size since it now contains the max size of the metadata. Reviewed-by: Eric Sandeen <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
2010-03-23eCryptfs: Fix metadata in xattr feature regressionTyler Hicks1-1/+1
Fixes regression in 8faece5f906725c10e7a1f6caf84452abadbdc7b When using the ecryptfs_xattr_metadata mount option, eCryptfs stores the metadata (normally stored at the front of the file) in the user.ecryptfs xattr. This causes ecryptfs_crypt_stat.num_header_bytes_at_front to be 0, since there is no header data at the front of the file. This results in too much memory being requested and ENOMEM being returned from ecryptfs_write_metadata(). This patch fixes the problem by using the num_header_bytes_at_front variable for specifying the max size of the metadata, despite whether it is stored in the header or xattr. Reviewed-by: Eric Sandeen <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
2010-01-19ecryptfs: pass matching flags to interpose as defined and used thereErez Zadok1-1/+2
ecryptfs_interpose checks if one of the flags passed is ECRYPTFS_INTERPOSE_FLAG_D_ADD, defined as 0x00000001 in ecryptfs_kernel.h. But the only user of ecryptfs_interpose to pass a non-zero flag to it, has hard-coded the value as "1". This could spell trouble if any of these values changes in the future. Signed-off-by: Erez Zadok <[email protected]> Cc: Dustin Kirkland <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
2010-01-19ecryptfs: remove unnecessary d_drop calls in ecryptfs_linkErez Zadok1-3/+0
Unnecessary because it would unhash perfectly valid dentries, causing them to have to be re-looked up the next time they're needed, which presumably is right after. Signed-off-by: Aseem Rastogi <[email protected]> Signed-off-by: Shrikar archak <[email protected]> Signed-off-by: Erez Zadok <[email protected]> Cc: Saumitra Bhanage <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
2010-01-19ecryptfs: don't ignore return value from lock_renameErez Zadok1-1/+12
Signed-off-by: Erez Zadok <[email protected]> Cc: Dustin Kirkland <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
2010-01-19eCryptfs: Add getattr functionTyler Hicks1-0/+16
The i_blocks field of an eCryptfs inode cannot be trusted, but generic_fillattr() uses it to instantiate the blocks field of a stat() syscall when a filesystem doesn't implement its own getattr(). Users have noticed that the output of du is incorrect on newly created files. This patch creates ecryptfs_getattr() which calls into the lower filesystem's getattr() so that eCryptfs can use its kstat.blocks value after calling generic_fillattr(). It is important to note that the block count includes the eCryptfs metadata stored in the beginning of the lower file plus any padding used to fill an extent before encryption. https://bugs.launchpad.net/ecryptfs/+bug/390833 Reported-by: Dominic Sacré <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
2010-01-19eCryptfs: Use notify_change for truncating lower inodesTyler Hicks1-32/+67
When truncating inodes in the lower filesystem, eCryptfs directly invoked vmtruncate(). As Christoph Hellwig pointed out, vmtruncate() is a filesystem helper function, but filesystems may need to do more than just a call to vmtruncate(). This patch moves the lower inode truncation out of ecryptfs_truncate() and renames the function to truncate_upper(). truncate_upper() updates an iattr for the lower inode to indicate if the lower inode needs to be truncated upon return. ecryptfs_setattr() then calls notify_change(), using the updated iattr for the lower inode, to complete the truncation. For eCryptfs functions needing to truncate, ecryptfs_truncate() is reintroduced as a simple way to truncate the upper inode to a specified size and then truncate the lower inode accordingly. https://bugs.launchpad.net/bugs/451368 Reported-by: Christoph Hellwig <[email protected]> Acked-by: Dustin Kirkland <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Tyler Hicks <[email protected]>
2010-01-14ecryptfs: Fix refcnt leak on ecryptfs_follow_link() error pathOGAWA Hirofumi1-12/+12
If ->follow_link handler return the error, it should decrement nd->path refcnt. But, ecryptfs_follow_link() doesn't decrement. This patch fix it by using usual nd_set_link() style error handling, instead of playing with nd->path. Signed-off-by: OGAWA Hirofumi <[email protected]> Signed-off-by: Al Viro <[email protected]>
2009-12-17fsstack/ecryptfs: remove unused get_nlinks param to fsstack_copy_attr_allErez Zadok1-3/+3
This get_nlinks parameter was never used by the only mainline user, ecryptfs; and it has never been used by unionfs or wrapfs either. Acked-by: Dustin Kirkland <[email protected]> Acked-by: Tyler Hicks <[email protected]> Signed-off-by: Erez Zadok <[email protected]> Signed-off-by: Al Viro <[email protected]>
2009-09-23eCryptfs: Prevent lower dentry from going negative during unlinkTyler Hicks1-0/+2
When calling vfs_unlink() on the lower dentry, d_delete() turns the dentry into a negative dentry when the d_count is 1. This eventually caused a NULL pointer deref when a read() or write() was done and the negative dentry's d_inode was dereferenced in ecryptfs_read_update_atime() or ecryptfs_getxattr(). Placing mutt's tmpdir in an eCryptfs mount is what initially triggered the oops and I was able to reproduce it with the following sequence: open("/tmp/upper/foo", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600) = 3 link("/tmp/upper/foo", "/tmp/upper/bar") = 0 unlink("/tmp/upper/foo") = 0 open("/tmp/upper/bar", O_RDWR|O_CREAT|O_NOFOLLOW, 0600) = 4 unlink("/tmp/upper/bar") = 0 write(4, "eCryptfs test\n"..., 14 <unfinished ...> +++ killed by SIGKILL +++ https://bugs.launchpad.net/ecryptfs/+bug/387073 Reported-by: Loïc Minier <[email protected]> Cc: Serge Hallyn <[email protected]> Cc: Dave Kleikamp <[email protected]> Cc: [email protected] Cc: stable <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
2009-04-27eCryptfs: Fix min function comparison warningTyler Hicks1-1/+1
This warning shows up on 64 bit builds: fs/ecryptfs/inode.c:693: warning: comparison of distinct pointer types lacks a cast Signed-off-by: Tyler Hicks <[email protected]>
2009-04-27ecryptfs: fix printk format warningRandy Dunlap1-1/+1
fs/ecryptfs/inode.c:670: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Tyler Hicks <[email protected]> Cc: Dustin Kirkland <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
2009-04-22eCryptfs: Larger buffer for encrypted symlink targetsTyler Hicks1-6/+18
When using filename encryption with eCryptfs, the value of the symlink in the lower filesystem is encrypted and stored as a Tag 70 packet. This results in a longer symlink target than if the target value wasn't encrypted. Users were reporting these messages in their syslog: [ 45.653441] ecryptfs_parse_tag_70_packet: max_packet_size is [56]; real packet size is [51] [ 45.653444] ecryptfs_decode_and_decrypt_filename: Could not parse tag 70 packet from filename; copying through filename as-is This was due to bufsiz, one the arguments in readlink(), being used to when allocating the buffer passed to the lower inode's readlink(). That symlink target may be very large, but when decoded and decrypted, could end up being smaller than bufsize. To fix this, the buffer passed to the lower inode's readlink() will always be PATH_MAX in size when filename encryption is enabled. Any necessary truncation occurs after the decoding and decrypting. Signed-off-by: Tyler Hicks <[email protected]>
2009-04-22eCryptfs: Lock lower directory inode mutex during lookupTyler Hicks1-0/+4
This patch locks the lower directory inode's i_mutex before calling lookup_one_len() to find the appropriate dentry in the lower filesystem. This bug was found thanks to the warning set in commit 2f9092e1. Signed-off-by: Tyler Hicks <[email protected]>
2009-04-22eCryptfs: Fix data corruption when using ecryptfs_passthroughTyler Hicks1-2/+7
ecryptfs_passthrough is a mount option that allows eCryptfs to allow data to be written to non-eCryptfs files in the lower filesystem. The passthrough option was causing data corruption due to it not always being treated as a non-eCryptfs file. The first 8 bytes of an eCryptfs file contains the decrypted file size. This value was being written to the non-eCryptfs files, too. Also, extra 0x00 characters were being written to make the file size a multiple of PAGE_CACHE_SIZE. Signed-off-by: Tyler Hicks <[email protected]>
2009-03-22eCryptfs: NULL crypt_stat dereference during lookupTyler Hicks1-20/+12
If ecryptfs_encrypted_view or ecryptfs_xattr_metadata were being specified as mount options, a NULL pointer dereference of crypt_stat was possible during lookup. This patch moves the crypt_stat assignment into ecryptfs_lookup_and_interpose_lower(), ensuring that crypt_stat will not be NULL before we attempt to dereference it. Thanks to Dan Carpenter and his static analysis tool, smatch, for finding this bug. Signed-off-by: Tyler Hicks <[email protected]> Acked-by: Dustin Kirkland <[email protected]> Cc: Dan Carpenter <[email protected]> Cc: Serge Hallyn <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-01-06fs/ecryptfs/inode.c: cleanup kerneldocQinghuang Feng1-2/+1
Arguments lower_dentry and ecryptfs_dentry in ecryptfs_create_underlying_file() have been merged into dentry, now fix it. Signed-off-by: Qinghuang Feng <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-01-06eCryptfs: Fix data types (int/size_t)Michael Halcrow1-1/+1
Correct several format string data type specifiers. Correct filename size data types; they should be size_t rather than int when passed as parameters to some other functions (although note that the filenames will never be larger than int). Signed-off-by: Michael Halcrow <[email protected]> Cc: Dustin Kirkland <[email protected]> Cc: Eric Sandeen <[email protected]> Cc: Tyler Hicks <[email protected]> Cc: David Kleikamp <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-01-06eCryptfs: Filename Encryption: filldir, lookup, and readlinkMichael Halcrow1-127/+167
Make the requisite modifications to ecryptfs_filldir(), ecryptfs_lookup(), and ecryptfs_readlink() to call out to filename encryption functions. Propagate filename encryption policy flags from mount-wide crypt_stat to inode crypt_stat. Signed-off-by: Michael Halcrow <[email protected]> Cc: Dustin Kirkland <[email protected]> Cc: Eric Sandeen <[email protected]> Cc: Tyler Hicks <[email protected]> Cc: David Kleikamp <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-01-05inode->i_op is never NULLAl Viro1-2/+1
We used to have rather schizophrenic set of checks for NULL ->i_op even though it had been eliminated years ago. You'd need to go out of your way to set it to NULL explicitly _and_ a bunch of code would die on such inodes anyway. After killing two remaining places that still did that bogosity, all that crap can go away. Signed-off-by: Al Viro <[email protected]>
2008-12-31eCryptfs: check readlink result was not an error before using itDuane Griffin1-1/+2
The result from readlink is being used to index into the link name buffer without checking whether it is a valid length. If readlink returns an error this will fault or cause memory corruption. Cc: Tyler Hicks <[email protected]> Cc: Dustin Kirkland <[email protected]> Cc: [email protected] Signed-off-by: Duane Griffin <[email protected]> Acked-by: Michael Halcrow <[email protected]> Acked-by: Tyler Hicks <[email protected]> Signed-off-by: Al Viro <[email protected]>
2008-07-26[PATCH] kill nameidata passing to permission(), rename to inode_permission()Al Viro1-1/+1
Incidentally, the name that gives hundreds of false positives on grep is not a good idea... Signed-off-by: Al Viro <[email protected]>
2008-07-26[patch 5/5] vfs: remove mode parameter from vfs_symlink()Miklos Szeredi1-3/+1
Remove the unused mode parameter from vfs_symlink and callers. Thanks to Tetsuo Handa for noticing. CC: Tetsuo Handa <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
2008-07-26[PATCH] sanitize ->permission() prototypeAl Viro1-15/+2
* kill nameidata * argument; map the 3 bits in ->flags anybody cares about to new MAY_... ones and pass with the mask. * kill redundant gfs2_iop_permission() * sanitize ecryptfs_permission() * fix remaining places where ->permission() instances might barf on new MAY_... found in mask. The obvious next target in that direction is permission(9) folded fix for nfs_permission() breakage from Miklos Szeredi <[email protected]> Signed-off-by: Al Viro <[email protected]>
2008-07-24eCryptfs: Make all persistent file opens delayedMichael Halcrow1-4/+23
There is no good reason to immediately open the lower file, and that can cause problems with files that the user does not intend to immediately open, such as device nodes. This patch removes the persistent file open from the interpose step and pushes that to the locations where eCryptfs really does need the lower persistent file, such as just before reading or writing the metadata stored in the lower file header. Two functions are jumping to out_dput when they should just be jumping to out on error paths. This patch also fixes these. Signed-off-by: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-07-24eCryptfs: do not try to open device files on mknodMichael Halcrow1-2/+4
When creating device nodes, eCryptfs needs to delay actually opening the lower persistent file until an application tries to open. Device handles may not be backed by anything when they first come into existence. [[email protected]: build fix] Signed-off-by: Michael Halcrow <[email protected]> Cc: <[email protected]} Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-07-24ecryptfs: inode.c mmap.c use unaligned byteorder helpersHarvey Harrison1-2/+2
Fixe sparse warnings: fs/ecryptfs/inode.c:368:15: warning: cast to restricted __be64 fs/ecryptfs/mmap.c:385:12: warning: incorrect type in assignment (different base types) fs/ecryptfs/mmap.c:385:12: expected unsigned long long [unsigned] [assigned] [usertype] file_size fs/ecryptfs/mmap.c:385:12: got restricted __be64 [usertype] <noident> fs/ecryptfs/mmap.c:428:12: warning: incorrect type in assignment (different base types) fs/ecryptfs/mmap.c:428:12: expected unsigned long long [unsigned] [assigned] [usertype] file_size fs/ecryptfs/mmap.c:428:12: got restricted __be64 [usertype] <noident> Signed-off-by: Harvey Harrison <[email protected]> Cc: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-05-13ecryptfs: clean up (un)lock_parentMiklos Szeredi1-9/+4
dget(dentry->d_parent) --> dget_parent(dentry) unlock_parent() is racy and unnecessary. Replace single caller with unlock_dir(). There are several other suspect uses of ->d_parent in ecryptfs... Signed-off-by: Miklos Szeredi <[email protected]> Cc: Michael Halcrow <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-04-29Remove duplicated unlikely() in IS_ERR()Hirofumi Nakagawa1-1/+1
Some drivers have duplicated unlikely() macros. IS_ERR() already has unlikely() in itself. This patch cleans up such pointless code. Signed-off-by: Hirofumi Nakagawa <[email protected]> Acked-by: David S. Miller <[email protected]> Acked-by: Jeff Garzik <[email protected]> Cc: Paul Clements <[email protected]> Cc: Richard Purdie <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: David Brownell <[email protected]> Cc: James Bottomley <[email protected]> Cc: Michael Halcrow <[email protected]> Cc: Anton Altaparmakov <[email protected]> Cc: Al Viro <[email protected]> Cc: Carsten Otte <[email protected]> Cc: Patrick McHardy <[email protected]> Cc: Paul Mundt <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[email protected]> Acked-by: Mike Frysinger <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-04-29ecryptfs: add missing lock around notify_changeMiklos Szeredi1-0/+2
Callers of notify_change() need to hold i_mutex. Signed-off-by: Miklos Szeredi <[email protected]> Cc: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-04-29ecryptfs: replace remaining __FUNCTION__ occurrencesHarvey Harrison1-1/+1
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <[email protected]> Cc: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-02-14Embed a struct path into struct nameidata instead of nd->{dentry,mnt}Jan Blunck1-12/+12
This is the central patch of a cleanup series. In most cases there is no good reason why someone would want to use a dentry for itself. This series reflects that fact and embeds a struct path into nameidata. Together with the other patches of this series - it enforced the correct order of getting/releasing the reference count on <dentry,vfsmount> pairs - it prepares the VFS for stacking support since it is essential to have a struct path in every place where the stack can be traversed - it reduces the overall code size: without patch series: text data bss dec hex filename 5321639 858418 715768 6895825 6938d1 vmlinux with patch series: text data bss dec hex filename 5320026 858418 715768 6894212 693284 vmlinux This patch: Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere. [[email protected]: coding-style fixes] [[email protected]: fix cifs] [[email protected]: fix smack] Signed-off-by: Jan Blunck <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]> Acked-by: Christoph Hellwig <[email protected]> Cc: Al Viro <[email protected]> Cc: Casey Schaufler <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-02-06eCryptfs: Minor fixes to printk messagesMichael Halcrow1-3/+3
The printk statements that result when the user does not have the proper key available could use some refining. Signed-off-by: Mike Halcrow <[email protected]> Cc: Mike Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-02-06eCryptfs: track header bytes rather than extentsMichael Halcrow1-5/+3
Remove internal references to header extents; just keep track of header bytes instead. Headers can easily span multiple pages with the recent persistent file changes. Signed-off-by: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-02-06fs/ecryptfs/: possible cleanupsAdrian Bunk1-1/+1
- make the following needlessly global code static: - crypto.c:ecryptfs_lower_offset_for_extent() - crypto.c:key_tfm_list - crypto.c:key_tfm_list_mutex - inode.c:ecryptfs_getxattr() - main.c:ecryptfs_init_persistent_file() - remove the no longer used mmap.c:ecryptfs_lower_page_cache - #if 0 the unused read_write.c:ecryptfs_read() Signed-off-by: Adrian Bunk <[email protected]> Cc: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-01-08eCryptfs: fix dentry handling on create error, unlink, and inode destroyMichael Halcrow1-16/+4
This patch corrects some erroneous dentry handling in eCryptfs. If there is a problem creating the lower file, then there is nothing that the persistent lower file can do to really help us. This patch makes a vfs_create() failure in the lower filesystem always lead to an unconditional do_create failure in eCryptfs. Under certain sequences of operations, the eCryptfs dentry can remain in the dcache after an unlink. This patch calls d_drop() on the eCryptfs dentry to correct this. eCryptfs has no business calling d_delete() directly on a lower filesystem's dentry. This patch removes the call to d_delete() on the lower persistent file's dentry in ecryptfs_destroy_inode(). (Thanks to David Kleikamp, Eric Sandeen, and Jeff Moyer for helping identify and resolve this issue) Signed-off-by: Michael Halcrow <[email protected]> Cc: Dave Kleikamp <[email protected]> Cc: Eric Sandeen <[email protected]> Cc: Jeff Moyer <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-10-18ecryptfs: allow lower fs to interpret ATTR_KILL_S*IDJeff Layton1-0/+8
Make sure ecryptfs doesn't trip the BUG() in notify_change. This also allows the lower filesystem to interpret ATTR_KILL_S*ID in its own way. Signed-off-by: Jeff Layton <[email protected]> Cc: Michael Halcrow <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Neil Brown <[email protected]> Cc: "J. Bruce Fields" <[email protected]> Cc: Chris Mason <[email protected]> Cc: Jeff Mahoney <[email protected]> Cc: "Vladimir V. Saveliev" <[email protected]> Cc: Josef 'Jeff' Sipek <[email protected]> Cc: Trond Myklebust <[email protected]> Cc: Steven French <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-10-16eCryptfs: make open, truncate, and setattr use persistent fileMichael Halcrow1-79/+34
Rather than open a new lower file for every eCryptfs file that is opened, truncated, or setattr'd, instead use the existing lower persistent file for the eCryptfs inode. Change truncate to use read_write.c functions. Change ecryptfs_getxattr() to use the common ecryptfs_getxattr_lower() function. Signed-off-by: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-10-16eCryptfs: update metadata read/write functionsMichael Halcrow1-56/+45
Update the metadata read/write functions and grow_file() to use the read_write.c routines. Do not open another lower file; use the persistent lower file instead. Provide a separate function for crypto.c::ecryptfs_read_xattr_region() to get to the lower xattr without having to go through the eCryptfs getxattr. Signed-off-by: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-10-16eCryptfs: set up and destroy persistent lower fileMichael Halcrow1-4/+19
This patch sets up and destroys the persistent lower file for each eCryptfs inode. Signed-off-by: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-10-16eCryptfs: replace encrypt, decrypt, and inode size writeMichael Halcrow1-9/+3
Replace page encryption and decryption routines and inode size write routine with versions that utilize the read_write.c functions. Signed-off-by: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-10-16eCryptfs: remove assignments in if-statementsMichael Halcrow1-14/+21
Remove assignments in if-statements. Signed-off-by: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-10-16eCryptfs: remove header_extent_sizeMichael Halcrow1-3/+4
There is no point to keeping a separate header_extent_size and an extent_size. The total size of the header can always be represented as some multiple of the regular data extent size. [[email protected]: ecryptfs: fix printk format warning] Signed-off-by: Michael Halcrow <[email protected]> Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-08-31revert "eCryptfs: fix lookup error for special files"Andrew Morton1-4/+0
This patch got appied twice. Cc: Ryusuke Konishi <[email protected]> Cc: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-08-22eCryptfs: fix lookup error for special filesRyusuke Konishi1-0/+4
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 [0xffff810233a6f150], lower_mnt [0xffff810235bb4c80], 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]>
2007-08-11eCryptfs: fix lookup error for special filesRyusuke Konishi1-0/+4
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 [0xffff810233a6f150], lower_mnt [0xffff810235bb4c80], 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]>
2007-07-19eCryptfs: ecryptfs_setattr() bugfixMichael Halcrow1-2/+3
There is another bug recently introduced into the ecryptfs_setattr() function in 2.6.22. eCryptfs will attempt to treat special files like regular eCryptfs files on chmod, chown, and so forth. This leads to a NULL pointer dereference. This patch validates that the file is a regular file before proceeding with operations related to the inode's crypt_stat. Thanks to Ryusuke Konishi for finding this bug and suggesting the fix. Signed-off-by: Michael Halcrow <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-07-17Couple fixes to fs/ecryptfs/inode.cMika Kukkonen1-2/+2
Following was uncovered by compiling the kernel with '-W' flag: CC [M] fs/ecryptfs/inode.o fs/ecryptfs/inode.c: In function ‘ecryptfs_lookup’: fs/ecryptfs/inode.c:304: warning: comparison of unsigned expression < 0 is always false fs/ecryptfs/inode.c: In function ‘ecryptfs_symlink’: fs/ecryptfs/inode.c:486: warning: comparison of unsigned expression < 0 is always false Function ecryptfs_encode_filename() can return -ENOMEM, so change the variables to plain int, as in the first case the only real use actually expects int, and in latter case there is no use beoynd the error check. Signed-off-by: Mika Kukkonen <[email protected]> Cc: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-06-28eCryptfs: initialize crypt_stat in setattrMichael Halcrow1-1/+46
Recent changes in eCryptfs have made it possible to get to ecryptfs_setattr() with an uninitialized crypt_stat struct. This results in a wide and colorful variety of unpleasantries. This patch properly initializes the crypt_stat structure in ecryptfs_setattr() when it is necessary to do so. Signed-off-by: Michael Halcrow <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>