The patch titled eCryptfs: readdir fix for seeking in directory streams has been added to the -mm tree. Its filename is ecryptfs-file-operations-readdir-fix-for-seeking-in-directory-streams.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: eCryptfs: readdir fix for seeking in directory streams From: Michael Halcrow <mhalcrow@xxxxxxxxxx> The lower file's f_pos needs to be set to the f_pos of the eCryptfs file passed into readdir() in order to correctly handle seeks on directory streams. This patch also properly initializes the file_info struct to all 0's. This initialization is not strictly necessary for the code as it is currently in the kernel, but without this patch, nasty bugs can show up when anyone makes changes to the file_info struct (one such future change may include a pointer to persistent directory read state info). Signed-off-by: Michael Halcrow <mhalcrow@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/ecryptfs/file.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff -puN fs/ecryptfs/file.c~ecryptfs-file-operations-readdir-fix-for-seeking-in-directory-streams fs/ecryptfs/file.c --- a/fs/ecryptfs/file.c~ecryptfs-file-operations-readdir-fix-for-seeking-in-directory-streams +++ a/fs/ecryptfs/file.c @@ -137,7 +137,6 @@ ecryptfs_filldir(void *dirent, const cha int decoded_length; char *decoded_name; - crypt_stat = ecryptfs_dentry_to_private(buf->dentry)->crypt_stat; buf->filldir_called++; decoded_length = ecryptfs_decode_filename(crypt_stat, name, namelen, @@ -169,6 +168,7 @@ static int ecryptfs_readdir(struct file struct ecryptfs_getdents_callback buf; lower_file = ecryptfs_file_to_lower(file); + lower_file->f_pos = file->f_pos; inode = file->f_dentry->d_inode; memset(&buf, 0, sizeof(buf)); buf.dirent = dirent; @@ -211,18 +211,19 @@ static int ecryptfs_open(struct inode *i struct inode *lower_inode = NULL; struct file *lower_file = NULL; struct vfsmount *lower_mnt; + struct ecryptfs_file_info *file_info; int lower_flags; /* Released in ecryptfs_release or end of function if failure */ - ecryptfs_set_file_private(file, - kmem_cache_alloc(ecryptfs_file_info_cache, - SLAB_KERNEL)); - if (!ecryptfs_file_to_private(file)) { + file_info = kmem_cache_alloc(ecryptfs_file_info_cache, SLAB_KERNEL); + ecryptfs_set_file_private(file, file_info); + if (!file_info) { ecryptfs_printk(KERN_ERR, "Error attempting to allocate memory\n"); rc = -ENOMEM; goto out; } + memset(file_info, 0, sizeof(*file_info)); lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_POLICY_APPLIED)) { _ Patches currently in -mm which might be from mhalcrow@xxxxxxxxxx are lsm-remove-bsd-secure-level-security-module.patch ecryptfs-fs-makefile-and-fs-kconfig.patch ecryptfs-fs-makefile-and-fs-kconfig-kconfig-help-update.patch ecryptfs-documentation.patch ecryptfs-makefile.patch ecryptfs-main-module-functions.patch ecryptfs-header-declarations.patch ecryptfs-superblock-operations.patch ecryptfs-dentry-operations.patch ecryptfs-file-operations.patch ecryptfs-file-operations-readdir-fix-for-seeking-in-directory-streams.patch ecryptfs-inode-operations.patch ecryptfs-mmap-operations.patch ecryptfs-mmap-operations-fix.patch ecryptfs-keystore.patch ecryptfs-crypto-functions.patch ecryptfs-crypto-functions-mutex-fixes.patch fs-ecryptfs-possible-cleanups.patch ecryptfs-debug-functions.patch ecryptfs-alpha-build-fix.patch ecryptfs-convert-assert-to-bug_on.patch ecryptfs-remove-pointless-bug_ons.patch ecryptfs-remove-unnecessary-null-checks.patch ecryptfs-rewrite-ecryptfs_fsync.patch ecryptfs-overhaul-file-locking.patch ecryptfs-remove-lock-propagation.patch ecryptfs-dont-muck-with-the-existing-nameidata-structures.patch ecryptfs-asm-scatterlisth-linux-scatterlisth.patch ecryptfs-support-for-larger-maximum-key-size.patch ecryptfs-add-codes-for-additional-ciphers.patch ecryptfs-unencrypted-key-size-based-on-encrypted-key-size.patch ecryptfs-packet-and-key-management-update-for-variable-key-size.patch ecryptfs-add-ecryptfs_-prefix-to-mount-options-key-size-parameter.patch ecryptfs-set-the-key-size-from-the-default-for-the-mount.patch ecryptfs-check-for-weak-keys.patch ecryptfs-add-define-values-for-cipher-codes-from-rfc2440-openpgp.patch ecryptfs-convert-bits-to-bytes.patch ecryptfs-more-elegant-aes-key-size-manipulation.patch ecryptfs-more-intelligent-use-of-tfm-objects.patch ecryptfs-remove-debugging-cruft.patch ecryptfs-get_sb_dev-fix.patch ecryptfs-validate-minimum-header-extent-size.patch ecryptfs-validate-body-size.patch ecryptfs-validate-packet-length-prior-to-parsing-add-comments.patch ecryptfs-use-the-passed-in-max-value-as-the-upper-bound.patch ecryptfs-change-the-maximum-size-check-when-writing-header.patch ecryptfs-print-the-actual-option-that-is-problematic.patch ecryptfs-add-a-maintainers-entry.patch ecryptfs-partial-signed-integer-to-size_t-conversion-updated-ii.patch ecryptfs-graceful-handling-of-mount-error.patch ecryptfs-fix-printk-format-warnings.patch ecryptfs-associate-vfsmount-with-dentry-rather-than-superblock.patch ecryptfs-mntput-lower-mount-on-umount_begin.patch vfs-make-filldir_t-and-struct-kstat-deal-in-64-bit-inode-numbers-ecryptfs.patch make-kmem_cache_destroy-return-void-ecryptfs.patch ecryptfs-inode-numbering-fixes.patch ecryptfs-versioning-fixes.patch ecryptfs-versioning-fixes-tidy.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html