Commit ed2f549d authored by Liang Zhen's avatar Liang Zhen Committed by Greg Kroah-Hartman

staging: lustre: libcfs: test if userland data is to small

Ensure that user land data is at least the smallest size.
Signed-off-by: default avatarLiang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5435
Reviewed-on: http://review.whamcloud.com/11313Reviewed-by: default avatarBobi Jam <bobijam@gmail.com>
Reviewed-by: default avatarJohann Lombardi <johann.lombardi@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6d0aeaa3
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment