From: John L. Hammond Date: Wed, 22 Jan 2014 13:36:14 +0000 (+0800) Subject: staging/lustre/llite: pass correct pointer to obd_iocontrol() X-Git-Tag: firefly_0821_release~176^2~4193^2~1274 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=b0337d6c101bbb5be0fe249c05373cce4d24986c;p=firefly-linux-kernel-4.4.55.git staging/lustre/llite: pass correct pointer to obd_iocontrol() In copy_and_ioctl() use the kernel space copy as the karg to obd_iocontrol(). Lustre-change: http://review.whamcloud.com/6274 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3283 Signed-off-by: John L. Hammond Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 22d0acc95bc5..1b217c8802b0 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1048,20 +1048,25 @@ 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; + void *copy; int rc; - OBD_ALLOC(ptr, len); - if (ptr == NULL) + OBD_ALLOC(copy, size); + if (copy == NULL) return -ENOMEM; - if (copy_from_user(ptr, data, len)) { - OBD_FREE(ptr, len); - return -EFAULT; + + if (copy_from_user(copy, data, size)) { + rc = -EFAULT; + goto out; } - rc = obd_iocontrol(cmd, exp, len, data, NULL); - OBD_FREE(ptr, len); + + rc = obd_iocontrol(cmd, exp, size, copy, NULL); +out: + OBD_FREE(copy, size); + return rc; }