[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MWHPR21MB159389AFC33EB4D799E4D6B5D74C9@MWHPR21MB1593.namprd21.prod.outlook.com>
Date: Fri, 16 Apr 2021 15:25:03 +0000
From: Michael Kelley <mikelley@...rosoft.com>
To: "Andrea Parri (Microsoft)" <parri.andrea@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>
Subject: RE: [PATCH] Drivers: hv: vmbus: Initialize unload_event statically
From: Andrea Parri (Microsoft) <parri.andrea@...il.com> Sent: Friday, April 16, 2021 7:40 AM
>
> If a malicious or compromised Hyper-V sends a spurious message of type
> CHANNELMSG_UNLOAD_RESPONSE, the function vmbus_unload_response() will
> call complete() on an uninitialized event, and cause an oops.
Please leave a comment somewhere in the code itself that describes this
scenario so that somebody in the future doesn't decide it's OK to "simplify" the
initialization of unload_event. :-)
Michael
>
> Reported-by: Michael Kelley <mikelley@...rosoft.com>
> Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@...il.com>
> ---
> drivers/hv/channel_mgmt.c | 2 +-
> drivers/hv/connection.c | 2 ++
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
> index f3cf4af01e102..1efb616480a64 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -841,7 +841,7 @@ void vmbus_initiate_unload(bool crash)
> if (vmbus_proto_version < VERSION_WIN8_1)
> return;
>
> - init_completion(&vmbus_connection.unload_event);
> + reinit_completion(&vmbus_connection.unload_event);
> memset(&hdr, 0, sizeof(struct vmbus_channel_message_header));
> hdr.msgtype = CHANNELMSG_UNLOAD;
> vmbus_post_msg(&hdr, sizeof(struct vmbus_channel_message_header),
> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> index 350e8c5cafa8c..529dcc47f3e11 100644
> --- a/drivers/hv/connection.c
> +++ b/drivers/hv/connection.c
> @@ -26,6 +26,8 @@
>
> struct vmbus_connection vmbus_connection = {
> .conn_state = DISCONNECTED,
> + .unload_event = COMPLETION_INITIALIZER(
> + vmbus_connection.unload_event),
> .next_gpadl_handle = ATOMIC_INIT(0xE1E10),
>
> .ready_for_suspend_event = COMPLETION_INITIALIZER(
> --
> 2.25.1
Powered by blists - more mailing lists