Skip to content

Commit e580fe4

Browse files
kelleymhSomasundaram Krishnasamy
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]> (cherry picked from commit f3440c029e471962719de3cbd771933e2165b338)
1 parent 1c02a41 commit e580fe4

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
@@ -762,7 +762,7 @@ static void vmbus_wait_for_unload(void)
762762
void *page_addr;
763763
struct hv_message *msg;
764764
struct vmbus_channel_message_header *hdr;
765-
u32 message_type;
765+
u32 message_type, i;
766766

767767
/*
768768
* CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was
@@ -772,8 +772,11 @@ static void vmbus_wait_for_unload(void)
772772
* functional and vmbus_unload_response() will complete
773773
* vmbus_connection.unload_event. If not, the last thing we can do is
774774
* read message pages for all CPUs directly.
775+
*
776+
* Wait no more than 10 seconds so that the panic path can't get
777+
* hung forever in case the response message isn't seen.
775778
*/
776-
while (1) {
779+
for (i = 0; i < 1000; i++) {
777780
if (completion_done(&vmbus_connection.unload_event))
778781
break;
779782

0 commit comments

Comments
 (0)