Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753361AbbDUIti (ORCPT ); Tue, 21 Apr 2015 04:49:38 -0400 Received: from mail-bl2on0116.outbound.protection.outlook.com ([65.55.169.116]:41295 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750775AbbDUIte convert rfc822-to-8bit (ORCPT ); Tue, 21 Apr 2015 04:49:34 -0400 Authentication-Results: spf=pass (sender IP is 206.191.229.116) smtp.mailfrom=microsoft.com; redhat.com; dkim=none (message not signed) header.d=none; From: Dexuan Cui To: Vitaly Kuznetsov , KY Srinivasan CC: Haiyang Zhang , "devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 1/3] Drivers: hv: vmbus: do cleanup on all vmbus_open() failure paths Thread-Topic: [PATCH 1/3] Drivers: hv: vmbus: do cleanup on all vmbus_open() failure paths Thread-Index: AQHQfAu0lpQ7ARUYIECBZAKjHZKTNp1XIlzQ Date: Tue, 21 Apr 2015 08:35:14 +0000 Message-ID: <8aa8661a8b9743aca9f54841c2622aa3@SIXPR30MB031.064d.mgd.msft.net> References: <1429604274-12537-1-git-send-email-vkuznets@redhat.com> <1429604274-12537-2-git-send-email-vkuznets@redhat.com> In-Reply-To: <1429604274-12537-2-git-send-email-vkuznets@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.251.58.196] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:206.191.229.116;CTRY:US;IPV:NLI;EFV:NLI;BMV:1;SFV:NSPM;SFS:(10019020)(6009001)(438002)(13464003)(199003)(51704005)(51914003)(189002)(16796002)(19580395003)(1511001)(50466002)(6806004)(106466001)(46102003)(108616004)(86362001)(5001770100001)(33646002)(87936001)(86146001)(2900100001)(77156002)(47776003)(92566002)(46406003)(106116001)(23726002)(76176999)(66066001)(62966003)(102836002)(50986999)(2561002)(2656002)(19580405001)(97756001)(2950100001)(24736003)(86612001)(54356999)(4001450100001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR03MB1343;H:064-smtp-out.microsoft.com;FPR:;SPF:Pass;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1343; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:CY1PR03MB1343;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1343; X-Forefront-PRVS: 0553CBB77A X-OriginatorOrg: microsoft.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2015 08:35:19.6183 (UTC) X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=72f988bf-86f1-41af-91ab-2d7cd011db47;Ip=[206.191.229.116];Helo=[064-smtp-out.microsoft.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1343 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1866 Lines: 58 > -----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 > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/