diff options
author | Zhitong Wang <zhitong.wangzt@alibaba-inc.com> | 2010-03-22 18:51:22 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-05-19 10:58:07 -0400 |
commit | fda168c24586ab8e01b0eb68028d78fe3e4fb71a (patch) | |
tree | 015ac765550296cac1bc9b3eee833d99630a83fa /fs/xfs/linux-2.6/xfs_ioctl32.c | |
parent | e40152ee1e1c7a63f4777791863215e3faa37a86 (diff) |
xfs: Fix integer overflow in fs/xfs/linux-2.6/xfs_ioctl*.c
The am_hreq.opcount field in the xfs_attrmulti_by_handle() interface
is not bounded correctly. The opcount is used to determine the size
of the buffer required. The size is bounded, but can overflow and so
the size checks may not be sufficient to catch invalid opcounts.
Fix it by catching opcount values that would cause overflows before
calculating the size.
Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_ioctl32.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index 593c05b4df8d..9287135e9bfc 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -420,6 +420,10 @@ xfs_compat_attrmulti_by_handle( | |||
420 | sizeof(compat_xfs_fsop_attrmulti_handlereq_t))) | 420 | sizeof(compat_xfs_fsop_attrmulti_handlereq_t))) |
421 | return -XFS_ERROR(EFAULT); | 421 | return -XFS_ERROR(EFAULT); |
422 | 422 | ||
423 | /* overflow check */ | ||
424 | if (am_hreq.opcount >= INT_MAX / sizeof(compat_xfs_attr_multiop_t)) | ||
425 | return -E2BIG; | ||
426 | |||
423 | dentry = xfs_compat_handlereq_to_dentry(parfilp, &am_hreq.hreq); | 427 | dentry = xfs_compat_handlereq_to_dentry(parfilp, &am_hreq.hreq); |
424 | if (IS_ERR(dentry)) | 428 | if (IS_ERR(dentry)) |
425 | return PTR_ERR(dentry); | 429 | return PTR_ERR(dentry); |