diff options
author | K. Y. Srinivasan <kys@microsoft.com> | 2015-02-27 14:26:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-01 22:30:08 -0500 |
commit | 40384e4bbeb9f2651fe9bffc0062d9f31ef625bf (patch) | |
tree | cf93c3c72e813f1be0ece2f6a42a6f1fece1b625 /drivers/hv/channel.c | |
parent | b057b3ad16e1c6e21e234cd7f5c61c525da97f17 (diff) |
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: K. Y. Srinivasan <kys@microsoft.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/channel.c')
-rw-r--r-- | drivers/hv/channel.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index f6879950e131..bf0cf8f3bcaf 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c | |||
@@ -137,7 +137,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
137 | GFP_KERNEL); | 137 | GFP_KERNEL); |
138 | if (!open_info) { | 138 | if (!open_info) { |
139 | err = -ENOMEM; | 139 | err = -ENOMEM; |
140 | goto error0; | 140 | goto error_gpadl; |
141 | } | 141 | } |
142 | 142 | ||
143 | init_completion(&open_info->waitevent); | 143 | init_completion(&open_info->waitevent); |
@@ -153,7 +153,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
153 | 153 | ||
154 | if (userdatalen > MAX_USER_DEFINED_BYTES) { | 154 | if (userdatalen > MAX_USER_DEFINED_BYTES) { |
155 | err = -EINVAL; | 155 | err = -EINVAL; |
156 | goto error0; | 156 | goto error_gpadl; |
157 | } | 157 | } |
158 | 158 | ||
159 | if (userdatalen) | 159 | if (userdatalen) |
@@ -197,6 +197,9 @@ error1: | |||
197 | list_del(&open_info->msglistentry); | 197 | list_del(&open_info->msglistentry); |
198 | spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); | 198 | spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); |
199 | 199 | ||
200 | error_gpadl: | ||
201 | vmbus_teardown_gpadl(newchannel, newchannel->ringbuffer_gpadlhandle); | ||
202 | |||
200 | error0: | 203 | error0: |
201 | free_pages((unsigned long)out, | 204 | free_pages((unsigned long)out, |
202 | get_order(send_ringbuffer_size + recv_ringbuffer_size)); | 205 | get_order(send_ringbuffer_size + recv_ringbuffer_size)); |