Skip to content

Commit 911e198

Browse files
kelleymhliuw
authored andcommitted
Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload
vmbus_wait_for_unload() looks for a CHANNELMSG_UNLOAD_RESPONSE message coming from Hyper-V. But if the message isn't found for some reason, the panic path gets hung forever. Add a timeout of 10 seconds to prevent this. Fixes: 4157191 ("Drivers: hv: vmbus: avoid scheduling in interrupt context in vmbus_initiate_unload()") Signed-off-by: Michael Kelley <[email protected]> Reviewed-by: Dexuan Cui <[email protected]> Reviewed-by: Vitaly Kuznetsov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]>
1 parent 19873ee commit 911e198

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/hv/channel_mgmt.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ static void vmbus_wait_for_unload(void)
750750
void *page_addr;
751751
struct hv_message *msg;
752752
struct vmbus_channel_message_header *hdr;
753-
u32 message_type;
753+
u32 message_type, i;
754754

755755
/*
756756
* CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was
@@ -760,8 +760,11 @@ static void vmbus_wait_for_unload(void)
760760
* functional and vmbus_unload_response() will complete
761761
* vmbus_connection.unload_event. If not, the last thing we can do is
762762
* read message pages for all CPUs directly.
763+
*
764+
* Wait no more than 10 seconds so that the panic path can't get
765+
* hung forever in case the response message isn't seen.
763766
*/
764-
while (1) {
767+
for (i = 0; i < 1000; i++) {
765768
if (completion_done(&vmbus_connection.unload_event))
766769
break;
767770

0 commit comments

Comments
 (0)