From: James Simmons Date: Wed, 26 Jul 2017 15:22:32 +0000 (-0400) Subject: staging: lustre: libcfs: fix test for libcfs_ioctl_hdr minimum size X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=62cbe860c5c381432f0d46f08f39d205074c5edf;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git staging: lustre: libcfs: fix test for libcfs_ioctl_hdr minimum size The function libcfs_ioctl_getdata() test to see if libcfs_ioctl_hdr is smaller than struct libcfs_ioctl_data in size. This is wrong and it breaks the ioctl that is used to collect LNet stats. The correct size to compare against is struct libcfs_ioctl_hdr. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5935 Reviewed-on: http://review.whamcloud.com/12782 Fixes: ed2f549dc0f6 ("staging: lustre: libcfs: test if userland data is to small") Reported-by: Doug Oucharek Reviewed-by: Liang Zhen Reviewed-by: Doug Oucharek Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c index 075826bd3a2a..c6837bc58ed4 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c @@ -134,7 +134,7 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, return -EINVAL; } - if (hdr.ioc_len < sizeof(struct libcfs_ioctl_data)) { + if (hdr.ioc_len < sizeof(hdr)) { CERROR("libcfs ioctl: user buffer too small for ioctl\n"); return -EINVAL; }