staging: lustre: libcfs: replace LNET_MAX_IOCTL_BUF_LEN with something bigger
authorLiang Zhen <liang.zhen@intel.com>
Tue, 22 Mar 2016 23:03:48 +0000 (19:03 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
The size of LNET_MAX_IOCTL_BUF_LEN restricts the size of
libcfs ioctl to the maximum needs of the LNet layer. Since
libcfs also handles things like debugging we might need
to let user land pass more data to or from the kernel than
what is possible

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5435
Reviewed-on: http://review.whamcloud.com/11313
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
drivers/staging/lustre/lnet/libcfs/module.c

index 5ca99bd6f4e922977ea573383a75b1c0a9718dc3..c71d1250ff9646e810f933e7c7ef2344787a4602 100644 (file)
@@ -49,6 +49,9 @@ struct libcfs_ioctl_hdr {
        __u32 ioc_version;
 };
 
+/** max size to copy from userspace */
+#define LIBCFS_IOC_DATA_MAX    (128 * 1024)
+
 struct libcfs_ioctl_data {
        struct libcfs_ioctl_hdr ioc_hdr;
 
index cdc640bfdba86e805422b456253aefaee932f515..f9f9d59052f81330d9ddd6c3a81b23f6e8e10d27 100644 (file)
@@ -54,9 +54,6 @@
 
 # define DEBUG_SUBSYSTEM S_LNET
 
-#define LNET_MAX_IOCTL_BUF_LEN (sizeof(struct lnet_ioctl_net_config) + \
-                               sizeof(struct lnet_ioctl_config_data))
-
 #include "../../include/linux/libcfs/libcfs.h"
 #include <asm/div64.h>
 
@@ -186,7 +183,7 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd,
         * do a check here to restrict the size of the memory
         * to allocate to guard against DoS attacks.
         */
-       if (buf_len > LNET_MAX_IOCTL_BUF_LEN) {
+       if (buf_len > LIBCFS_IOC_DATA_MAX) {
                CERROR("LNET: user buffer exceeds kernel buffer\n");
                return -EINVAL;
        }