Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363112

[PATCH 01/29] staging: lustre: libcfs: replace LNET_MAX_IOCTL_BUF_LEN with something bigger

From James Simmons <jsimmons@infradead.org>
Newsgroups linux.kernel
Subject [PATCH 01/29] staging: lustre: libcfs: replace LNET_MAX_IOCTL_BUF_LEN with something bigger
Date 2016-03-23 00:20 +0100
Message-ID <rfDKH-34K-23@gated-at.bofh.it> (permalink)
References <rfDAZ-310-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Liang Zhen <liang.zhen@intel.com>

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>
---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    3 +++
 drivers/staging/lustre/lnet/libcfs/module.c        |    5 +----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
index 5ca99bd..c71d125 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
@@ -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;
 
diff --git a/drivers/staging/lustre/lnet/libcfs/module.c b/drivers/staging/lustre/lnet/libcfs/module.c
index cdc640b..f9f9d59 100644
--- a/drivers/staging/lustre/lnet/libcfs/module.c
+++ b/drivers/staging/lustre/lnet/libcfs/module.c
@@ -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;
 	}
-- 
1.7.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/29] Bring libcfs ioctl handling up to date James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 29/29] staging: lustre: libcfs: return size_t for libcfs_ioctl_packlen James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 28/29] staging: lustre: libcfs: use BIT macro in linux-module.c James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 22/29] staging: lustre: libcfs: removal all userland only macros from libcfs_ioctl.h James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 18/29] staging:lustre: remove the IOC_LIBCFS_MEMHOG ioctl James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 24/29] staging: lustre: libcfs: move function declarations from libcfs_ioctl.h James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 03/29] staging: lustre: libcfs: merge code from libcfs_ioctl into libcfs_ioctl_getdata James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 23/29] staging: lustre: libcfs: migrate inline functions to source file James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 19/29] staging:lustre: remove libcfs_psdev_[open|release] James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 26/29] staging: lustre: libcfs: add uapi headers to libcfs_ioctl.h James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 14/29] staging: lustre: libcfs: remove libcfsutil.h in comment James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 25/29] staging: lustre: libcfs: make libcfs_ioctl.h readable James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 27/29] staging: lustre: libcfs: return proper bool values James Simmons <jsimmons@infradead.org> - 2016-03-23 00:10 +0100
  [PATCH 08/29] staging: lustre: libcfs: invert test condition for libcfs_ioctl James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 13/29] staging: lustre: libcfs: change variable name James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 11/29] staging: lustre: lnet: make sure lnet data not greater than LIBCFS_IOC_DATA_MAX James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 04/29] staging: lustre: libcfs: merge libcfs_ioctl_handle into libcfs_ioctl James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 10/29] staging: lustre: libcfs: test if userland data is to small James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 01/29] staging: lustre: libcfs: replace LNET_MAX_IOCTL_BUF_LEN with something bigger James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 02/29] staging: lustre: libcfs: use break in switch options for libcfs_ioctl_handle James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 15/29] staging: lustre: libcfs: move libcfs_ioctl_handler stuff to libcfs.h James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 12/29] staging: lustre: simple cleanup in obd_ioctl_popdata James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 09/29] staging: lustre: libcfs: update error messages in linux-module.c James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100
  [PATCH 05/29] staging: lustre: libcfs: add debugging info for libcfs_ioctl James Simmons <jsimmons@infradead.org> - 2016-03-23 00:20 +0100

csiph-web