[lustre-devel] [PATCH 16/20] staging: lustre: libcfs: fix test for libcfs_ioctl_hdr minimum size

James Simmons jsimmons at infradead.org
Wed Jul 26 08:22:32 PDT 2017

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 <uja.ornl at gmail.com>
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 <doug.s.oucharek at intel.com>
Reviewed-by: Liang Zhen <liang.zhen at intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek at intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin at intel.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
 drivers/staging/lustre/lnet/libcfs/linux/linux-module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c
index 075826b..c6837bc 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;

More information about the lustre-devel mailing list