summaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/dentry.c
diff options
context:
space:
mode:
authorTyler Hicks <tyhicks@canonical.com>2012-01-19 20:33:44 -0600
committerTyler Hicks <tyhicks@canonical.com>2012-01-25 14:43:41 -0600
commita261a03904849c3df50bd0300efb7fb3f865137d (patch)
tree59785a3a6894e3e29e547813ff1d010bc08e5893 /fs/ecryptfs/dentry.c
parent5e6f0d769017cc49207ef56996e42363ec26c1f0 (diff)
downloadlinux-a261a03904849c3df50bd0300efb7fb3f865137d.tar.bz2
eCryptfs: Check inode changes in setattr
Most filesystems call inode_change_ok() very early in ->setattr(), but eCryptfs didn't call it at all. It allowed the lower filesystem to make the call in its ->setattr() function. Then, eCryptfs would copy the appropriate inode attributes from the lower inode to the eCryptfs inode. This patch changes that and actually calls inode_change_ok() on the eCryptfs inode, fairly early in ecryptfs_setattr(). Ideally, the call would happen earlier in ecryptfs_setattr(), but there are some possible inode initialization steps that must happen first. Since the call was already being made on the lower inode, the change in functionality should be minimal, except for the case of a file extending truncate call. In that case, inode_newsize_ok() was never being called on the eCryptfs inode. Rather than inode_newsize_ok() catching maximum file size errors early on, eCryptfs would encrypt zeroed pages and write them to the lower filesystem until the lower filesystem's write path caught the error in generic_write_checks(). This patch introduces a new function, called ecryptfs_inode_newsize_ok(), which checks if the new lower file size is within the appropriate limits when the truncate operation will be growing the lower file. In summary this change prevents eCryptfs truncate operations (and the resulting page encryptions), which would exceed the lower filesystem limits or FSIZE rlimits, from ever starting. Signed-off-by: Tyler Hicks <tyhicks@canonical.com> Reviewed-by: Li Wang <liwang@nudt.edu.cn> Cc: <stable@vger.kernel.org>
Diffstat (limited to 'fs/ecryptfs/dentry.c')
0 files changed, 0 insertions, 0 deletions