diff options
| author | Eryu Guan <[email protected]> | 2016-12-09 05:49:54 +0000 |
|---|---|---|
| committer | Dave Chinner <[email protected]> | 2016-12-09 05:49:54 +0000 |
| commit | 0c187dc508d7d8520319c0dcaa0601775f69ab5a (patch) | |
| tree | 648849a301ea041631357e0c93f14fd046596dac /fs/xfs/libxfs/xfs_ialloc_btree.c | |
| parent | xfs: deprecate barrier/nobarrier mount option (diff) | |
| download | kernel-0c187dc508d7d8520319c0dcaa0601775f69ab5a.tar.gz kernel-0c187dc508d7d8520319c0dcaa0601775f69ab5a.zip | |
xfs: use xfs_vn_setattr_size to check on new size
Commit 6552321831dc ("xfs: remove i_iolock and use i_rwsem in the
VFS inode instead") introduced a regression that truncate(2) doesn't
check on new size, so it succeeds even if the new size exceeds the
current resource limit. Because xfs_setattr_size() was used instead
of xfs_vn_setattr_size(), and the latter calls xfs_vn_change_ok()
first to do sanity check on permission and new size.
This is found by truncate03 test from ltp, and the following is a
simplified reproducer:
#!/bin/bash
dev=/dev/sda5
mnt=/mnt/xfs
mkfs -t xfs -f $dev
mount $dev $mnt
# set max file size to 16k
ulimit -f 16
truncate -s $((16 * 1024 + 1)) /mnt/xfs/testfile
[ $? -eq 0 ] && echo "FAIL: truncate exceeded max file size"
ulimit -f unlimited
umount $mnt
Signed-off-by: Eryu Guan <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Dave Chinner <[email protected]>
Diffstat (limited to 'fs/xfs/libxfs/xfs_ialloc_btree.c')
0 files changed, 0 insertions, 0 deletions
