From 0a0a5589d7092b9c276731e6cea3d5d08d0ea27d Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Mon, 6 May 2013 16:42:32 -0500 Subject: [PATCH] LU-3283 llite: pass correct pointer to obd_iocontrol() In copy_and_ioctl() use the kernel space copy as the karg to obd_iocontrol(). Signed-off-by: John L. Hammond Change-Id: I9b714675b4b63737efc08eec1b08463de1d63d1b Reviewed-on: http://review.whamcloud.com/6274 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin --- lustre/llite/dir.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 23d2af8..66ca76d 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -1068,21 +1068,26 @@ progress: } -static int copy_and_ioctl(int cmd, struct obd_export *exp, void *data, int len) +static int copy_and_ioctl(int cmd, struct obd_export *exp, + const void __user *data, size_t size) { - void *ptr; - int rc; + void *copy; + int rc; - OBD_ALLOC(ptr, len); - if (ptr == NULL) - return -ENOMEM; - if (copy_from_user(ptr, data, len)) { - OBD_FREE(ptr, len); - return -EFAULT; - } - rc = obd_iocontrol(cmd, exp, len, data, NULL); - OBD_FREE(ptr, len); - return rc; + OBD_ALLOC(copy, size); + if (copy == NULL) + return -ENOMEM; + + if (copy_from_user(copy, data, size)) { + rc = -EFAULT; + goto out; + } + + rc = obd_iocontrol(cmd, exp, size, copy, NULL); +out: + OBD_FREE(copy, size); + + return rc; } static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl) -- 1.8.3.1