check ATTR_SIZE contraints in inode_change_ok
Make sure we check the truncate constraints early on in ->setattr by adding those checks to inode_change_ok. Also clean up and document inode_change_ok to make this obvious. As a fallout we don't have to call inode_newsize_ok from simple_setsize and simplify it down to a truncate_setsize which doesn't return an error. This simplifies a lot of setattr implementations and means we use truncate_setsize almost everywhere. Get rid of fat_setsize now that it's trivial and mark ext2_setsize static to make the calling convention obvious. Keep the inode_newsize_ok in vmtruncate for now as all callers need an audit for its removal anyway. Note: setattr code in ecryptfs doesn't call inode_change_ok at all and needs a deeper audit, but that is left for later. Signed-off-by:Christoph Hellwig <hch@lst.de> Signed-off-by:
Al Viro <viro@zeniv.linux.org.uk>
Showing
- fs/adfs/inode.c 1 addition, 4 deletionsfs/adfs/inode.c
- fs/attr.c 30 additions, 14 deletionsfs/attr.c
- fs/ecryptfs/inode.c 14 additions, 4 deletionsfs/ecryptfs/inode.c
- fs/ext2/inode.c 2 additions, 10 deletionsfs/ext2/inode.c
- fs/fat/fat.h 0 additions, 1 deletionfs/fat/fat.h
- fs/fat/file.c 2 additions, 15 deletionsfs/fat/file.c
- fs/fuse/dir.c 1 addition, 5 deletionsfs/fuse/dir.c
- fs/gfs2/aops.c 2 additions, 2 deletionsfs/gfs2/aops.c
- fs/gfs2/ops_inode.c 2 additions, 4 deletionsfs/gfs2/ops_inode.c
- fs/jffs2/fs.c 2 additions, 2 deletionsfs/jffs2/fs.c
- fs/libfs.c 2 additions, 49 deletionsfs/libfs.c
- fs/ocfs2/file.c 3 additions, 3 deletionsfs/ocfs2/file.c
- fs/ramfs/file-nommu.c 2 additions, 3 deletionsfs/ramfs/file-nommu.c
- fs/smbfs/inode.c 1 addition, 3 deletionsfs/smbfs/inode.c
- fs/ubifs/file.c 8 additions, 15 deletionsfs/ubifs/file.c
- fs/ubifs/ubifs.h 1 addition, 1 deletionfs/ubifs/ubifs.h
- fs/ufs/truncate.c 3 additions, 8 deletionsfs/ufs/truncate.c
- include/linux/fs.h 0 additions, 1 deletioninclude/linux/fs.h
- include/linux/mm.h 1 addition, 0 deletionsinclude/linux/mm.h
- mm/shmem.c 2 additions, 3 deletionsmm/shmem.c
Loading
Please register or sign in to comment