summaryrefslogtreecommitdiffstats
path: root/drivers/staging/hv/vmbus_drv.c
diff options
context:
space:
mode:
authorHaiyang Zhang <haiyangz@microsoft.com>2010-05-28 23:22:44 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2010-06-30 08:18:14 -0700
commit8b5d6d3bd3e34e4cc67d875c8c88007c1c9aa960 (patch)
tree2f923d8299574a31799c14bfd9ecc10520ed9b02 /drivers/staging/hv/vmbus_drv.c
parent6c2fd308045ba902fbe9f4408daa7b949fa8f5a1 (diff)
staging: hv: Fix race condition on vmbus channel initialization
There is a possible race condition when hv_utils starts to load immediately after hv_vmbus is loading - null pointer error could happen. This patch added wait/completion to ensure all channels are ready before vmbus loading completes. So another module won't have any uninitialized channel. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/hv/vmbus_drv.c')
-rw-r--r--drivers/staging/hv/vmbus_drv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index c21731a12ca..22c80ece638 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -27,6 +27,7 @@
#include <linux/pci.h>
#include <linux/dmi.h>
#include <linux/slab.h>
+#include <linux/completion.h>
#include "version_info.h"
#include "osd.h"
#include "logging.h"
@@ -356,6 +357,8 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv))
vmbus_drv_obj->GetChannelOffers();
+ wait_for_completion(&hv_channel_ready);
+
cleanup:
DPRINT_EXIT(VMBUS_DRV);