summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2015-02-27 11:26:04 -0800
committerBen Hutchings <ben@decadent.org.uk>2015-08-07 00:31:59 +0100
commitc551ce23bfc919747797f8d0fa9ecf319508378d (patch)
tree780531402623ba1fd9058594e80421d6efbc8f2c
parent5f7c3cbe030b39e9adb584c2be1fb842bfc0899f (diff)
downloadlinux-stable-c551ce23bfc919747797f8d0fa9ecf319508378d.tar.gz
linux-stable-c551ce23bfc919747797f8d0fa9ecf319508378d.tar.bz2
linux-stable-c551ce23bfc919747797f8d0fa9ecf319508378d.zip
Drivers: hv: vmbus: Fix a bug in the error path in vmbus_open()
commit 40384e4bbeb9f2651fe9bffc0062d9f31ef625bf upstream. Correctly rollback state if the failure occurs after we have handed over the ownership of the buffer to the host. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/hv/channel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 44a1ea4732b0..a7e6f0373485 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -177,7 +177,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
GFP_KERNEL);
if (!open_info) {
err = -ENOMEM;
- goto error0;
+ goto error_gpadl;
}
init_completion(&open_info->waitevent);
@@ -193,7 +193,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
if (userdatalen > MAX_USER_DEFINED_BYTES) {
err = -EINVAL;
- goto error0;
+ goto error_gpadl;
}
if (userdatalen)
@@ -234,6 +234,9 @@ error1:
list_del(&open_info->msglistentry);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
+error_gpadl:
+ vmbus_teardown_gpadl(newchannel, newchannel->ringbuffer_gpadlhandle);
+
error0:
free_pages((unsigned long)out,
get_order(send_ringbuffer_size + recv_ringbuffer_size));