linux/fs/xfs
Lukas Czerner c029a50d51 xfs: fix possible overflow in xfs_ioc_trim()
In xfs_ioc_trim it is possible that computing the last allocation group
to discard might overflow for big start & len values, because the result
might be bigger then xfs_agnumber_t which is 32 bit long. Fix this by not
allowing the start and end block of the range to be beyond the end of the
file system.

Note that if the start is beyond the end of the file system we have to
return -EINVAL, but in the "end" case we have to truncate it to the fs
size.

Also introduce "end" variable, rather than using start+len which which
might be more confusing to get right as this bug shows.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
2011-10-11 21:15:07 -05:00
..
Kconfig
kmem.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
kmem.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
Makefile xfs: fix tracing builds inside the source tree 2011-08-22 16:37:24 -05:00
mrlock.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
time.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
uuid.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
uuid.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_acl.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_acl.h xfs: Fix build breakage in xfs_iops.c when CONFIG_FS_POSIX_ACL is not set 2011-08-01 02:35:04 -04:00
xfs_ag.h xfs: Remove the macro XFS_BUF_PTR 2011-07-25 15:03:13 -05:00
xfs_alloc_btree.c
xfs_alloc_btree.h
xfs_alloc.c xfs: Remove the macro XFS_BUF_ERROR and family 2011-07-25 14:57:46 -05:00
xfs_alloc.h
xfs_aops.c xfs: introduce xfs_bmapi_read() 2011-10-11 21:15:03 -05:00
xfs_aops.h xfs: remove i_iocount 2011-10-11 21:15:01 -05:00
xfs_attr_leaf.c xfs: introduce xfs_bmapi_read() 2011-10-11 21:15:03 -05:00
xfs_attr_leaf.h
xfs_attr_sf.h
xfs_attr.c xfs: rename xfs_bmapi to xfs_bmapi_write 2011-10-11 21:15:04 -05:00
xfs_attr.h
xfs_bit.c
xfs_bit.h
xfs_bmap_btree.c
xfs_bmap_btree.h
xfs_bmap.c xfs: dont ignore error code from xfs_bmbt_update 2011-10-11 21:15:07 -05:00
xfs_bmap.h xfs: cleanup xfs_bmap.h 2011-10-11 21:15:07 -05:00
xfs_btree.c xfs: Check the return value of xfs_trans_get_buf() 2011-10-11 21:15:01 -05:00
xfs_btree.h xfs: Remove the macro XFS_BUF_PTR 2011-07-25 15:03:13 -05:00
xfs_buf_item.c xfs: call xfs_buf_delwri_queue directly 2011-10-11 21:14:59 -05:00
xfs_buf_item.h
xfs_buf.c xfs: Fix the incorrect comment in the header of _xfs_buf_find 2011-10-11 21:15:02 -05:00
xfs_buf.h xfs: use the "delwri" terminology consistently 2011-10-11 21:15:00 -05:00
xfs_da_btree.c xfs: rename xfs_bmapi to xfs_bmapi_write 2011-10-11 21:15:04 -05:00
xfs_da_btree.h
xfs_dfrag.c
xfs_dfrag.h
xfs_dinode.h xfs: Remove the macro XFS_BUF_PTR 2011-07-25 15:03:13 -05:00
xfs_dir2_block.c
xfs_dir2_data.c
xfs_dir2_format.h
xfs_dir2_leaf.c xfs: introduce xfs_bmapi_read() 2011-10-11 21:15:03 -05:00
xfs_dir2_node.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-07-25 13:56:39 -07:00
xfs_dir2_priv.h
xfs_dir2_sf.c
xfs_dir2.c xfs: get rid of open-coded S_ISREG(), etc. 2011-07-26 15:05:16 -04:00
xfs_dir2.h
xfs_discard.c xfs: fix possible overflow in xfs_ioc_trim() 2011-10-11 21:15:07 -05:00
xfs_discard.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_dquot_item.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_dquot_item.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_dquot.c xfs: rename xfs_bmapi to xfs_bmapi_write 2011-10-11 21:15:04 -05:00
xfs_dquot.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_error.c
xfs_error.h
xfs_export.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_export.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_extfree_item.c
xfs_extfree_item.h
xfs_file.c xfs: introduce xfs_bmapi_read() 2011-10-11 21:15:03 -05:00
xfs_filestream.c xfs: rename allocation range fields in struct xfs_bmalloca 2011-10-11 21:15:06 -05:00
xfs_filestream.h
xfs_fs_subr.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_fs.h
xfs_fsops.c xfs: Check the return value of xfs_buf_get() 2011-10-11 21:15:01 -05:00
xfs_fsops.h
xfs_globals.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_ialloc_btree.c
xfs_ialloc_btree.h
xfs_ialloc.c xfs: Check the return value of xfs_trans_get_buf() 2011-10-11 21:15:01 -05:00
xfs_ialloc.h
xfs_iget.c xfs: remove i_iocount 2011-10-11 21:15:01 -05:00
xfs_inode_item.c
xfs_inode_item.h
xfs_inode.c xfs: introduce xfs_bmapi_read() 2011-10-11 21:15:03 -05:00
xfs_inode.h xfs: remove i_iocount 2011-10-11 21:15:01 -05:00
xfs_inum.h
xfs_ioctl32.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_ioctl32.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_ioctl.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_ioctl.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_iomap.c xfs: rename xfs_bmapi to xfs_bmapi_write 2011-10-11 21:15:04 -05:00
xfs_iomap.h
xfs_iops.c xfs: Return -EIO when xfs_vn_getattr() failed 2011-10-11 21:15:02 -05:00
xfs_iops.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_itable.c
xfs_itable.h
xfs_linux.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_log_cil.c
xfs_log_priv.h
xfs_log_recover.c xfs: let xfs_bwrite callers handle the xfs_buf_relse 2011-10-11 21:15:00 -05:00
xfs_log_recover.h
xfs_log.c xfs: Remove the macro XFS_BUF_SET_PTR 2011-07-25 15:03:17 -05:00
xfs_log.h
xfs_message.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_message.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_mount.c xfs: call xfs_buf_delwri_queue directly 2011-10-11 21:14:59 -05:00
xfs_mount.h xfs: Remove the second parameter to xfs_sb_count() 2011-07-20 18:35:03 -05:00
xfs_mru_cache.c
xfs_mru_cache.h
xfs_qm_bhv.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_qm_stats.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_qm_stats.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_qm_syscalls.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_qm.c xfs: introduce xfs_bmapi_read() 2011-10-11 21:15:03 -05:00
xfs_qm.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_quota_priv.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_quota.h
xfs_quotaops.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_rename.c xfs: get rid of open-coded S_ISREG(), etc. 2011-07-26 15:05:16 -04:00
xfs_rtalloc.c xfs: rename xfs_bmapi to xfs_bmapi_write 2011-10-11 21:15:04 -05:00
xfs_rtalloc.h xfs: Remove the macro XFS_BUF_PTR 2011-07-25 15:03:13 -05:00
xfs_rw.c xfs: call xfs_buf_delwri_queue directly 2011-10-11 21:14:59 -05:00
xfs_rw.h
xfs_sb.h xfs: Remove the macro XFS_BUF_PTR 2011-07-25 15:03:13 -05:00
xfs_stats.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_stats.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_super.c xfs: remove i_iocount 2011-10-11 21:15:01 -05:00
xfs_super.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_sync.c xfs: remove i_iocount 2011-10-11 21:15:01 -05:00
xfs_sync.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_sysctl.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_sysctl.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_trace.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_trace.h xfs: call xfs_buf_delwri_queue directly 2011-10-11 21:14:59 -05:00
xfs_trans_ail.c xfs: set cursor in xfs_ail_splice() even when AIL was empty 2011-08-09 15:30:43 -05:00
xfs_trans_buf.c xfs: call xfs_buf_delwri_queue directly 2011-10-11 21:14:59 -05:00
xfs_trans_dquot.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_trans_extfree.c
xfs_trans_inode.c
xfs_trans_priv.h xfs: convert AIL cursors to use struct list_head 2011-07-20 18:37:46 -05:00
xfs_trans_space.h
xfs_trans.c xfs: use a cursor for bulk AIL insertion 2011-07-20 18:37:20 -05:00
xfs_trans.h
xfs_types.h
xfs_utils.c
xfs_utils.h
xfs_vnode.h xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs_vnodeops.c xfs: rename xfs_bmapi to xfs_bmapi_write 2011-10-11 21:15:04 -05:00
xfs_vnodeops.h
xfs_xattr.c xfs: remove subdirectories 2011-08-12 16:21:35 -05:00
xfs.h xfs: don't expect xfs headers to be in subdirectories 2011-08-12 13:57:55 -05:00