Skip to content

Commit 2b557a0

Browse files
kelleymhgregkh
authored andcommitted
Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload
[ Upstream commit 911e198 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 95ae369 commit 2b557a0

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
@@ -681,7 +681,7 @@ static void vmbus_wait_for_unload(void)
681681
void *page_addr;
682682
struct hv_message *msg;
683683
struct vmbus_channel_message_header *hdr;
684-
u32 message_type;
684+
u32 message_type, i;
685685

686686
/*
687687
* CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was
@@ -691,8 +691,11 @@ static void vmbus_wait_for_unload(void)
691691
* functional and vmbus_unload_response() will complete
692692
* vmbus_connection.unload_event. If not, the last thing we can do is
693693
* read message pages for all CPUs directly.
694+
*
695+
* Wait no more than 10 seconds so that the panic path can't get
696+
* hung forever in case the response message isn't seen.
694697
*/
695-
while (1) {
698+
for (i = 0; i < 1000; i++) {
696699
if (completion_done(&vmbus_connection.unload_event))
697700
break;
698701

0 commit comments

Comments
 (0)