Drivers: hv: vmbus: Fix a bug in the handling of channel offers
authorK. Y. Srinivasan <kys@microsoft.com>
Mon, 26 Aug 2013 21:08:58 +0000 (14:08 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Sep 2013 14:06:46 +0000 (07:06 -0700)
commit 42dceebe34600b2d02a38baa3e869009ba3d14c7 upstream.

The channel state should be correctly set before registering the device. In the current
code the driver probe would fail for channels that have been rescinded and subsequently
re-offered. Fix the bug.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/channel_mgmt.c

index 0df75908200e034044ee36fa3fb5403a39fc5efd..461f47b6691e4d48321b27d7a56b42caa092c18c 100644 (file)
@@ -261,6 +261,13 @@ static void vmbus_process_offer(struct work_struct *work)
                return;
        }
 
+       /*
+        * This state is used to indicate a successful open
+        * so that when we do close the channel normally, we
+        * can cleanup properly
+        */
+       newchannel->state = CHANNEL_OPEN_STATE;
+
        /*
         * Start the process of binding this offer to the driver
         * We need to set the DeviceObject field before calling
@@ -287,13 +294,6 @@ static void vmbus_process_offer(struct work_struct *work)
                kfree(newchannel->device_obj);
 
                free_channel(newchannel);
-       } else {
-               /*
-                * This state is used to indicate a successful open
-                * so that when we do close the channel normally, we
-                * can cleanup properly
-                */
-               newchannel->state = CHANNEL_OPEN_STATE;
        }
 }