summaryrefslogtreecommitdiffstats
path: root/drivers/hv
diff options
context:
space:
mode:
authorMichael Kelley <mikelley@microsoft.com>2017-05-18 10:46:07 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-25 15:42:42 +0200
commit13b9abfc92be7c4454bff912021b9f835dea6e15 (patch)
tree134b32b899c3684a7ebcef5c3a6d23784afe28b7 /drivers/hv
parent3110010896f17f381bd74d72b9d4a46a087c46b8 (diff)
downloadop-kernel-dev-13b9abfc92be7c4454bff912021b9f835dea6e15.zip
op-kernel-dev-13b9abfc92be7c4454bff912021b9f835dea6e15.tar.gz
Drivers: hv: vmbus: Close timing hole that can corrupt per-cpu page
Extend the disabling of preemption to include the hypercall so that another thread can't get the CPU and corrupt the per-cpu page used for hypercall arguments. Cc: <Stable@vger.kernel.org> #4.11 Signed-off-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/hv.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 61fc8ce..2ea1220 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -82,10 +82,15 @@ int hv_post_message(union hv_connection_id connection_id,
aligned_msg->message_type = message_type;
aligned_msg->payload_size = payload_size;
memcpy((void *)aligned_msg->payload, payload, payload_size);
- put_cpu_ptr(hv_cpu);
status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL);
+ /* Preemption must remain disabled until after the hypercall
+ * so some other thread can't get scheduled onto this cpu and
+ * corrupt the per-cpu post_msg_page
+ */
+ put_cpu_ptr(hv_cpu);
+
return status & 0xFFFF;
}
OpenPOWER on IntegriCloud