staging: lustre: libcfs: fix test for libcfs_ioctl_hdr minimum size
authorJames Simmons <jsimmons@infradead.org>
Wed, 26 Jul 2017 15:22:32 +0000 (11:22 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 30 Jul 2017 15:08:31 +0000 (08:08 -0700)
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@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@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/libcfs/linux/linux-module.c

index 075826bd3a2a666bc8bbe56c2a051bd2333da50e..c6837bc58ed404192e5ac8fd9faf2f0f12988a91 100644 (file)
@@ -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;
        }