From 49eb94f795596bb269de81e8b4ab83c46f28b0df Mon Sep 17 00:00:00 2001 From: Alexandro Sanchez Bach Date: Thu, 15 Nov 2018 03:25:50 +0100 Subject: [PATCH] Fixed HAX_VCPU_IOCTL_SET_MSRS access type Signed-off-by: Alexandro Sanchez Bach --- include/hax_interface.h | 2 +- platforms/linux/components.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/hax_interface.h b/include/hax_interface.h index 9ca15993..7683640f 100644 --- a/include/hax_interface.h +++ b/include/hax_interface.h @@ -157,7 +157,7 @@ #define HAX_VCPU_IOCTL_GET_MSRS \ HAX_IOCTL(HAX_IOWR, 0x06, struct hax_msr_data) #define HAX_VCPU_IOCTL_SET_MSRS \ - HAX_IOCTL(HAX_IOW, 0x07, struct hax_msr_data) + HAX_IOCTL(HAX_IOWR, 0x07, struct hax_msr_data) #define HAX_VCPU_IOCTL_INTERRUPT \ HAX_IOCTL(HAX_IOW, 0x08, uint32_t) #define HAX_VCPU_IOCTL_DEBUG \ diff --git a/platforms/linux/components.c b/platforms/linux/components.c index 62812ae9..a808c8d7 100644 --- a/platforms/linux/components.c +++ b/platforms/linux/components.c @@ -363,6 +363,10 @@ static long hax_vcpu_ioctl(struct file *filp, unsigned int cmd, } } msrs.done = i; + if (copy_to_user(argp, &msrs, sizeof(msrs))) { + ret = -EFAULT; + break; + } break; } case HAX_VCPU_IOCTL_GET_MSRS__LEGACY: