lkml.org 
[lkml]   [2015]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/3] Drivers: hv: vmbus: do cleanup on all vmbus_open() failure paths
Date
In case there was an error reported in the response to the CHANNELMSG_OPENCHANNEL
call we need to do the cleanup as a vmbus_open() user won't be doing it after
receiving an error. The cleanup should be done on all failure paths.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
drivers/hv/channel.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 54da66d..836386f 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -186,11 +186,12 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
list_del(&open_info->msglistentry);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);

- if (err == 0)
- newchannel->state = CHANNEL_OPENED_STATE;
+ if (err != 0)
+ goto error_gpadl;

+ newchannel->state = CHANNEL_OPENED_STATE;
kfree(open_info);
- return err;
+ return 0;

error1:
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
--
1.9.3


\
 
 \ /
  Last update: 2015-04-21 11:01    [W:0.057 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site