From: Dexuan Cui <decui@microsoft.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>,
KY Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>,
"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 1/3] Drivers: hv: vmbus: do cleanup on all vmbus_open() failure paths
Date: Tue, 21 Apr 2015 08:35:14 +0000 [thread overview]
Message-ID: <8aa8661a8b9743aca9f54841c2622aa3@SIXPR30MB031.064d.mgd.msft.net> (raw)
In-Reply-To: <1429604274-12537-2-git-send-email-vkuznets@redhat.com>
> -----Original Message-----
> From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com]
> Sent: Tuesday, April 21, 2015 16:18
> To: KY Srinivasan
> Cc: Haiyang Zhang; devel@linuxdriverproject.org; linux-
> kernel@vger.kernel.org; Dexuan Cui
> Subject: [PATCH 1/3] Drivers: hv: vmbus: do cleanup on all vmbus_open()
> failure paths
>
> 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);
> --
Thanks for the patch, Vitaly!
The patch looks good to me except for 1 small issue:
I suppose open_info->response.open_result.status is different from
Linux-style -EXXX error codes.
Maybe here we can return -EAGAIN if err != 0 ?
-- Dexuan
next prev parent reply other threads:[~2015-04-21 8:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 8:17 [PATCH 0/3] Drivers: hv: vmbus: additional fixes for the setup/teardown path Vitaly Kuznetsov
2015-04-21 8:17 ` [PATCH 1/3] Drivers: hv: vmbus: do cleanup on all vmbus_open() failure paths Vitaly Kuznetsov
2015-04-21 8:35 ` Dexuan Cui [this message]
2015-04-21 11:35 ` Vitaly Kuznetsov
2015-04-21 9:05 ` Dan Carpenter
2015-04-21 11:36 ` Vitaly Kuznetsov
2015-04-21 8:17 ` [PATCH 2/3] Drivers: hv: vmbus: kill tasklets on module unload Vitaly Kuznetsov
2015-04-21 8:17 ` [PATCH 3/3] Drivers: hv: vmbus: setup irq after synic is initialized Vitaly Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8aa8661a8b9743aca9f54841c2622aa3@SIXPR30MB031.064d.mgd.msft.net \
--to=decui@microsoft.com \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).