提交 40384e4b 编写于 作者: K K. Y. Srinivasan 提交者: Greg Kroah-Hartman

Drivers: hv: vmbus: Fix a bug in the error path in vmbus_open()

Correctly rollback state if the failure occurs after we have handed over
the ownership of the buffer to the host.
Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
Cc: stable@vger.kernel.org
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 b057b3ad
...@@ -137,7 +137,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, ...@@ -137,7 +137,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
GFP_KERNEL); GFP_KERNEL);
if (!open_info) { if (!open_info) {
err = -ENOMEM; err = -ENOMEM;
goto error0; goto error_gpadl;
} }
init_completion(&open_info->waitevent); init_completion(&open_info->waitevent);
...@@ -153,7 +153,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, ...@@ -153,7 +153,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
if (userdatalen > MAX_USER_DEFINED_BYTES) { if (userdatalen > MAX_USER_DEFINED_BYTES) {
err = -EINVAL; err = -EINVAL;
goto error0; goto error_gpadl;
} }
if (userdatalen) if (userdatalen)
...@@ -197,6 +197,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, ...@@ -197,6 +197,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
list_del(&open_info->msglistentry); list_del(&open_info->msglistentry);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
error_gpadl:
vmbus_teardown_gpadl(newchannel, newchannel->ringbuffer_gpadlhandle);
error0: error0:
free_pages((unsigned long)out, free_pages((unsigned long)out,
get_order(send_ringbuffer_size + recv_ringbuffer_size)); get_order(send_ringbuffer_size + recv_ringbuffer_size));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册