From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 568CD201 for ; Wed, 7 Nov 2018 11:02:52 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2018 02:02:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,475,1534834800"; d="scan'208";a="87330352" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga007.jf.intel.com with ESMTP; 07 Nov 2018 02:02:51 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 02:02:51 -0800 Received: from fmsmsx117.amr.corp.intel.com ([169.254.3.70]) by FMSMSX154.amr.corp.intel.com ([169.254.6.221]) with mapi id 14.03.0415.000; Wed, 7 Nov 2018 02:02:50 -0800 From: "Wiles, Keith" To: Stephen Hemminger CC: dev Thread-Topic: [dpdk-dev] [PATCH 3/4] net/tap: fix file descriptor leak on error Thread-Index: AQHUdgc6kqoSjidN7UCXK1tdZ+9ANaVEnCIA Date: Wed, 7 Nov 2018 10:02:50 +0000 Message-ID: <4DF969B8-7809-490B-8393-010184DD1AA0@intel.com> References: <20181106193005.5383-1-stephen@networkplumber.org> <20181106193005.5383-4-stephen@networkplumber.org> In-Reply-To: <20181106193005.5383-4-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.237.220.99] Content-Type: text/plain; charset="us-ascii" Content-ID: <8BC514BB12773F428745ACE79A2D4CE3@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 3/4] net/tap: fix file descriptor leak on error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Nov 2018 10:02:52 -0000 > On Nov 6, 2018, at 7:30 PM, Stephen Hemminger wrote: >=20 > If netlink socket setup fails the file descriptor was leaked. Acked-by: Keith Wiles >=20 > Coverity issue: 257040 > Fixes: 7c25284e30c2 ("net/tap: add netlink back-end for flow API") > Signed-off-by: Stephen Hemminger > --- > drivers/net/tap/tap_netlink.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.= c > index 6cb510092218..14bbbec754f6 100644 > --- a/drivers/net/tap/tap_netlink.c > +++ b/drivers/net/tap/tap_netlink.c > @@ -51,14 +51,17 @@ tap_nl_init(uint32_t nl_groups) > } > if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf_size, sizeof(int))) { > TAP_LOG(ERR, "Unable to set socket buffer send size"); > + close(fd); > return -1; > } > if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf_size, sizeof(int))) { > TAP_LOG(ERR, "Unable to set socket buffer receive size"); > + close(fd); > return -1; > } > if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) { > TAP_LOG(ERR, "Unable to bind to the netlink socket"); > + close(fd); > return -1; > } > return fd; > --=20 > 2.17.1 >=20 Regards, Keith