1
0
Fork 0

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 <john.hammond@intel.com>
Reviewed-by: Sebastien Buisson <sebastien.buisson@bull.net>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
hifive-unleashed-5.1
John L. Hammond 2014-01-22 21:36:14 +08:00 committed by Greg Kroah-Hartman
parent 4f2fb455a1
commit b0337d6c10
1 changed files with 14 additions and 9 deletions

View File

@ -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;
}