Drivers: hv: vmbus: Initialize unload_event statically
Subsystems (2)
PATCH 1/1 Drivers: hv: vmbus: Initialize unload_event statically
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.
--- drivers/hv/channel_mgmt.c | 2 +- drivers/hv/connection.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/hv/channel_mgmt.c +1 -1
@@ -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),
drivers/hv/connection.c +2 -0
@@ -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(
Signature · 1 line
2.25.1
From: Andrea Parri (Microsoft) <[email protected]> Sent: Friday, April 16, 2021 7:40 AM
Quoted 4 lines
If a malicious or compromised Hyper-V sends a spurious message of type
CHANNELMSG_UNLOAD_RESPONSE, the functionvmbus_unload_response()will callcomplete()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
Quoted 36 lines
Reported-by Michael Kelley <[email protected]>Signed-off-by Andrea Parri (Microsoft) <[email protected]>--- drivers/hv/channel_mgmt.c | 2 +- drivers/hv/connection.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)drivers/hv/channel_mgmt.c +1
-1@@ -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),drivers/hv/connection.c +2
-1@@ -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
Quoted 9 lines · Michael Kelley
From: Andrea Parri (Microsoft) <[email protected]> Sent: Friday, April 16, 2021 7:40 AM
Quoted 4 lines
If a malicious or compromised Hyper-V sends a spurious message of type
CHANNELMSG_UNLOAD_RESPONSE, the functionvmbus_unload_response()will callcomplete()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. :-)
Yes, will do for v2.
Thanks,
Andrea