Correctly compute the local (gpadl) handle. 
I would like to thank Michael Brown <mc...@ipxe.org> for seeing this bug.

Signed-off-by: K. Y. Srinivasan <k...@microsoft.com>
Reported-by: Michael Brown <mc...@ipxe.org>
---
Changes in V2: Added the Reported-by tag.
Changes in V3: Cleaned up the commit log.

 drivers/hv/channel.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 433f72a..c76ffbe 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -366,8 +366,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, 
void *kbuffer,
        unsigned long flags;
        int ret = 0;
 
-       next_gpadl_handle = atomic_read(&vmbus_connection.next_gpadl_handle);
-       atomic_inc(&vmbus_connection.next_gpadl_handle);
+       next_gpadl_handle =
+               (atomic_inc_return(&vmbus_connection.next_gpadl_handle) - 1);
 
        ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
        if (ret)
-- 
1.7.4.1

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to