]> Git Repo - linux.git/commitdiff
Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload
authorMichael Kelley <[email protected]>
Sun, 13 Sep 2020 19:47:29 +0000 (12:47 -0700)
committerWei Liu <[email protected]>
Mon, 14 Sep 2020 11:42:33 +0000 (11:42 +0000)
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: 415719160de3 ("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]>
drivers/hv/channel_mgmt.c

index 417a95e5094dd9d914eb8ab7c18971a62e15b21e..af7832e1316741bb821da9c5a127131e51e33fc0 100644 (file)
@@ -750,7 +750,7 @@ static void vmbus_wait_for_unload(void)
        void *page_addr;
        struct hv_message *msg;
        struct vmbus_channel_message_header *hdr;
-       u32 message_type;
+       u32 message_type, i;
 
        /*
         * CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was
@@ -760,8 +760,11 @@ static void vmbus_wait_for_unload(void)
         * functional and vmbus_unload_response() will complete
         * vmbus_connection.unload_event. If not, the last thing we can do is
         * read message pages for all CPUs directly.
+        *
+        * Wait no more than 10 seconds so that the panic path can't get
+        * hung forever in case the response message isn't seen.
         */
-       while (1) {
+       for (i = 0; i < 1000; i++) {
                if (completion_done(&vmbus_connection.unload_event))
                        break;
 
This page took 0.06154 seconds and 4 git commands to generate.