diff options
author | Liang Zhen <[email protected]> | 2016-03-22 19:03:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2016-03-28 07:30:36 -0700 |
commit | ed2f549dc0f687f5d454cb20754340e83e5b9c4f (patch) | |
tree | 25868c8487f33d3d663146eeaf7c459117e7b293 | |
parent | 6d0aeaa36178382898a15836c8c6542d92527a8c (diff) |
staging: lustre: libcfs: test if userland data is to small
Ensure that user land data is at least the smallest size.
Signed-off-by: Liang Zhen <[email protected]>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5435
Reviewed-on: http://review.whamcloud.com/11313
Reviewed-by: Bobi Jam <[email protected]>
Reviewed-by: Johann Lombardi <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r-- | drivers/staging/lustre/lnet/libcfs/linux/linux-module.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c index 35e2fcf238e1..ae058956f209 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c @@ -73,6 +73,11 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, return -EINVAL; } + if (hdr.ioc_len < sizeof(struct libcfs_ioctl_data)) { + CERROR("libcfs ioctl: user buffer too small for ioctl\n"); + return -EINVAL; + } + if (hdr.ioc_len > LIBCFS_IOC_DATA_MAX) { CERROR("libcfs ioctl: user buffer is too large %d/%d\n", hdr.ioc_len, LIBCFS_IOC_DATA_MAX); |